Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

vim - Let gVim always run a single instance

Is there a way to let gVim only run a single instance, so that when a new file is opened with it it's automatically opened in a new tab in the currently running instance?

I know you can do that by passing --remote-tab-silent but I want to configure gvim so that this becomes the default behavior. i.e. I want to type gvim filename and make it act as if I passed the --remote-tab-silent option to it.

gVim 7.2

Edit

I'm on windows (vista)

question from:https://stackoverflow.com/questions/936501/let-gvim-always-run-a-single-instance

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you are using the bash shell (on Linux/OS X/using Cygwin) is to add you ~/.bashrc file:

gvim () { command gvim --remote-silent "$@" || command gvim "$@"; }

On Windows I think you could have a gvim.bat batch-script to achieve the same..

gvim.exe -p --remote-tab-silent %1 %*

If gvim.exe isn't in your path

Run > Search "Environment"

Edit PATH var for current user or system.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...