New answers tagged


Vim uses registers to store text. It may be helpful for you to read :h registers if you haven't already, as well as the user manual (this is covered in section 04.7) Assuming you are using a version with the clipboard feature compiled in (which the default vim version on macOS as well as homebrew has), you can use the * register. So for your visual mode ...


There's Ctrl-RCtrl-O combo in insert mode (see :h i_CTRL-R_CTRL-O). If setting :h 'paste' is needed, here are the mappings to do this (kind of emulating tpope/vim-unimpaired plugin): nnoremap <silent>[op :setl paste<Bar>au InsertLeave * ++once setl nopaste<CR>O nnoremap <silent>]op :setl paste<Bar>au InsertLeave * ++once ...


I don't know if there is a setting for that but with the :set paste and :set nopaste commands you can do this mapping: :inoremap <silent> <C-R>* <Esc>:set paste<CR>i<C-R>*<Esc>:set nopaste<CR>


I haven't found some elegant way to do so bu you can create your own way to do so. Code First you can create somme key bindings (work on visual mode only). xnoremap <Leader>y y:MultiRegister<Space> xnoremap <Leader>d d:MultiRegister<Space> xnoremap <Leader>c c:MultiRegister<Space> xnoremap <Leader>x x:...


Would you try this? :%s/: \zs/\=@+ If you want space after the comma set your clipboard register before running the above command: :let @+='text from some register, '


function! s:get_char(num) abort if a:num == 0 return matchstr(getline('.'), '.\%' . col('.') . 'c') else return matchstr(getline('.'), '\%' . col('.') . 'c.') endif endfunction Without corner cases and can handle wide characters. Then function! s:is_surrounded(match_list) return index(a:match_list, s:get_char(0) . s:get_char(1)) >= 0 ...

Top 50 recent answers are included