DEV Community

Cover image for Some lesser known Vim tips
Harshkumar77
Harshkumar77

Posted on

Some lesser known Vim tips

Just sharing some lesser known remaps hope it helps

Quickly enter command mode

nnoremap ; :
nnoremap : ;
Enter fullscreen mode Exit fullscreen mode
  • In my experience I have seen my self using command mode more than ; motion
  • But I still use ; motion time to time so I have remapped also

Last buffer

  • We all know <C-o> and <C-i> are awesome they jump to last point. But for long time I was using them also to navigate navigate to last buffer such a shame ....
  • Vim always had <C-^> for moving to last file
nnoremap Q <C-^>
Enter fullscreen mode Exit fullscreen mode
  • I have remapped it to this for my preference but use you own

Increment and decrement

  • I dont use this vim feature often but sometimes it comes handy when you are working on UI
  • Sadly I never remember them when I need them
nnoremap - <C-x>
nnoremap + <C-a>
Enter fullscreen mode Exit fullscreen mode
  • For me its very intuitive

Copying

  • Yank in vim is awesome but there is a problem when you want to copy something from buffer to system keyboard
  • People do this crazy stuff which I dont understand
vnoremap y "+y
nnoremap y "+y
Enter fullscreen mode Exit fullscreen mode
  • what is does that system clipboard and vim clipboard is essentially same , I think its problematic because It will clutter you system clipboard. Instead I like to do is
vnoremap Y "+y
nnoremap Y "+y
Enter fullscreen mode Exit fullscreen mode
  • This way when they stay different

Here are my some tips which I have found along the ways. Share me your own.

Also if you are hiring for a backend or frontend role (remote global). Let me know.

Top comments (0)