I have just made the switch from Textmate to MacVim and so far I am loving it! My workflow is just becoming a breeze… and I'm kinda hooked on that.
As front-end developer working on Rails projects I find that I am constantly opening up the same folders in the projects (app/assets/javascripts|stylesheets & app/views & specs).
I was wondering if there was a way to set shortcuts to open up these folders in NerdTree? I've looked into Bookmarks but these seem absolute paths - I'd like default relative paths for all the Rails projects I work on. Is this possible?
Thanks,
Ad
There is no default way to do this in NERDTree. It is probably possible, but it would require a custom script to do what you're describing. I'm sure you can get help developing that if you look for it, but I'm betting it will be hard to find something that already does this.
You can, however, check out https://github.com/tpope/vim-rails/, which as far as I know is the de facto standard for Rails development in Vim. It'll probably cut down on your need to use NERDTree to navigate files at all, because you can jump through related files quickly with other commands.
As romaini mentioned, bookmarks are also very handy. Make a bookmark for the top-level of a Rails project, open something, use vim-rails techniques to navigate related files, you'll get what you need.
Did you try the project plugin?
NERDTree stores bookmarks in a very simple file. Creating one such file for every project and pointing NERDtree to it may solve the problem.
Related
I have looked everywhere and I am still unable to switch off this 'feature'!
I've been using vi and, later, vim, since the 80's and I have never had need of multiple cursors, nor can I see a use for them.
:<range>s/search/replace/ does everything I need so this new feature is infuriating beyond words, especially as I've no idea how to switch it off when it seemingly-randomly appears.
Would someone be wonderful enough as to tell me how to banish, remove, consign-to-history the multiple cursors feature in VSCode Vim 1.12.4, please?
I believe this issue is specific to the plugin. I experienced it with the HTML plugin recently, and I'm assuming you have the same problem with HTML files, but the same principle should apply to other plugins as well. You just have to find the setting.
In the VS Code settings, there is an option that reads:
HTML: Mirror Cursor On Matching Tag
You can uncheck the box there to disable the feature. Or you can go to the settings.json in your local repo (inside the .vscode directory), or the equivalent global file, and add/modify the following field like so:
"html.mirrorCursorOnMatchingTag": false
That should take care of it for you.
I typically use an ide for large projects and vi for small single file scripts temporary files etc.
Lately I have heard of people using vi for larger projects too - actually, quite defensive and particular proud to do so.
I have tried, but i found it very cumbersome. Do any other programmers here use vi for and medium - large projects? If so, are there any tips/tricks you can offer for navigating source, looking at multiple files etc?
I have tried using tmux to see if it made things easier - but it still felt quite cumbersome
There is no magical tool that can make everything perfect. Vim is an editor, and it's pretty good at it, but it's not and will never be an IDE.
There used to be the pida project that made an IDE around vim, for better interaction when using python, but it got abandonned.
There is eclim which is a really neat tool that can use eclipse as a backend IDE accessible in a few keystrokes from within vim, while having all the power of eclipse for tagging, refactoring, debugging etc.. But you have to want running eclipse in background, which is like hiding an elephant under the carpet...
There are many little plugins you may want to use, and I'm pretty sure everyone has his favorite set of plugins, that helps navigate easily in the code and help tagging (like fugitive, nerdtree, etc..)
Finally, there is vim, a shell and that's all. Vim does a lot of things correctly, like navigating in the source, launching compilations and parsing the errors etc.. And for what vim is not good at, you can use your shell, to execute, to do git stuff, to open more vim windows to edit code..
Anyway, there's no perfect answer to your question, and I bet your question will be closed because of being "non constructive".
What do you find cumbersome? What works for you? What doesn't? What kind of feature do you need to be able to work efficiently with multiple files? How many are multiple files anyway?
Some people use Vim for working on quite large projects: the Linux kernel, Firefox, Vim itself… I guess that you need to know Vim pretty well to pull that off but it's all very doable, even without many plugins.
But I tend to think "complexity" rather than "quantity".
When I work with "complex" languages+projects (quotes because it is all very subjective) I'll use a more suited IDE with a Vim-emulation plugin: Flash Builder+Vrapper for Actionscript 3, Eclipse+Vrapper (then) Android Studio+IdeaVim (now) for Android.
When I work with "simple" (quotes, again) languages+projects I'll use Vim: that's any project involving HTML/CSS/JavaScript/PHP, from 3 to 50+ files.
File/buffer navigation
Vim is very good at opening files (which sounds funny), even without plugins. :sp **/foo<Tab>, for example, is quick and easy. :Ex foo/bar as well.
Switching buffers is also very easy, if a bit awkward at first. :bn, :bN and :b <Tab> will get you a long way.
And if you don't like those built-in methods, you can create your own cool mappings or choose from many plugins.
"Semantic" navigation
I like to think about my project in class/method names rather than in file names. With an up-to-date tags file (generated with ctags or some compatible program), :tag foo is a very efficient way to move around, <C-]> jumps to the definition of the tag under the cursor and <C-w>} opens that definition in a small preview window. That's more than enough for my needs.
I don't particularly like them but you can also use TagBar or TagList to have something that resembles the class browser of your IDE.
I'd suggest you make your needs more clear and ask more specific questions or look around on SO. The subjects above are pretty well covered.
Just a few pointers: I like NERDTree and CtrlP for easy/powerful file navigation and splits for keeping several files visable and navigatable at the same time.
I was using TextMate now I am using MacVim, the only thing I miss from TextMate is the "Find in Project" functionality, is there any Vim plugin providing this functionality?
I think EasyGrep might do most of what you are looking for. It does a extension sensitive search of the current directory on down.
I use it a lot for finding things in projects.
I think Project.vim lets you search in its "project" but I never really liked the idea of having several files from different parts of my filesystem magically grouped in a virtual project.
If — like me — all the files of your project happen to be in the same "real" folder Ack.vim and EasyGrep.vim both work very well.
LustyExplorer is also very good for searching in buffers.
I've been using ack.vim to do this.
You may need to install ack beforehand unless you already have it installed. There are installation instructions on the vim-scripts page, but here's what I did (I don't use macports):
curl http://betterthangrep.com/ack-standalone > /tmp/ack
sudo mv /tmp/ack /usr/local/bin/ack
sudo chmod 0755 /usr/local/bin/ack
Which I have in a setup file for my vim configs here.
I have not used TextMate, but going through their manual, I believe one of these plugins is what you're looking for
NERD tree
Fuzzy finder
Lusty explorer
I personally use NERD tree and Fuzzy finder and they're both phenomenal! Do give them a try.
You could try Waldo.
If you like fuzzyfinder.vim you might want to have a look at Command-T as well.
The Command-T plug-in provides an
extremely fast, intuitive mechanism
for opening files and buffers with a
minimal number of keystrokes. It's
named "Command-T" because it is
inspired by the "Go to File" window
bound to Command-T in TextMate.
Here you can view some screencasts with demos of the plugin.
I've looked at a number of the IDE style file explorer / management plugins for VIM. The most popular one seems to be Project, but I've never got on well with it. Specifically, having to always create a .project file for the files you want to browse, and that changes to that file hierarchy outside of VIM are not picked up.
I stumbled across the VTreeExplorer plugin and I really like the way it works. I'm trying to work out how I can make it work in a more IDE style way, for instance, to always open vertically down the full length of my window, and once I've opened a file from it, it automatically hides the VTreeExplorer buffer again? Also, ideally it wouldn't show up when I use :bn or a buffer explorer to tab through each file buffer.
Any recommendations would be appreciated. Thanks!
What about NERDTree? It is really good, one of the best file tree plugin for vim available.
I have spent lot of time doing research on VIM. I am Windows guy since last 6 yrs and was using VS.
Now started working on Linux. I want to make VIM as close as possible to VS.
I want features like
Project Navigation
Files in Different Tabs
Search in Project
AutoCompletion
I have found plugins for the above requirements
Project Pligin
MiniExplore
Taglist
OmniComplete
I am not able to correctly set vimrc script.
When I try to open file from Project it gets open in different tabs.I want to get it open in different buffers.
Also when I want to close file in buffer , complete window gets closed.
Open taglist and project window makes all mess.
Has any one done settings with these plugin..
Could you guys please post your vimrc files??
It will save lot of time for newbies like me..
Vim is a very different tool than Visual Studio. Plugins may help you get certain bits of functionality you desire, but do not expect them to work exactly like VS, work well together, or even work at all.
If you are looking for a programming environment more like Visual Studio, there are many good graphical IDE's you can use such as NetBeans, Eclipse, Code::Blocks, KDevelop, Anjuta, etc. Some of these tools are, IMHO, better heavyweight IDE's than Visual Studio, and all are available on Linux for free.
You should either learn to use Vim the way it was built to be used, or find a different tool that suits you better. Shoehorning Vim into a surrogate for Visual Studio will probably cause you more pain than it's worth.
Yes it's different to VS, but that doesn't mean it can't be used in the same way. It's just not as easy to do it :)
Personally I go the other way and use ViEmu to get VS to behave like VIM. But I'm not in the same situation as the author of this question.
Why not have a dig through some uploaded vimrc files on dotfiles.org?
You can use the following script, Trinity.
http://www.vim.org/scripts/script.php?script_id=2347
It will require 3 more scripts, and Vim will look like an IDE.
The TagList at left, a file exporer (NERDTree) at right, and Source Explorer at bottom.
Also, you can find some very useful blog entries at
http://kevin-berridge.blogspot.com/search/label/vim
The author, Kevin, explains how to compile solutions form inside Vim. He also shows interfacing and jumping between them which is very useful too.
Furhermore, there is the script vim-visual-studio which can be found at
http://code.google.com/p/vim-visual-studio/
This script is using Python extension. I have Python 2.5 installed in Windows. I am using Gvim 7.2 which is compiled with Python 2.4. So, I have replaced the executables of Gvim as explained here:
http://www.gooli.org/blog/gvim-72-with-python-2526-support-windows-binaries/
So, Gvim became compatible with Python 2.5 and raised no problems. Also, a menu entry "Visual Studio" has appeared as expected. It connects to Visual Studio itself, and it works perfectly. It does not just compiles a file, it can compile a solution containing more than one project as in Visual Studio. You can even use the Vim's 'quickfix' feature. Hope this helps.
If you really want to have vim as the front end, try Eclim. It uses Eclipse as a backend daemon for code completion and project management, and vim as the interface.
If you only like vim because of the vi key bindings, but want it to be more IDE like, you could try the latest MonoDevelop that has it built in.
These plugins used to exist long before vim had tabs. I'd be quite surprised there isn't a way to tune these plugins to split windows instead of opening tabs.
Now I can't help you much as I don't use these specific plugins but other ones. You should look at their help (:h project, :h taglist, etc)
PS: in vim terminology (it will help you browse the help files), what you call "buffer" is actually called "window", while a "buffer" is just the text you are working on, it may be associated to a file, or not. For a given buffer, there may be no or several window displaying parts of the buffer.
you can give a try to eXvim
http://code.google.com/p/exvim/