summaryrefslogtreecommitdiff
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-10 18:16:20 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-10 18:16:20 +0200
commit65f084749b260746d7f186af4f080298be2df55b (patch)
treebff55e0c1924c835001e7dc92857e3e09e5433e1 /src/ex_docmd.c
parentc168bd4bd3a9b856fc410fc4515dcca1d10d7461 (diff)
downloadvim-git-65f084749b260746d7f186af4f080298be2df55b.tar.gz
patch 8.0.1090: cannot get the text under the cursor like v:beval_textv8.0.1090
Problem: cannot get the text under the cursor like v:beval_text Solution: Add <cexpr>.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 33f544437..c29032878 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -10650,31 +10650,33 @@ find_cmdline_var(char_u *src, int *usedlen)
"%",
#define SPEC_PERC 0
"#",
-#define SPEC_HASH 1
+#define SPEC_HASH (SPEC_PERC + 1)
"<cword>", /* cursor word */
-#define SPEC_CWORD 2
+#define SPEC_CWORD (SPEC_HASH + 1)
"<cWORD>", /* cursor WORD */
-#define SPEC_CCWORD 3
+#define SPEC_CCWORD (SPEC_CWORD + 1)
+ "<cexpr>", /* expr under cursor */
+#define SPEC_CEXPR (SPEC_CCWORD + 1)
"<cfile>", /* cursor path name */
-#define SPEC_CFILE 4
+#define SPEC_CFILE (SPEC_CEXPR + 1)
"<sfile>", /* ":so" file name */
-#define SPEC_SFILE 5
+#define SPEC_SFILE (SPEC_CFILE + 1)
"<slnum>", /* ":so" file line number */
-#define SPEC_SLNUM 6
+#define SPEC_SLNUM (SPEC_SFILE + 1)
#ifdef FEAT_AUTOCMD
"<afile>", /* autocommand file name */
-# define SPEC_AFILE 7
+# define SPEC_AFILE (SPEC_SLNUM + 1)
"<abuf>", /* autocommand buffer number */
-# define SPEC_ABUF 8
+# define SPEC_ABUF (SPEC_AFILE + 1)
"<amatch>", /* autocommand match name */
-# define SPEC_AMATCH 9
+# define SPEC_AMATCH (SPEC_ABUF + 1)
#endif
#ifdef FEAT_CLIENTSERVER
"<client>"
# ifdef FEAT_AUTOCMD
-# define SPEC_CLIENT 10
+# define SPEC_CLIENT (SPEC_AMATCH + 1)
# else
-# define SPEC_CLIENT 7
+# define SPEC_CLIENT (SPEC_SLNUM + 1)
# endif
#endif
};
@@ -10762,10 +10764,13 @@ eval_vars(
/*
* word or WORD under cursor
*/
- if (spec_idx == SPEC_CWORD || spec_idx == SPEC_CCWORD)
+ if (spec_idx == SPEC_CWORD || spec_idx == SPEC_CCWORD
+ || spec_idx == SPEC_CEXPR)
{
- resultlen = find_ident_under_cursor(&result, spec_idx == SPEC_CWORD ?
- (FIND_IDENT|FIND_STRING) : FIND_STRING);
+ resultlen = find_ident_under_cursor(&result,
+ spec_idx == SPEC_CWORD ? (FIND_IDENT | FIND_STRING)
+ : spec_idx == SPEC_CEXPR ? (FIND_IDENT | FIND_STRING | FIND_EVAL)
+ : FIND_STRING);
if (resultlen == 0)
{
*errormsg = (char_u *)"";