문제

I would like to have some sort of auto completion for named registers.
If I try to access one (" or CTRL+r ...) a completion similar to the line completion (CTRL+l) should be opened. Some nice visualization of the unused/free register would be nice too.

Is there a nice solution for this?

도움이 되었습니까?

해결책

Hooking into the built-in commands (like " and Ctrl+r) is difficult, because Vim then is in a special sub-mode where it waits for the register name. I use the following "" mapping (which normally is a no-op) to refresh my memory:

" ["x][N]""         List contents of the passed register / [N] named
"                   registers / all registers (that typically contain
"                   pasteable text).
nnoremap <silent> <expr> "" ':<C-u>registers ' . (v:register ==# '"' ? (v:count ? strpart('abcdefghijklmnopqrstuvwxyz', 0, v:count1) : '"0123456789abcdefghijklmnopqrstuvwxyz*+.') : v:register) . "<CR>"

다른 팁

I recently created plugin https://github.com/imomaliev/registers.vim

Install it with your favourite plugin manager(like Plug)

Plug 'imomaliev/registers.vim'

Аnd after that you can do <C-x><C-r> in insert mode and completion menu with registers will be called.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top