Change Working Directory to that of current file
A lot of features in vim work off of the working directory. Here's a quick way to change the working directory to that of the file you are in.
" Change Working Directory to that of the current file
cmap cwd lcd %:p:h
cmap cd. lcd %:p:h
There are two alternative keymappings here.
I prefer the latter, but there's no harm of having both in your .vimrc file.
... or simply install spf13-vim, a popular vim configuration & distribution that stays true to the feel of vim while providing modern features like a plugin management system, autocomplete, tags and tons more.
Written by Steve Francia
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#