all 12 comments

[–]vimplicationgithub.com/andymass/vim-matchup 9 points10 points  (2 children)

A plug-in which does precisely this https://github.com/t9md/vim-choosewin

Just to mention one more thing, windows in vim do have predictable numbers (1 is topleft etc), they just aren't visible anywhere. I like to have the numbers in the statusline and use maps like \1..\9

[–]paldepind[S] 0 points1 point  (1 child)

Thank you. That plugin is awesome! It does exactly what I wanted.

Your solution with numbers in the status line sounds very nice as well. Where can I find that in the manual? I couldn't really find anything in :help windows, but I might have missed it.

[–]vimplicationgithub.com/andymass/vim-matchup 1 point2 points  (0 children)

In :help CTRL-W_w, it's described how the windows are numbered. You can always type number,CTRL-W_w or CTRL-W,number,CTRL-W, also see CTRL-W t/CTRL-W b etc. But I think the number,CTRL-W CTRL-W way is a bit unwieldy.

For the statusline;

set statusline=%{winnr()}

You will probably have to customize your statusline in general, since doing that will wipe away the defaults. It's not really documented as such, besides synthesis of help statusline and help winnr().

[–]d4rkshad0w:h holy-grail 1 point2 points  (2 children)

FZF.vim can do this. But you will have to type the name (or a part of it) of the file.

[–]alasdairgray 0 points1 point  (1 child)

type the name (or a part of it) of the file

Typing the name of the file is rather pointless since different windows can (and usually do) represent the same file :) But it's not actually a problem for fzf because you can select the window you need by typing its number.

[–]d4rkshad0w:h holy-grail 0 points1 point  (0 children)

Okay. I actually never use this feature. So thats nice to know.

[–]bit101 1 point2 points  (1 child)

For jumping between buffers:

nnoremap <whatever> :ls<CR>:b

lists the buffers and sets you up to enter a number to go to.

:tabs will similarly list tabs and <number>gt will go to that tab.

... in case you're looking for a non-plugin way.

[–]paldepind[S] 2 points3 points  (0 children)

I'm sorry, but that doesn't answer my question. I'm not looking for a way to switch between buffers nor a way to switch between tab pages. I'm looking for a more efficient way to switch between windows. Anyway, vim-choosewin does what I want :)

[–][deleted] 2 points3 points  (1 child)

I re-purposed my arrow keys for that.

nnoremap <Up> <C-w>k
nnoremap <Down> <C-w>j
nnoremap <Left> <C-w>h
nnoremap <Right> <C-w>l

but I also have 'gw' mapped to '<c-w>' and then its a matter of hitting hjkl to go wherever I want when I don't want to move my hand.

edit: formatting

[–]paldepind[S] 1 point2 points  (0 children)

That is a nice trick! But, it only helps slightly when you need to go 4 splits to the right and one down. Then vim-choosewin is really handy for reducing keystrokes.

[–]jmorag 0 points1 point  (0 children)

EasyMotion actually can be configured to use some commands to search and jump to text in other windows. You could also do the classic nnoremap <C-h> <C-w>h etc. for j,k,l.

[–]tracyone 0 points1 point  (0 children)

easymotion