Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know a good/neat way to create directory shortcuts in Vim?

Akin to the "~[shortcut]" in Zsh which you can use to quickly specify a directory.

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
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

There is a FavEx plugin: http://www.vim.org/scripts/script.php?script_id=539

share|improve this answer

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

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .