Fix q: mapping breaking "recording ..." display
Adapted from https://stackoverflow.com/questions/43654089/vim-mapping-q-only-when-not-recording
This commit is contained in:
parent
bb5283aaf2
commit
daaf57d1b8
23
init.vim
23
init.vim
|
@ -123,8 +123,27 @@ autocmd BufNewFile *.{h,hpp} call <SID>insert_gates()
|
|||
nnoremap <space> za
|
||||
vnoremap <silent> . :normal .<CR>
|
||||
|
||||
nnoremap q: :q
|
||||
nnoremap <leader>: q:
|
||||
"nnoremap q: :q
|
||||
"nnoremap <leader>: q:
|
||||
nnoremap <silent> q :<C-u>call <SID>SmartQ()<CR>
|
||||
function! s:SmartQ()
|
||||
if exists("g:recording_macro")
|
||||
let r = g:recording_macro
|
||||
unlet g:recording_macro
|
||||
normal! q
|
||||
execute 'let @'.r.' = @'.r.'[:-2]'
|
||||
else
|
||||
let c = nr2char(getchar())
|
||||
if c == ':'
|
||||
call feedkeys(":q")
|
||||
else
|
||||
if c =~ '\v[0-9a-zA-Z"]'
|
||||
let g:recording_macro = c
|
||||
endif
|
||||
execute 'normal! q'.c
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
map <Left> <C-w>h
|
||||
map <Down> <C-w>j
|
||||
|
|
Loading…
Reference in a new issue