I have a quite a few leader mapped keys in my
.vimrc, and I use some of them.
The mapping that I use the most is to split the vim window to an existing
buffer buffer. If I wanted to split to file I have already opened, and I know
the buffer number is 2, I could type:
This is a simple mapping but I think an effective one since it’s shorter and does not require the shift key.
The mappings look like this:
map <leader>- :sp<bar>b map <leader>\ :vsp<bar>b
\ and not
When I first made the mapping, I used
- for horizontal splits and
vertical split, since each of those characters look like the type of split they
produce. This ended up being annoying since
- does not need a
| does. To make typing them more constant I settled on
it’s the lowercase
Open buffer in a new tab
map <leader>t :tabe<bar>b
What’s the point?
The mappings are quite simple but change a 7 character mixed-case sequence into a 4 character lowercase sequence. I would highly recommend them to anyone who uses vim windows, buffers and tabs.