Last active
June 5, 2017 07:44
-
-
Save presuku/fa7f351e792a9e74bfbd61684f0139ab to your computer and use it in GitHub Desktop.
Add i_CTRL-V/i_CTRL-Q state to mode(1) #vim
This file contains hidden or 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 --git a/src/edit.c b/src/edit.c | |
index 3eda88f57..d7486a31d 100644 | |
--- a/src/edit.c | |
+++ b/src/edit.c | |
@@ -930,8 +930,10 @@ edit( | |
#endif | |
if (c == Ctrl_V || c == Ctrl_Q) | |
{ | |
+ ctrl_v_mode = 1; | |
ins_ctrl_v(); | |
c = Ctrl_V; /* pretend CTRL-V is last typed character */ | |
+ ctrl_v_mode = 0; | |
continue; | |
} | |
diff --git a/src/evalfunc.c b/src/evalfunc.c | |
index e1d21dc54..72a14e129 100644 | |
--- a/src/evalfunc.c | |
+++ b/src/evalfunc.c | |
@@ -7882,6 +7882,8 @@ f_mode(typval_T *argvars, typval_T *rettv) | |
buf[1] = 'x'; | |
#endif | |
} | |
+ if (ctrl_v_mode == 1) | |
+ buf[1] = 'V'; | |
} | |
else if ((State & CMDLINE) || exmode_active) | |
{ | |
@@ -7890,6 +7892,8 @@ f_mode(typval_T *argvars, typval_T *rettv) | |
buf[1] = 'v'; | |
else if (exmode_active == EXMODE_NORMAL) | |
buf[1] = 'e'; | |
+ if (ctrl_v_mode == 1) | |
+ buf[1] = 'V'; | |
} | |
else | |
{ | |
diff --git a/src/ex_getln.c b/src/ex_getln.c | |
index 70f447445..8bcaad575 100644 | |
--- a/src/ex_getln.c | |
+++ b/src/ex_getln.c | |
@@ -2089,6 +2089,7 @@ docomplete: | |
case Ctrl_V: | |
case Ctrl_Q: | |
+ ctrl_v_mode = 1; | |
#ifdef FEAT_MOUSE | |
ignore_drag_release = TRUE; | |
#endif | |
@@ -2104,6 +2105,7 @@ docomplete: | |
cursorcmd(); | |
} | |
#endif | |
+ ctrl_v_mode = 0; | |
break; | |
#ifdef FEAT_DIGRAPHS | |
diff --git a/src/globals.h b/src/globals.h | |
index c63e17ef1..344d0776a 100644 | |
--- a/src/globals.h | |
+++ b/src/globals.h | |
@@ -984,6 +984,8 @@ EXTERN hlf_T edit_submode_highl; /* highl. method for extra info */ | |
EXTERN int ctrl_x_mode INIT(= 0); /* Which Ctrl-X mode are we in? */ | |
#endif | |
+EXTERN int ctrl_v_mode INIT(= 0); /* Which Ctrl-V mode are we in? */ | |
+ | |
EXTERN int no_abbr INIT(= TRUE); /* TRUE when no abbreviations loaded */ | |
#ifdef USE_EXE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment