Created
May 17, 2017 05:38
-
-
Save anishsane/506aa53fc10744e9bdd966ebda5a758d to your computer and use it in GitHub Desktop.
Adds a bang option to cscope and scsope commands in vim. With bang, it will not jump to the first match.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -uNrp vim.orig_cscope/runtime/doc/if_cscop.txt vim/runtime/doc/if_cscop.txt | |
--- vim.orig_cscope/runtime/doc/if_cscop.txt 2016-10-14 15:34:12.783474620 +0530 | |
+++ vim/runtime/doc/if_cscop.txt 2016-10-14 15:37:55.947476646 +0530 | |
@@ -264,6 +264,8 @@ The default value is "" (don't use quick | |
seems to be useful: > | |
:set cscopequickfix=s-,c-,d-,i-,t-,e-,a- | |
< | |
+If cscope was executed with !, Vim will not jump to the first error in | |
+the quickfix window. | |
*cscopetag* *cst* | |
If 'cscopetag' is set, the commands ":tag" and CTRL-] as well as "vim -t" | |
will always use |:cstag| instead of the default :tag behavior. Effectively, | |
diff -uNrp vim.orig_cscope/src/ex_cmds.h vim/src/ex_cmds.h | |
--- vim.orig_cscope/src/ex_cmds.h 2016-10-14 15:34:48.815474947 +0530 | |
+++ vim/src/ex_cmds.h 2016-10-14 16:18:47.079498894 +0530 | |
@@ -392,7 +392,7 @@ EX(CMD_crewind, "crewind", ex_cc, | |
RANGE|NOTADR|COUNT|TRLBAR|BANG, | |
ADDR_LINES), | |
EX(CMD_cscope, "cscope", ex_cscope, | |
- EXTRA|NOTRLCOM|XFILE, | |
+ EXTRA|NOTRLCOM|XFILE|BANG, | |
ADDR_LINES), | |
EX(CMD_cstag, "cstag", ex_cstag, | |
BANG|TRLBAR|WORD1, | |
@@ -1250,7 +1250,7 @@ EX(CMD_scriptencoding, "scriptencoding", | |
WORD1|TRLBAR|CMDWIN, | |
ADDR_LINES), | |
EX(CMD_scscope, "scscope", ex_scscope, | |
- EXTRA|NOTRLCOM, | |
+ EXTRA|NOTRLCOM|BANG, | |
ADDR_LINES), | |
EX(CMD_set, "set", ex_set, | |
TRLBAR|EXTRA|CMDWIN|SBOXOK, | |
diff -uNrp vim.orig_cscope/src/if_cscope.c vim/src/if_cscope.c | |
--- vim.orig_cscope/src/if_cscope.c 2016-10-14 15:34:08.943474585 +0530 | |
+++ vim/src/if_cscope.c 2016-10-14 16:16:03.715497411 +0530 | |
@@ -1265,7 +1265,11 @@ cs_find_common( | |
*/ | |
qi = (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL) | |
? wp->w_llist_ref : wp->w_llist; | |
- qf_jump(qi, 0, 0, forceit); | |
+ | |
+ if (!forceit) | |
+ { | |
+ qf_jump(qi, 0, 0, forceit); | |
+ } | |
} | |
} | |
mch_remove(tmp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment