(this should be merged with tip 1440) |
(Change to TipImported template + severe manual clean) |
||
Line 1: | Line 1: | ||
{{Duplicate|1440}} |
{{Duplicate|1440}} |
||
{{review}} |
{{review}} |
||
+ | {{TipImported |
||
− | {{Tip |
||
|id=1003 |
|id=1003 |
||
+ | |previous=1002 |
||
− | |title=Open files with existing Gvim window in Windows |
||
+ | |next=1004 |
||
− | |created=September 25, 2005 |
+ | |created=September 25, 2005 |
|complexity=basic |
|complexity=basic |
||
+ | |author=Anon |
||
− | |author=Associate files with Gvim in Windows |
||
|version=5.7 |
|version=5.7 |
||
|rating=42/23 |
|rating=42/23 |
||
⚫ | |||
− | |text= |
||
+ | You can enter the following at Windows command prompt to associate php files with gvim (change the command to suit your system): |
||
− | For example, type in console / cmd.exe (winnt <=) |
||
⚫ | |||
⚫ | |||
+ | <pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | </pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | == |
+ | ==Comments== |
− | I |
+ | I prefer the context menu that the Gvim installer gives you in a Windows install. |
− | * |
+ | *Edit with Vim |
− | * |
+ | *Edit with Existing Vim - <file name> |
− | will appear when you right-click on a file in Explorer. |
+ | will appear when you right-click on a file in Explorer. |
− | In fact if you have more than one |
+ | In fact if you have more than one gvim window open, all of them will appear in the context menu and so you can choose which existing gvim session to open your file within. |
− | Craig Emery |
||
− | , September 26, 2005 1:10 |
||
---- |
---- |
||
− | This also works with Gnome |
+ | This also works with Gnome and KDE. And on Mac it's the standard way to open files in Vim. |
− | It's smart to open files "inside" one instance of VIM. All your actions are saved (like yanking, pasting or searching) - and you really don't have to keep the track on the windows (by using mouse or alt+tab). Using a plugin like minibufexpl you can keep track of the buffers open.Another gain is to use multiply desktops - for instance, I have Nautilus on one and VIM on another. |
+ | It's smart to open files "inside" one instance of VIM. All your actions are saved (like yanking, pasting or searching) - and you really don't have to keep the track on the windows (by using mouse or alt+tab). Using a plugin like minibufexpl you can keep track of the buffers open.Another gain is to use multiply desktops - for instance, I have Nautilus on one and VIM on another. |
Check out: {{script|id=159|text=minibufexpl}} |
Check out: {{script|id=159|text=minibufexpl}} |
||
− | amix at amix.dk |
||
− | , September 26, 2005 1:10 |
||
---- |
---- |
||
⚫ | |||
− | Thank you for that helpful tip. |
||
⚫ | |||
− | |||
− | info--AT--cvjb.de |
||
− | , September 30, 2005 3:58 |
||
---- |
---- |
||
− | Associating files with |
+ | Associating files with gvim --remote-silent works pretty well for me, except in the following scenario: |
− | # |
+ | #There is a gvim instance already running. |
− | # |
+ | #I select multiple files in Explorer and hit Enter. |
− | Some of the files that were selected will not be opened, they simply get "lost". It seems to work every time if I just select a single file. |
+ | Some of the files that were selected will not be opened, they simply get "lost". It seems to work every time if I just select a single file. I figure it must be some sort of timing issue in the gvim server. |
− | Has anyone else experienced this and found a workaround? |
||
− | |||
− | |||
− | |||
− | markcpa-at-pacbell-dot-net |
||
− | , September 30, 2005 11:17 |
||
---- |
---- |
||
− | + | I tried your scenario, and all selected files opened in the already running instance of gvim. |
|
− | info--AT--cvjb.de |
||
− | , October 5, 2005 1:30 |
||
---- |
---- |
||
− | didn't work for me using cmd |
||
− | |||
− | so I tried it from folder options->filetypes instead. I had to restore the changes I made in the shell before entering the advanced dialog. (the restore button changes to the advanced button after you do this) |
||
− | |||
− | then: |
||
− | |||
− | &Same Vim Window |
||
− | "C:\Program Files\Vim\Vim63\gvim.exe" --remote "%1" |
||
− | (forget the dde fields, they get filled in automatically) |
||
− | |||
− | and set as default |
||
− | |||
− | if you were doing a log of files it would probably take less time than using cmd since u can use ctrl-v! |
||
− | |||
− | |||
− | '''Anonymous''' |
||
− | , October 15, 2005 4:02 |
||
− | ---- |
||
− | <!-- parsed by vimtips.py in 0.586361 seconds--> |
||
− | |||
− | |||
[[Category:Windows]] |
[[Category:Windows]] |
Revision as of 03:32, 16 December 2007
Duplicate tip
This tip is very similar to the following:
These tips need to be merged – see the merge guidelines.
created September 25, 2005 · complexity basic · author Anon · version 5.7
You can enter the following at Windows command prompt to associate php files with gvim (change the command to suit your system):
assoc .php=PHPFile ftype PHPFile="C:\Program Files\Vim\Vim63\gvim.exe" --remote "%1"
Then whenever you double click a .php file in Explorer, it will be opened in existing gvim window (or it will open new gvim window if there is no already opened gvim window).
Notes
- assoc is the command to associate an extension with a filetype in the registry.
- ftype is the command to set the action (program) that will be executed for a specific filetype.
Comments
I prefer the context menu that the Gvim installer gives you in a Windows install.
- Edit with Vim
- Edit with Existing Vim - <file name>
will appear when you right-click on a file in Explorer.
In fact if you have more than one gvim window open, all of them will appear in the context menu and so you can choose which existing gvim session to open your file within.
This also works with Gnome and KDE. And on Mac it's the standard way to open files in Vim.
It's smart to open files "inside" one instance of VIM. All your actions are saved (like yanking, pasting or searching) - and you really don't have to keep the track on the windows (by using mouse or alt+tab). Using a plugin like minibufexpl you can keep track of the buffers open.Another gain is to use multiply desktops - for instance, I have Nautilus on one and VIM on another.
Check out: minibufexpl
Maybe it is better to use --remote-silent instead of --remote. So you will not get a warning dialog, when opening a file, and no gvim is already running.
Associating files with gvim --remote-silent works pretty well for me, except in the following scenario:
- There is a gvim instance already running.
- I select multiple files in Explorer and hit Enter.
Some of the files that were selected will not be opened, they simply get "lost". It seems to work every time if I just select a single file. I figure it must be some sort of timing issue in the gvim server.
I tried your scenario, and all selected files opened in the already running instance of gvim.