Editing How to open files in specific Vim instance
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 11: | Line 11: | ||
Say you have a mapping to open file in Vim which looks like this: | Say you have a mapping to open file in Vim which looks like this: | ||
− | < | + | <source lang="vim"> |
nnoremap o :!gvim --remote-tab-silent %f &<cr> | nnoremap o :!gvim --remote-tab-silent %f &<cr> | ||
− | </ | + | </source> |
Same should be applicable to <code>'vicmd'</code>/<code>'vixcmd'</code> options. | Same should be applicable to <code>'vicmd'</code>/<code>'vixcmd'</code> options. | ||
Line 25: | Line 25: | ||
Vim invocation command: | Vim invocation command: | ||
− | < | + | <source lang="vim"> |
nnoremap o :!gvim $VIMARGS --remote-tab-silent %f &<cr> | nnoremap o :!gvim $VIMARGS --remote-tab-silent %f &<cr> | ||
− | </ | + | </source> |
Here <code>$VIMARGS</code> can include anything and we want to put | Here <code>$VIMARGS</code> can include anything and we want to put | ||
Line 41: | Line 41: | ||
Setting environment variable looks like this: | Setting environment variable looks like this: | ||
− | < | + | <source lang="vim"> |
− | let $ | + | let $VIMARG='--servername work' |
− | </ | + | </source> |
==== Command to pick target ==== | ==== Command to pick target ==== | ||
− | Having to type something like <code>let $ | + | Having to type something like <code>let $VIMARG='--servername project'</code> |
each time one wants to change target instance is not very good idea. It's | each time one wants to change target instance is not very good idea. It's | ||
better to add a command which would set target. Here it is: | better to add a command which would set target. Here it is: | ||
− | < | + | <source lang="vim"> |
command! target :let $VIMARGS = '--servername "%a"' | command! target :let $VIMARGS = '--servername "%a"' | ||
− | </ | + | </source> |
That's it, now simply running <code>:target project1</code> will cause all files | That's it, now simply running <code>:target project1</code> will cause all files | ||
to be sent to <code>project1</code> instance and after | to be sent to <code>project1</code> instance and after | ||
<code>:target project2</code> all files will be sent to <code>project2</code>. | <code>:target project2</code> all files will be sent to <code>project2</code>. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:HOWTO]] | [[Category:HOWTO]] |