Just a quick note. For you Mac & Vim users out there - MACVIM. It truly rocks.
Also, a quick "oh my gosh I'm so glad I finally found a command for this," and then a "doh, of course!"
I often launch Vim and then have to work on a set of files in some specific project directly. Its a pain to have to type something like:
:e ~/Documents/ProjectA/subProjectX/file1.py
:sp ~/Documents/ProjectA/subProjectX/file2.py
:sp ~/Documents/ProjectA/subProjectX/file3.py
over and over and over again. I've been looking for the command to set your 'current directory', and I found it: cd. Duh:
:cd ~/Documents/ProjectA/subProjectX
:e file1.py
:sp file2.py
:sp file3.py
So much better.
Subscribe to:
Post Comments (Atom)
3 comments:
I have this in my .vimrc:
map <leader>cd :cd %:p:h<CR>
— when I have a file open, hitting \cd will change Vim's working directory to the location of the file. I use it all the time.
This one's indispensable to me:
" auto-change directory to current buffer
autocmd BufEnter * :cd %:p:h
Thanks a lot guys. That has helped me a lot.
Post a Comment