Page 1 of 2

Change "TAB" behaviour only when the command line is not empty

Posted: Tue 16 Feb, 2016 14:59
by mrfyx
Hi, I want to change "TAB" behavior in the bottom prompt.
I am used to "TAB" in command line for the auto-completion. I want the same behavoir in Far manager.

I can remap the "TAB" key to "Down" but I just want to apply this macro when the command line is not empty.

Is it possible ?

Change "TAB" behaviour only when the command line is not empty

Posted: Tue 16 Feb, 2016 15:24
by Shmuel
mrfyx wrote: but I just want to apply this macro when the command line is not empty
Specify flags="NotEmptyCommandLine"; in your macro definition.

Change "TAB" behaviour only when the command line is not empty

Posted: Wed 17 Feb, 2016 09:21
by mrfyx
I try but it does'nt work.

Code: Select all

Macro {
  description="auto-complete in command line";
  area="Shell"; key="Tab";
  flags="NoSendKeysToPlugins NotEmptyCommandLine";
  code="Keys(\"Down\")";
}
When i push "tab", i lose the focus in the prompt, and the cursor goes down in the active panel :(

Change "TAB" behaviour only when the command line is not empty

Posted: Wed 17 Feb, 2016 09:48
by 2useven10

Code: Select all

Macro {
  description="auto-complete in command line";
  area="Shell"; key="Tab";
  flags="NoSendKeysToPlugins NotEmptyCommandLine";
  action = function()
    Keys("CtrlSpace")
  end;
}

Change "TAB" behaviour only when the command line is not empty

Posted: Wed 17 Feb, 2016 10:29
by mrfyx
Thanks, but it doesn't work either.

I don't lose the focus but the cursor doesn't go down on each possible choice.

Change "TAB" behaviour only when the command line is not empty

Posted: Wed 17 Feb, 2016 11:55
by 2useven10

Code: Select all

Macro {
  description="auto-complete in command line";
  area="ShellAutoCompletion"; key="Tab";
  flags="NoSendKeysToPlugins NotEmptyCommandLine";
  action = function()
    Keys("Down")
  end;
}
And probably NotEmptyCommandLine is not required.
Updated: area fixed.

Change "TAB" behaviour only when the command line is not empty

Posted: Wed 17 Feb, 2016 12:06
by Shmuel
2useven10, I did not try the macro but the area is spelled incorrectly (should be ShellAutoCompletion).

Change "TAB" behaviour only when the command line is not empty

Posted: Wed 17 Feb, 2016 12:24
by 2useven10
Shmuel
Sure ShellAutoCompletion

Change "TAB" behaviour only when the command line is not empty

Posted: Wed 17 Feb, 2016 14:31
by mrfyx
Thank you for your help however it doesn't work :'(
Even if I saw the history/autocompletion screen when I press "Tab" It change the actif panel.
I try to put back CtrlSpace but I obtain the same result.

Change "TAB" behaviour only when the command line is not empty

Posted: Wed 17 Feb, 2016 15:11
by 2useven10
Did you correct area="ShellAutoCompletion" ?

Change "TAB" behaviour only when the command line is not empty

Posted: Wed 17 Feb, 2016 15:54
by 2useven10

Code: Select all

Macro {
  description="auto-complete start"; area="Shell"; key="Tab"; flags="NoSendKeysToPlugins NotEmptyCommandLine";
  action = function() Keys("CtrlSpace") end;
}
Macro { 
  description="auto-complete navigation"; area="ShellAutoCompletion"; key="Tab"; flags="NoSendKeysToPlugins";
  action = function() Keys("Down") end;
}

Change "TAB" behaviour only when the command line is not empty

Posted: Wed 17 Feb, 2016 21:30
by sToLp
And then surely we need one more macro:

Code: Select all

Macro {
  description="auto-complete navigation"; area="ShellAutoCompletion"; key="ShiftTab"; flags="NoSendKeysToPlugins";
  action = function() Keys("Up") end;
}

Change "TAB" behaviour only when the command line is not empty

Posted: Thu 18 Feb, 2016 08:58
by mrfyx
The macro doesn't work. Tab do nothing.

Change "TAB" behaviour only when the command line is not empty

Posted: Thu 18 Feb, 2016 10:28
by 2useven10
The macro works fine for me.
It should be your environment specific.
Can you test it in clean environment?
1) Extract far archive (x64 or x86, last nightly or stable) to separate direcory (C:\Test_Far\ for example).
2) Rename C:\Test_Far\far.exe.example.ini to C:\Test_Far\far.exe.ini
3) Uncomment and correct line:
UseSystemProfiles=0
4) Write my macro content to C:\Test_Far\Profile\Macros\scripts\TabAutoComplete.lua
5) Run C:\Test_Far\Far.exe

PS: Tab does nothing when entered commandline text can't be auto-completed.

Change "TAB" behaviour only when the command line is not empty

Posted: Thu 18 Feb, 2016 15:19
by mrfyx
Sorry, It doesn't work for me because I copy the script in ...\Far Manager\Profile\Macros\internal with my other scripts.
When I change the directory to ..\Far Manager\Profile\Macros\scripts, it works. Thank you and sorry again.