Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shortcut to open specific file in Vim?

Tags:

vim

Is there a way to configure a shortcut within my .vimrc to automatically open a specific file in a new buffer? I have a file I frequently need to access and I would like to quickly open said file in a new buffer during a coding or writing session. I am not looking for a fuzzy search such as could be achieved with Command-T or PeepOpen, but rather a fast command to open a specific file in a new buffer. Bonus points if there is a way to control the shape of the new buffer window.

like image 982
drbunsen Avatar asked Jan 31 '12 12:01

drbunsen


1 Answers

You can create a mapping like:

nmap <leader>v :e ~/.vimrc<CR>

Now if you hit \v in normal mode, it opens your .vimrc.

Note: \ is the default leader setting, you can change with

let leader="WHATEVER_KEY_PREFIX_YOU_PREFER"

in your .vimrc too.

If you want in a new buffer, just try:

nmap <leader>v :find ~/.vimrc<CR>
like image 158
Zsolt Botykai Avatar answered Sep 25 '22 05:09

Zsolt Botykai