New answers tagged

1

First, <c-u> doesn't actually clear the entire cmdline, only the part before the cursor. There is a note in :help c_CTRL-U about this. I'll assume from the question you want to clear the entire cmdline. On the cmdline, another way to clear the entry is <c-c>. Unlike <c-u> this adds the current text to the history. I suggest the following ...


2

Somewhat workaround if you have recent vim with <cmd> support: cnoremap <C-u> <cmd>let g:CCtrlU = strpart(getcmdline(),0,getcmdpos()-1)<CR><C-u> cnoremap <C-y> <C-r>=get(g:, "CCtrlU", "")<CR><cmd>let g:CCtrlU = ''<CR> With <cmd> it is possible to run arbitrary vimscript ...


3

The substitute command can accept a range prefix. Without it, like: :s/foo/bar/g Will just substitute on the current (cursor) line. :%s/foo/bar/g Will substitute on the whole file. :5,10s/foo/bar/g Will substitute on lines 5 through 10, inclusive. When you visually highlight some text, there are two marks that are automatically updated, mark < denoting ...


2

Do not use <CR> in the mapping as it executes the command you provide. Instead add enough number of <left>s to position cursor between '' where you can provide your command and press enter to get result: nnoremap <F6> :vnew +pu=execute('')<left><left> PS, I use custom :Redir command for that: " Redirect the output of a ...


0

Here’s one way: first press yy to copy line after press dd to delete line and finally press p to paste That is, press yyddp.


6

The format for :m[ove] is :[range]m[ove] {address} Where the range is the line or lines you want to move and the address is the target. Note that the moved line(s) will actually be placed on the line below the address. So you're looking for a range of "mark a" and an address of "the current line". You can find all the special names for ...


2

Thanks to the commenters there are two decent options here. Regarding the path I started on, as @D. Ben Knoble intimated, the escaping was important but I used singles around the doubles instead. I also used 'execute' so I could wrap the whole thing as a string. Not sure if that was needed or not? So :cfdo execute 'norm 5GO"status": "not ...


Top 50 recent answers are included