FAR Manager How To

A quick note - most of this page relates to FAR Manager running on Linux using Wine - see the wine page for details.

How to open files using linux associations

Set your associations using Commands > File associations menu per file type or for * to
xdg-open "!.!"

How to disable the noisy logging of stubs and semi-stubs to .xsession-errors

Do the same that you would for any other noisy wine app, ie. start your wine application with a debug setting
env WINEDEBUG=fixme-all WINEPREFIX=.... [command]

How to pipe output from within FAR to a new session in yakuake

Get yakuake-session script and run
h:\Programs\yakuake-session\yakuake-session -h -t "Far" -e ls -- -altR

How to configure shift-enter to open Dolphin from FAR Manager

Wine 2.19 changed the way it is routing stdout of linux commands that are called from within wine. Wine sends linux command's output to linux's stdout, and lua gets nothing. You can see it by calling lua:local f=io.popen('dir') print("[") print(f:read("*a")) print("]") from the FAR command line. You need to pipe command output to a temp file. Use the following:

Macro {
  area="Shell"; key="ShiftEnter"; description="Open folder in dolphin instead of the default wine explorer"; action = function()
    if APanel.Folder then
 		-- could also do "print dolphin \".\"", "press enter" but that pollutes the command line
   		local exec = require "execute"
		n=os.tmpname()
		-- convert path but dont put in .. if that's what is under the cursor, since that means a directory above current
		os.execute("winepath \""..APanel.Path..(APanel.Current==".." and "" or "\\"..APanel.Current).."\" >".. n)
		for l in io.lines(n) do longpath=l end -- a clunky way to get the first line
		-- cannonicalize, or recursevely resolve wine's symbolic links to point to the actual linux file
		os.execute("realpath \""..longpath.."\" >".. n)
		for l in io.lines(n) do shortpath=l end
		os.remove(n)
   		win.ShellExecute(nil, "open","dolphin\" \""..shortpath.."\"") -- funky quoting is to work around CreateProcessW being called with the argument enclosed in \"
	end
  end;
}

Before wine 2.19 the following worked:

  • Get a command executor lua extension from here.
  • Unzip execute.lua to c:/users/xxx/Application Data/Far Manager/Profile/Macros/modules
  • Create the following macro in c:/users/xxx/Application Data/Far Manager/Profile/Macros/scripts/Dolphin.lua
Macro {
  area="Shell"; key="ShiftEnter"; description="Open folder in dolphin instead of the default wine explorer"; action = function()
    if APanel.Folder then
        local exec = require "execute"
        exec("winepath \""..APanel.Path..(APanel.Current==".." and "" or "\\"..APanel.Current).."\"","c:\\",function(out) sympath=out end) -- convert path but dont put in .. if that's what is under the cursor, since that means a directory above current
        exec("readlink -f \""..sympath.."\"","c:\\",function(out) shortpath=out  end)   --cannonicalize, or recursevely resolve wine's symbolic links to point to the actual linux file
        -- cant do exec('dolphin \".\"',".",function()end) because it blocks
        -- could also do "print(dolphin) key(Enter) but that pollutes the command line
        win.ShellExecute(nil, "open", "dolphin \""..shortpath.."\"")
    end
  end;
}

How to use ctrl-alt-ins to copy unix directory links instead of windows under FAR Manager

In wine 2.19 and after use the following

Macro {
  area="Shell"; key="CtrlAltIns";
  description="Convert to linux path";
  action=function()
	local exec = require "execute"
	n=os.tmpname()
	-- convert path but dont put in .. if that's what is under the cursor, since that means a directory above current
	os.execute("winepath \""..APanel.Path..(APanel.Current==".." and "" or "\\"..APanel.Current).."\" >".. n)
	for l in io.lines(n) do longpath=l end -- a clunky way to get the first line
	-- cannonicalize, or recursevely resolve wine's symbolic links to point to the actual linux file
	os.execute("realpath \""..longpath.."\" >".. n)
	for l in io.lines(n) do far.CopyToClipboard(l) end
	os.remove(n)
  end;
}

In wine before 2.19:

  • Get a command executor lua extension from here.
  • Unzip execute.lua to c:/users/xxx/Application Data/Far Manager/Profile/Macros/modules
  • Create the following macro in c:/users/xxx/Application Data/Far Manager/Profile/Macros/scripts/WinePath.lua
Macro {
  area="Shell"; key="CtrlAltIns";
  description="Convert to wine path";
  action=function()
    local exec = require "execute"
    exec("winepath \""..APanel.Path.."\\"..APanel.Current.."\"","c:\\",function(out) far.CopyToClipboard(out) end)
  end;
}

  • Reload macros by typing lm: load in the FAR command line or simply restarting FAR.

How to configure FAR editor to use Unix end of line by default

To use Linux EOL (0x0A) as the default in the editor instead of Windows' 0x0D 0x0A, get the latest ESC plugin from here or here. Edit C:\Program Files\Far Manager\Plugins\ESC\Cfg\esc_abstract.xml. Under the "Sources" sections change
     <eol value=""/>
to
     <eol value="&amp;#x0a;"/>
Do the same for the "Text" section. Also, edit C:\Program Files\Far Manager\Plugins\ESC\Cfg\esc_sources.xml. Add
   <type name="Bash" mask="*.sh,*." inherit="Sources"/>

How to create a shortcut to synchronize panels

Add this to HKEY_CURRENT_USER\Software\Far2\KeyMacros\Shell\CtrlS :

  • Sequence = Tab c d Space CtrlShift] Enter Tab
  • DisableOutput = 1
  • Description = Synch passive panel

How to run FAR under Linux

Run under wineconsole (not wine)
wineconsole --backend=user "c:/program files/far/far.exe"

How to run Linux commands from FAR Manager

To make the command line work add the bin folders to the user PATH variable. Run regedit and edit HKEY_CURRENT_USER\Environment Create or add the default Unix paths to it and blank extension to the list of executable formats. Something like this:

PATH=z:\bin;z:\usr\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.;.SH;.PL;.PY

Note the ;.; above, it's very important for running Linux commands that usually don't have an extension
Linux commands send output to the terminal window that started FAR, so to see linux stdout you need to run FAR from under a console. Next,

  • Associate your favorite viewers/editors with the file extensions
  • Or configure a generic gnome-open or run-mailcap or kde-open to run upon hitting "enter" on an unknown extension, so your window manager would make the pick
  • Configure Shift-Enter for dolphin or nautilus

How to make computer drives visible to FAR

Start winecfg, click on drives, do the autodiscover, save and start FAR.
Note that sometimes the links to the drives disappear. To fix it and make them permanent click on each of the drives in winecfg, edit something, like a label, and then click ok.

How to see copy progress in FAR

Disable use of the system copy (in the past it did not report progress back to FAR): In far type far:config and set
System.UseSystemCopy = false

You could also do it through one of the menus

How to show hidden folders and files below non-hidden ones

Modify sort groups to show hidden files and folders (starting with a dot) below the visible files and folders:

  1. F9 -> Options -> Files hightlighting and sort groups
  2. Set upper sort groups to H- D+ with no mask, then H- D- with no mask, then H+ D+ with no mask
  3. Open the sort modes dialog for the left panel, set "use sort groups" and uncheck sort directories first so that hidden directories don't show above non-hidden files. Repeat for the right panel

How to run meld from FAR under Linux

Try this
start "z:\bin\bash /home/user/bin/wine-meld.sh \"!.!\" \"!#!\!.!\""
Or this
H:\bin\wine-meld.sh "!.!" "!#!\!.!"



@HowTo @FARManager