This is always the first Visual Studio extension I install - could not imagine working in Visual Studio without it. VsVim is rock-solid and simply allows me to edit code more quickly.
For the uninitiated (or the Vi-traumatized):
1) It does not take comprehensive knowledge of Vi(m) commands to be much more productive with this extension (or Vi(m) generally). Basic Vi commands (http://www.cs.colostate.edu/helpdocs/vi.html) pack a lot of punch. 2) Yes, I am quite familiar with comparable Windows keyboard shortcuts for many things I do Vi-style using VsVim - and find myself seamlessly interleaving them with Vi(m) commands; TMTOWDI; but Vi is everywhere (including Visual Studio thanks to this awesome extension) and reduces reaches for my mouse and contortion on my keyboard more than anything else I have tried over 20+ years of nerdery.
Sure, maybe I am using the wrong name for the feature (its really just renaming, not refactoring). In VS, if you highlight (select) a variable name, on the declaration, and type over it with a new name, an icon appears that you can click on to open a menu that says "Rename <old name> to <new name>". Then if you click that, VS updates all of the references to this variable to the new name.
Also, you mentioned C#, which I haven't tried this in. I noticed this in VB, which is what most of the code I am working with is written in. This is not resharper or a similar plugin, as I do not have these for VS 2013 (still vanilla on that).
I don't have to do the renames that often, so I can work around for now by temporarily disabling the plugin and re-enabling when done, with VS restarts. I wouldn't do this for small local variables, but for properties, etc. of classes that are referenced multiple places, this might still be the quickest way, as a workaround.
Great plugin! Use it every day.
I was looking for a fast way to navigate between C# method declarations, and found the Vim commands ]m and [m. They don't seem to be in VsVim. or am I missing something?
This works as expected in gVim:
au FocusLost,TabLeave * call feedkeys("\<C-\>\<C-n>")
After I added it to my _vsvimrc (in my 'home' folder, C:\Users\hxchba), it seemed to have no effect.
Is there a 'VsVim' way to get the desired functionality?
Thanks for providing us with VsVim and making VisualStudio much more useful...
i'm facing the same thing as this guy: http://stackoverflow.com/questions/3718026/vim-indent-current-blank-line-and-insert
but none of the 'standard'-vim solutions seem to work for vsvim...
am i really stuck spamming C-t in insert-mode?
I'm actually baffled at why the accepted answer works. When I try that on gVim it doesn't indent the value but instead stays at column 0. Is there a particular setting I need to get `S` to indent to the column of the line above?
it surely works here..:
* freebsd 10.0
* vim & gvim
~ fire up (g)vim
~ write this (whereas _ denotes cursor):
~ press ESC and then S - you end up with:
Minor feature request.
When you use visual studio's "Go To Line" dialog (double-click on the line number label in the status bar at the bottom), it will expand folded code if the target line is contained there, then position the caret on the appropriate line.
VsVim does not do this and seems to stop on the outermost fold containing the target line (e.g. if a fold covers lines 5 to 100 and you do ':20<CR>' to go to line 20, the caret will go to the beginning of the fold at line 5 and stay there). If the fold has been expanded, it will jump to the target line as desired.
Thanks in advance,
I see! I have never tried using folds in gVim (I edit mainly plain text files there and they are short).
So what do you usually do when there's a clash between what VS does and what gVim does? In this case I hope the VS behaviour wins (or perhaps a setting could be provided to allow people to choose)!
Whenever the action involves cursor movement or placement I take gVim over Visual Studio. The reason being that most vim guys intuitively know where a given key stroke will take them. Doing actions like expanding the outlining would break say a jump followed by a yank. I get lots of negative feedback whenever I break cursor movement even, and sometimes especially, when it is subtle.
In general though it's not a problem because gVim has a setting that toggles between the behavior. I can just implement that and hence give people a work around. I'm trying to determine if there is such a setting here that I can just implement
Could you add an option or disable VSvim while in report designer from reporting services, also in design mode of webpages would be good sometimes to have ctrl-v because "p" does not work in there :)
keep up the great work, this extension rocks.
Hello thank you for the reply, it's included in the SQL data tools http://msdn.microsoft.com/en-us/data/tools.aspx
this is the type of project http://i.technet.microsoft.com/dynimg/IC574428.gif
anyway for now I just remap the orignal ctrl-v so I can paste stuff in designer mode of aspx design view, for the report editor I have to disable plugin due to key stroke strange behavior
it should be possible to make this work by mapping Tab to Down in insert mode (small bug that needs to be fixed though). But this would mean that every occurence of Tab would move the key down. Is that the feature you are looking for?
This sounds like it would move the cursor down when typing, sadly I use tab to indent into lines. Ahwell was a nice thought.
I do however have another question. I created a _vsvimrc file in my home directory to remap hjkl keys to jkl; using the nnoremap command for each key. Everything works nicely appart from now ; moves the cursor two character to the right instead of one. Is this a bug or can I specify how many characters are moved on the keypress?
Sorry for the long question
No problem on the long question. Can you post your _vsvimrc somewhere that I can take a look at it? Also do you have any other extensions installed? It's possible one of them is interferring here and causing the double behavior.
I have extensions for git, sql server and a comment spell checker but the problem still occurs with these disabled. Here is a dropbox link to the _vsvimrc file
Sorry for the delay, I just debugged into it today and figured out what is going wrong. The issue is that there is a single space after the 'l' character on the 'nnoremap ; l ' line. This means that when you hit ';' it runs the key sequence 'l<Space>' which causes the cursor to generally speaking go right twice.
This is strangely enough the behavior that gVim displays. It considers any trailing white space on the line to be part of the mapping
Here is an issue that has confused me for a long while now.
If you have text "ABCDE" then use the mouse in normal mode to highlight the letters, going backwards from E to A is inclusive - the highlight will select all the way up to and including letter A where the block cursor will be blinking.
If you do the same going forward from A to E, it only highlights to letter D, and the block cursor blinks over E which is not included in the highlight. To get E included you have to extend the highlight one character beyond such that the block cursor rests to the right of E when done.
Performing the highlight using the motion commands seems to work inclusively in all directions - the character beneath the block cursor is always included in the selection. Can this be behaviour be used when using the mouse too?
PS: I have virtualedit set to "onemore" in my _vsvimrc file - dunno if this makes a difference!
It looks like this is just a bug in the highlight code. I tried some samples in VsVim and gVim and it looks like I'm doing reverse selection incorrectly in some cases. I will look into getting this fixed
Is there any way for me to install a previous version of your wonderful plugin? This recent version freezes Visual Studio 2012 when I open a file (I have no other active plugins). Please help! I am addicted to VsVim and am suffering withdrawals.
I'm sorry you're having problems. Previous versions of VsVim are available here
Manually uninstall the current version, down load the previous version, double click on it and it will install.
If you have a few minutes though I'd really like to figure out what is going wrong here. Otherwise the bug will persist into future versions :(
The most likely cause is either a line in the _vimrc which is putting me into an infinite loop. Could you post your _vimrc somewhere that I could take a look at?
Hi Jared, happy new year in advance!
I am using VS2012 and VsVim 188.8.131.52 and was surprised to find that when the Quick Find window is active in the editor (do Ctrl+F and it pops-up on the top right), the normal mode commands are completely ignored (e.g. pressing 'gg' to jump to the beginning of the editor is ignored and the letters appear literally). When you press Esc to dismiss the Quick Find window, the normal mode commands work again.
Is this by design or is the Quick Find window somehow responsible?
Happy new year to u as well!
That behavior is by design. In general VsVim will defer to VS UI when it is being displayed (intellisense, quick find, smart tags, etc ...). Once it's dismissed VsVim will take over again
That makes sense, especially for intellisense and smart tag popups which are on the screen for few seconds.
There's often a strong urge to navigate using VsVim commands when Quick Find is active so if VsVim could defer only the keys that are required by the active popup (in the same way you can tell it to let VS handle some common shortcuts), that would be pretty neat.
Many thanks for your continued work on this awesome extension!
PS: does the 'ge' command work? In classic Vim, it jumps to the last letter of the previous word and I can't seem to make it work in VsVim :(
Unfortunately it's hard to tell what is or isn't accepted by the pop up. Every version of VS adds more short cuts and it would be a constant battle to keep up with them. Especially since some shortcuts actually change based on the current input language of VS. I worry it would be hard to do this without the implementation being flaky.
As for 'ge' this isn't implemented yet but I will look at getting that done. Should be fairly easy
I have often marvelled at how completely alien VS feels when you change the language (I code in VB2012) so I can see the nightmare of trying to track each shortcut. I am no expert on the internals of VS editor keyboard handling, but if it has something akin to the KeyEventArgs.Handled property, perhaps you could use that to detect cases when keystrokes such as 'gg' are not handled by the pop-up, then handle them with VsVim logic.
I look forward to the 'ge' command along with its sisters 'g;' and 'g,' which are used to jump around the change list (the g-semicolon one is handy for example when you paste something in normal mode then want to jump the cursor back to where the paste began so you can add a space to separate the pasted text from the text that precedes it).
Thanks as always!