TankorSmash
TankorSmash

Reputation: 12747

Using gVim with Visual Studio 2010; where to create visualstudioinvoke.vim?

Looking to set up gVim as an external tool for Visual Studio 2010, following: http://vim.wikia.com/wiki/Integrate_gvim_with_Visual_Studio but I ran into some trouble. I'm on Window7x64 and I'm not sure where to put the visualstudioinvoke.vim file it mentions when it says to set autoread.

I've put it in C:/Vim and C:/Vim/vimfiles but still, when I change the file in VS10 and go back to gVim, it prompts me to load or continue editing.

While I can just set autoload every time, I'd also like to customize more feature, like syntax highlighting etc, but I'd need to store it in this file, I think.

edit: Just ended up changing my _vimrc to set autoread. Hopefully this won't bit me in the ass at some point. Still looking for a better solution though.

Upvotes: 1

Views: 640

Answers (2)

xaizek
xaizek

Reputation: 5252

Following that tutorial word by word isn't necessary. You can also replace :runtime command and relative path with :source and full path to your script in command in Tools Settings of Visual Studio.

So adding to command something like

+"source c:/path/to/visualstudioinvoke.vim"

instead of

+"runtime visualstudioinvoke.vim"

should do the trick.

Note: after reading documentation it turned out that all +cmd should go before any file names for --remote-silent. From :help --remote-silent:

--remote-silent [+{cmd}] {file} ...

So be sure to place all +cmd before file name, otherwice Vim will treat them as file names.

Upvotes: 2

pb2q
pb2q

Reputation: 59607

Try putting it in %HOME%. Your _vimrc should already be here if you're using one. In the windows explorer, type %HOME%. In windows7 this should be c:\Users\username; in XP: c:\Documents and Settings\username.

In this directory create a folder named vimfiles if it doesn't already exist. Put vimfiles.vim in the top level of that directory.

Then, in gvim, edit the file with: :e $HOME\vimfiles\visualstudioinvoke.vim, and add:

set autoread

Save the file, and try it out.

Upvotes: 0

Related Questions