Loading...

VIM Tips & Tricks #2 Remapping leader, semicolon and switching between files

vim tips and tricks

It’s time for second part of VIM Tips & Tricks! I’ve decided to run this series as batches of tips instead of spamming with post about 1 simple line of config.

VIM is all about productivity for me. I’d like to share some more tricks that help me every day to write as fast as possible. Let’s start with typing commands. Pressing shift and ; buttons is a little bit too much to just open command interface, don’t you think? What about fast switching between last 2 files? Pressing control, shift and 6 is really too much to handle!

Let’s fix that!

First problem can be solved easily with:

~/.vimrc

nmap ; :

It’s simple to remap of `;` to `:`. You still can start command the old way, but you can do it without shift too! That’s 1 key press less for every command!

Now let’s address the issue with switching between 2 last files. Basic shortcut for that is control and ^. I strongly suggest to change it to something simpler, like… double click of the key!

~/.vimrc

 nnoremap  

If you didn’t change your leader key, then it’s probably `\\`. That’s not the best-located key ever and pressing it can be pretty tough with some keyboard layouts. What about changing it to `space`? It’s always just under your thumb and you don’t use it in normal mode, do you?

~/.vimrc

let mapleader = "\"

What do you think about these? Do you like it and would you use that in your vim config? Or maybe, do you have any better options to fix these issues? If you do, please let me know and help me with developing the best vim config ever!

If you like what you read, maybe you’d consider following me on twitter and facebook or enabling push notifications for new posts?

PS: part about mapping leader was improved by feedback from drozdziak1. I’d recommend to visit his blog if you like linux & kernel stuff

Leave a Reply

Social media & sharing icons powered by UltimatelySocial