Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Deos somebody know a good/neat way to create shortcuts to directories in Vim?

Akin to the "~[short_cut]" in zsh where you can use it to quickly specify a directory you use.

I could create aliases in my home directory and use "~/[alias]" but it would be nice if I could have something only available in Vim.

share|improve this question
add comment

5 Answers

up vote 1 down vote accepted

You can use cmdalias for Vim. Then you can make custom aliases such as cdsrc to change to a directory like /home/user/project/source.

share|improve this answer
add comment

NerdTree provides bookmarks handling. See ":h NerdTreeBookmarks".

While not directly accessible via ":cd", there is at least ":NERDTreeFromBookmark", where you can then "cd" to this (or another dir).

Also "B" in the NERDTree window will toggle display of bookmarks, and allows to easily access them.

share|improve this answer
    
NerdTree looks awesome. Thanks! –  Daisuke Shimamoto Dec 13 '11 at 7:15
add comment

Something like

let $vimfiles = "c:\\ldigas-home\\gvim72\\vim\\vimfiles"

so when I go

 cd $vimfiles  

it puts me in

c:\ldigas-home\gvim72\\vim\vimfiles

Or did you have something else in mind ?

share|improve this answer
add comment

One way I solved this was by having something like this:

nnoremap <silent> <leader>hd :e ~/daisuke

in my .vimrc. This will populate the command with ":e ~/daisuke" with the cursor at the end. This actually suites me well as majority of the time, I want to edit a file under that directory not necessarily just cd to it (sorry should have been more clear about this!)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.