diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-16 21:25:33 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-16 21:33:30 -0400 |
commit | 015df9c66e66283277c3709376bf6d1f83d55f53 (patch) | |
tree | 40a87e5d5ee8a60e1e693e0a9d9d522fc979697f | |
parent | 68cd18eb0413534807f75a45bb3008c9f2b52947 (diff) | |
download | rneovim-015df9c66e66283277c3709376bf6d1f83d55f53.tar.gz rneovim-015df9c66e66283277c3709376bf6d1f83d55f53.tar.bz2 rneovim-015df9c66e66283277c3709376bf6d1f83d55f53.zip |
vim-patch:8.0.1787: cannot insert the whole cursor line
Problem: Cannot insert the whole cursor line.
Solution: Make CTRL-R CTRL-L work. (Andy Massimino, closes vim/vim#2857)
https://github.com/vim/vim/commit/e2c8d8392684a940cc5608acc73ff47486bd7b92
-rw-r--r-- | runtime/doc/cmdline.txt | 6 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 4 | ||||
-rw-r--r-- | src/nvim/ops.c | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test_cmdline.vim | 3 |
4 files changed, 18 insertions, 3 deletions
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index c46a9fc2d8..f4bc2972bc 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -163,12 +163,14 @@ CTRL-R CTRL-F *c_CTRL-R_CTRL-F* *c_<C-R>_<C-F>* CTRL-R CTRL-P *c_CTRL-R_CTRL-P* *c_<C-R>_<C-P>* CTRL-R CTRL-W *c_CTRL-R_CTRL-W* *c_<C-R>_<C-W>* CTRL-R CTRL-A *c_CTRL-R_CTRL-A* *c_<C-R>_<C-A>* +CTRL-R CTRL-L *c_CTRL-R_CTRL-L* *c_<C-R>_<C-L>* Insert the object under the cursor: CTRL-F the Filename under the cursor CTRL-P the Filename under the cursor, expanded with 'path' as in |gf| CTRL-W the Word under the cursor CTRL-A the WORD under the cursor; see |WORD| + CTRL-L the line under the cursor When 'incsearch' is set the cursor position at the end of the currently displayed match is used. With CTRL-W the part of @@ -176,8 +178,8 @@ CTRL-R CTRL-A *c_CTRL-R_CTRL-A* *c_<C-R>_<C-A>* *c_CTRL-R_CTRL-R* *c_<C-R>_<C-R>* *c_CTRL-R_CTRL-O* *c_<C-R>_<C-O>* -CTRL-R CTRL-R {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A} -CTRL-R CTRL-O {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A} +CTRL-R CTRL-R {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A CTRL-L} +CTRL-R CTRL-O {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A CTRL-L} Insert register or object under the cursor. Works like |c_CTRL-R| but inserts the text literally. For example, if register a contains "xy^Hz" (where ^H is a backspace), diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 0190cfabe5..1192f3cb84 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -3295,8 +3295,10 @@ static bool cmdline_paste(int regname, bool literally, bool remcr) /* check for valid regname; also accept special characters for CTRL-R in * the command line */ if (regname != Ctrl_F && regname != Ctrl_P && regname != Ctrl_W - && regname != Ctrl_A && !valid_yank_reg(regname, false)) + && regname != Ctrl_A && regname != Ctrl_L + && !valid_yank_reg(regname, false)) { return FAIL; + } /* A register containing CTRL-R can cause an endless loop. Allow using * CTRL-C to break the loop. */ diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 7defde731a..af95f94946 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1257,6 +1257,14 @@ int get_spec_reg( *allocated = TRUE; return TRUE; + case Ctrl_L: // Line under cursor + if (!errmsg) { + return false; + } + + *argp = ml_get_buf(curwin->w_buffer, curwin->w_cursor.lnum, false); + return true; + case '_': /* black hole: always empty */ *argp = (char_u *)""; return TRUE; diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 1b7bd83b3c..c302948ba3 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -321,6 +321,9 @@ func Test_paste_in_cmdline() call feedkeys("ft:aaa \<C-R>\<C-F> bbb\<C-B>\"\<CR>", 'tx') call assert_equal('"aaa /tmp/some bbb', @:) + call feedkeys(":aaa \<C-R>\<C-L> bbb\<C-B>\"\<CR>", 'tx') + call assert_equal('"aaa '.getline(1).' bbb', @:) + set incsearch call feedkeys("fy:aaa veryl\<C-R>\<C-W> bbb\<C-B>\"\<CR>", 'tx') call assert_equal('"aaa verylongword bbb', @:) |