Answer the question
In order to leave comments, you need to log in
How to quickly switch buffers in VIM?
Regular VIM users, come on, tell us how you set up VIM for yourself to quickly switch buffers and what plugins you use. I am using the minibufexplorer plugin and the command mappings below. Does anyone have better options?
set hidden
nnoremap <Leader>l :ls<CR>
nnoremap <Leader>p :bp<CR>
nnoremap <Leader>n :bn<CR>
nnoremap <Leader>g :e#<CR>
nnoremap <Leader>1 :1b<CR>
nnoremap <Leader>2 :2b<CR>
nnoremap <Leader>3 :3b<CR>
nnoremap <Leader>4 :4b<CR>
nnoremap <Leader>5 :5b<CR>
nnoremap <Leader>6 :6b<CR>
nnoremap <Leader>7 :7b<CR>
nnoremap <Leader>8 :8b<CR>
nnoremap <Leader>9 :9b<CR>
nnoremap <Leader>0 :10b<CR>
nnoremap <Leader>b :ls<CR>:b<Space>
Answer the question
In order to leave comments, you need to log in
if specifically for buffers, then I use them only in the variant :b part_of_filename
and if for navigation in general, then I have several tabs open (gt), windows are divided (fortunately, the monitor is large), navigation through files and classes (gf), plus I mainly work with rails - I use rails.vim, which gives transitions between controllers/views/models like :Eview, :Econtroller and so on. well, nerdtree for fs navigation
:ls - view all buffers;
:ls :b1 (for example) - see all open, go immediately;
:bf - b - buffer, f - first;
:bl - - , - ;
:b1 - if the required number is known;
:ls :b name file;
https://habr.com/ru/company/mailru/blog/340740/
FZF comes with a basic Vim plugin, but its functionality is minimal, so FZF.vim is designed to provide all the features you need. The most useful commands are :Buffers, :Files and :Tags, I've mapped them to ;, ,t and ,r respectively:
nmap ; :Buffers
nmap t :Files
nmap r :Tags
The ; binding is important to me because I live in buffers. I don't use tabs much - more on that below - so it's important to me that I can switch to whatever I'm thinking about with as little effort as possible.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question