Ok so teleportation is not possible in VIM... but close (In a way hehe). I'm talking about the indispensable CD to the current buffer's location command. I use it every single day, all throughout the day.
This golden command is:
:cd %:p:h
I usually put it in a Dir alias within my VIMRC.
So if I'm working on code updates and help file updates... I would have one or more code files open. They are in:
<proj root>/code/
And I'd have one or more of the help files open in another VIM tab (Yes I use tabs, sorry). The help files are in:
<proj root>/config/help/topics/
I am working on the code pieces so my working directory is:
<proj root>/code/
But I need to open or create some help files to reflect my code changes. I could easily accomplish this by having two different console tabs running VIM, but what if I'm just working around in various project directories. Like maybe I need to hit some config files as well? So to do my help work, I 'gt' to my open help file and enter:
:Dir
Boom! My working directory is now:
<app root>/config/help/topics/
I need to do some work on the config files, I enter:
:e.
Now I have the file explorer, hit '-' twice, open a config file and enter:
:Dir
Boom now I'm in the config directory.
I use this alias all the time. It really makes life more enjoyable.
I use this alias all the time. It really makes life more enjoyable.
No comments:
Post a Comment