vim - Custom mappings in help text buffers -
i tend not use windows in vim (i prefer tabs), there things use them, such text buffers. i'm fine that, how seldom use windows, takes me second remember how close window (<c-w>c
) , go doing. i'd add line vimrc maps q
close window, if window buffer.
i've done similar netrw windows, this:
augroup wtf_netrw autocmd! autocmd filetype netrw nnoremap <buffer> q :e#<cr> augroup end
i tried doing similar thing filetype help
:
:autocmd filetype nnoremap <buffer> q <c-w>c
but didn't work -- typing q
in text buffer did default q
action, recording macro.
when try :nnoremap q <c-w>c
, typing q
in text buffer closes window expect.
is there special way add mapping works in text buffer?
i use (borrowed junegunn's vimrc, think):
augroup vimrc autocmd! autocmd bufenter *.txt call s:at_help() ... augroup end " special actions files function! s:at_help() if &buftype == 'help' " enable 'q' = quit nnoremap <buffer> q :q<cr> endif endfunction
Comments
Post a Comment