Getting started with macvim, how to manage a project?
-
08-10-2019 - |
Question
I have started out with macvim and now fairly comfortable with the navigation (on a single file) and now I need to write a whole project (say rails) using mvim.
In textmate, you have mate project_dir
which opens the project in a side drawer, so my question is:
- Is there a similar feature in mvim?
- How can a complete project managed in traditionally in macvim?
Links to some write-ups are welcomed.
Solution
Just try using Janus. Made it really easy for me to switch from TextMate.
OTHER TIPS
As @changelog pointed out, the absolute best way to get MacVim to behave like Textmate is to use Janus. Janus packages up a bunch of popular plugins and provides an easy way to keep those pluggins up-to-date via a rakefile. Janus also includes NERDTree (mentioned by @zengr) along with a variety of other tools that make it really easy to manage a big project.
In order to launch mvim the way that you launch textmate with mate project_dir
, an mvim script is included in the MacVim download. You just need to put it in your path (I keep mine in /usr/local/bin/mvim
). Using this script you can do the exact same thing:
mvim project_dir
- to open a specific directory in MacVim
mvim .
or just mvim
- to open your current directory in MacVim
PROJECT is really awesome. You can easily add folders to your project (single ones, or recursively), specify filters, etc.
It's really worth a try.
Try :help mksession
.
Load all your 'project' files (either interactively or using the command line vim file1 file2 ...
.) Running :mksession xxx
writes a vim script to restore the environment and load all currently loaded files.
Next time just :source xxx
to reload your environment (or run vim -s xxx
to execute the file on startup).
Note: For navigating source files (as opposed to data files), ctags
is, in my opinion, a better option. Create a ctags database (ctags works for Ruby scripts too!) and navigate in your code tree using :tag myfunc
. No need to preload any file.