For the Rails developer, there is a famous Tim Pope plugin called rails.vim .
Once you are at the root of the rails project (you can change the current Vim directory with :cd /path/to/project/root ), rails.vim provides quick access to your file, for example:
- : Rcontroller file
- : Rview file
- : Rstylesheet file
These are other partial refactoring options. Install it and type :help rails.txt . There are many nice features. It is very useful to speed up access to your project files.
You can probably combine it with session.vim , which provides the ability to automatically restore a previous session.
If you do not want to enter the path to the project, one of the possible solutions is to add the following code at the end of your .vimrc:
if isdirectory("~/workspace/project1") cd ~/workspace/project1 endif
This way you always run Vim in the current workspace. Obviously, if you need to switch to another directory, you need to manually edit your .vimrc ... which is the best fit.
Xavier T.
source share