Is there a nice subversion plugin for Vim?
I have been using IDEs like NetBeans for quite sometime. NetBeans has a good versioning control plugin. When I have multiple projects and work on them simutanou开发者_如何学Pythonsly, I can choose specific projects to commit by hightlighing them and leave others out. Also the commit box allows me to easily take out unwanted files for commit. I failed to find equivalent plugins for Vim.
I have used Nerdtree; while it is good for project navigating, it doesn't show me which folder/files has been modified. In Netbeans it shows a blue/green icon next to the affected tree path.
There are other features I like in GUI but I am not going to list them all here.
I really want to switch to Vim, but this is stopping me. Could anyone please suggest a similar plugin for Vim?
UPDATE: since this was raised 3 years ago, I have stopped using subversion a while back and started using GIT, the plugins that I am using with vim has Git Support (Fugitive)
Just use the appropriate shell commands (svn commit, svn update, etc). It wouldn't really make sense to have an SVN plugin for vim. You can even run shell commands from within vim. For example:
:! svn update
Although I'm not sure that that would pose any significant advantage in the case of SVN.
If I want to "cheat" and see the graphical directory structure, sometimes I'll open up Subclipse in Eclipse - but there is absolutely no real need for that.
To get started with vim, just open up a terminal on a machine with vim installed and execute:
vimtutor
You'll be up and running in no time.
There are a few vim plugins for subversion, although it's true that none of them give you the full IDE-like integration that you'd like. A lot more can be done with git since it's inherently more flexible, and, if you're curious, fugutive is a very nice plugin for that: http://vimcasts.org/blog/2011/05/the-fugitive-series/
But, to the point. Here are a few plugins that might help with your specific request and a few more in general:
- Sandbox: http://www.vim.org/scripts/script.php?script_id=2468. It doesn't quite do what you asked for, but you could use it for the same purpose. Whenever you want to see the status of the repo and selectively commit files, you could execute the
Sandbox
command and follow the instructions. The script does say "Linux only", though. You didn't mention what OS you're using, so if you're on Windows, I don't know if it'll work properly. - VCSCommand: http://www.vim.org/scripts/script.php?script_id=90. This one gives you diffs, logs on a specific file, blame, revert and a few other things. The interface consists of commands or mappings.
- svn_commit: http://www.vim.org/scripts/script.php?script_id=1451. A very small script that "remembers" the last commit message, so if you cancel committing to add/remove files, you don't have to type it again.
Again, you're probably not going to get the integration you'd like. Vim is very flexible, but some IDE features are difficult to get working in it. I can see a possible solution, but it'd require a while to write and test properly. I'm sorry about it, but you're going to have to either adapt to using the command-line client, like @mattkelly suggests, or consider using an external program to deal with committing, following the advice of @romainl.
I recommend VCSCommand. It has convenient mappings out of the box, and it works with svn, git and hg. However, it doesn't really have a "GUI" per se; I don't think you will find many vim-oriented resources that do.
First off, I totally support @matkelly's answer: You don't need any plugin for using SVN from within VIM.
As an avid vim user I would like to give some pointers on using vim as an IDE along with subversion integration.I have few snapshots I just took of my vim screen so you have a visual.
I come from an eclipse background. Though now I mostly code on VIM on my Fedora workstation. I still use eclipse for certain tasks which its good at, such as Mylyn/Tasktop integration (through Planning Perspective) which integrates with subversion and bugzilla to help me write task-specific commit messages.
In VIM, to interact with SVN painlessly (and general shell tasks for that matter) you need to know few shortcuts:
I get the logs for the file I'm currently working on with:
:!svn log -l3 %
'%' is a special shortcut which gets replaced with the current file path.Above command lists the last 3 log message for this current file.
Guess what this command does?
:!svn diff %
'%:h' gives you the directory currently file is in:
:!svn status %:h
While I'm on the subject, here are few pointers for new vim users who want to make a switch from a GUI-IDE to vim and have hard time navigating through thousands of project files:
I recommend the NERDTree plugin, which opens up an IDE-like directory tree and locates your current file in the tree. It's only useful to me in rare occasions (to delete, copy, move files or to set my current working directory). But if all I want were to locate a specific file from among hundreds of files in my project, I just type:
:find Inventory.pm
Cool thing is, I can type filename partially and hit [TAB], which expands the file name for me!!! If there are several matches it simply iterates through the list until I find the one I meant.
This is the first command my coding session starts with; I CD to my project root folder (since vim's 'path' setting is set to '.'), fire up VIM and type :find Filename
. No GUI IDE that I've used could pull this off this fast. Then, if I wanted to browse my project folder, I just hit F10, which maps to NERDTreeFind, and use jklm VIM commands to navigate the directory structure.
When I have several buffers (files) open in VIM, to navigate open buffers easily I use "Buffer Explorer".
When I'm typing a method or some keyword in VIM i type "CTRL-N", which opens up tag list (I have exuberant ctags setup through cron).
"Tag List" plugin is also a must, which opens up list of functions/methods in the current buffer, locates the method you're currently on, and focuses on it.
You can have a try the plugin from GitHub, https://github.com/juneedahamed/svnj.vim
For simple tasks, you should follow mattkelly's advice:
:!svn co path/to/repo .
:!svn add .
:!svn commit -m 'first commit'
:!svn update
However it may make more sense to leave file manipulation to tools specifically designed for that.
There are SVN file explorer plugins available for Windows, Mac OS X and Linux. They are powerful enough to handle most situations with ease.
If you have to deal with really complex situations, did you consider dedicated graphical tools like RapidSVN or SmartSVN or others?
精彩评论