Display Ctrl + [and Ctrl +] to move between buffers in Vim

I am trying to display Ctrl+ [and Ctrl+ ]to move between buffers.

I have this in mine .vimrc:

nnoremap <c-[> :bprevious<CR>
nnoremap <c-]> :bnext<CR>
nnoremap <Esc> :noh<CR>

It works Ctrl+ ]. Ctrl+ [calls :noh, and I do not know why.

I would like Ctrl+ ]and Ctrl+ [just to move between buffers and Escto call :nho.

+4
source share
2 answers

ctrl+ ], ctrl+ [and are ESCalready in use vim. Mapping keys that are already in use vimare not recommended. More in :help map-which-keys.

, , , F2 F3

nnoremap <F2> :bprevious<CR>
nnoremap <F3> :bnext<CR>
+4

@dlmeetei @Lucas Beier . Vim.

, , . ( , unimpaired.vim):

nnoremap [b :bprevious<c>r
nnoremap ]b :bnext<cr>
nnoremap ]B :blast<cr>
nnoremap [B :bfirst<cr>

.:

:h map-which-keys
:h key-notation
:h :bfirst
:h :blast

!

. , :bprevious :bnext :

  • 2 (, - <c-6>/<c-^>).
  • , . ? Backwards? , ?

:bp :bn :b. :b {partial_name}<tab>.

:b:

  • <tab>
  • <c-d>,
  • . :b foo. <tab>.
  • . :b foo*bar :b foo/**/bar
  • :b :sb.
  • : nnoremap <leader>b :ls<cr>:b<space>

.:

:h :b
:h :ls
:h cmdline-completion
:h file-searching

, :b?

, cscope / GNU Global. , , .

Gutentags :h tags.

:find 'path' .,,** .

.:

:h CTRL-]
:h tags
:h cscope
:h :find
:h 'path'

?

, CtrlP fzf . - Projectionist.vim.

. , .

:b, , cscope/GNU Global projectionist.vim. 50+ , .

+3

Source: https://habr.com/ru/post/1681463/


All Articles