How do I set vim as the external editor in FarManager, and pass full path names?

6,416

Solution 1

I have found the solution that does exactly what you are asking for. But it requires the plug-in FarNet and its module PowerShellFar:

http://code.google.com/p/farnet/

They also need .NET 2.0+ and Windows PowerShell 2.0 installed. This is already the case on Windows 7 but earlier Windows versions are not so lucky. Besides, PowerShell 2.0 is only for Windows XP SP 3 and above (not even SP 2).

If you are not yet scared then here is the trick. In the external editor command we call PowerShellFar through its command line prefix ">:"

>: & vim @(Get-FarPath -Selected) #

That's it. It works, I have tried it (not with vim, though, I do not have one). It is fast, it does not start PowerShell each time; the core is loaded once when Far starts.

Note: The last '#' in the command is a little PowerShellFar convention: to not add to the persistent command history commands with '#' in the end. This command is for opening the external editor, it is written once and we do not want it to pollute the history of other commands typed manually.

P.S. I am the author of both FarNet and PowerShellFar, just in case. They are open source, mature and robust. I would recommend them in any case, as far as you use Far Manager and recent Windows has all the prerequisites for these tools.

Solution 2

The closest I can come is vim !& this creates the following command line

"C:\Program Files\Vim\vim73\vim.exe"  TalkMaterials "abba 1.txt" "abba 3.txt"

That seems to work just fine, but I'd like full paths passed to vim anyway. Before accepting my own answer, I'd like to see if there is a way to pass all the full paths to vim.

Share:
6,416

Related videos on Youtube

Justin Dearing
Author by

Justin Dearing

Updated on September 17, 2022

Comments

  • Justin Dearing
    Justin Dearing almost 2 years

    I'm trying to configure VIM as my external editor in the far file manager. I want to be able to select multiple items in a folder, some being directories, and have their full paths passed to the vim command line.

    Update: To clarify exactly what I want to do. I want to be able to select multiple files in a panel like so:

    Far Manager Screen Capture

    and have vim opened like this:

    "C:\Program Files\Vim\vim73\vim.exe"  c:\src\TalkMaterials "c:\src\abba 1.txt" "c:\src\abba 3.txt"
    

    This would open all the files in different buffers.

    • Roman Kuzmin
      Roman Kuzmin over 13 years
      At least give an example of a correct command line (what you want to get) and tell what you actually get from Far.
    • Roman Kuzmin
      Roman Kuzmin over 13 years
      Perhaps it should be re-tagged to the existing tag far-manager.
    • Roman Kuzmin
      Roman Kuzmin over 13 years
      A couple of solutions using batch files are proposed in here: forum.farmanager.com/viewtopic.php?f=36&t=5851
  • Roman Kuzmin
    Roman Kuzmin over 13 years
    Perhaps you should accept your own answer. According to the Far help there is no such a feature of "special symbols" as a list of full paths. Try to ask this question at the Far forum, I might miss something. Ask exactly about a list of full paths of several selected files.
  • Justin Dearing
    Justin Dearing over 13 years
    That is really useful. It won't work on my windows 2008 server since its not R2, but it works on all my workstations.
  • Justin Dearing
    Justin Dearing over 13 years
    I made a feature request for this in mantis bugs.farmanager.com/view.php?id=1585 and I did also ask on the forum. forum.farmanager.com/…