22

In the original cmd.exe in Windows, can be used to cycle through the auto completes candidates. But in cmder, this feature seems to be removed. Is there anyway to enable it?

3
  • Why do you trying cmder instead of official ConEmu than?
    – Maximus
    Oct 25, 2015 at 10:36
  • @Maximus Just came across cmder and never tried others... Thanks!
    – dofine
    Oct 25, 2015 at 10:44
  • 2
    cmder is just a preconfigured ConEmu with some third-party software
    – Maximus
    Oct 25, 2015 at 12:06

4 Answers 4

21

As mentioned above, 'cmder' is an amalgamation of other open source software. The software which controls the tab completion behaviour is 'clink'. To change this behaviour, navigate to your 'cmder' directory and then find:

\cmder\vendor\clink\clink_inputrc_base

Open 'clink_inputrc_base', save a backup original, and then replace both lines that read:

"\t": clink-completion-shim

with:

"\t": menu-complete

for shift+tab cycle backward behaviour, also add a line below each of the above lines that reads:

"\e`Z": menu-complete-backward

This worked for me. Credit to this link for the info on modifying clink behaviour:

https://github.com/mridgers/clink/issues/190

EDIT: Please see my comment below, or additional answer from 'tides'. In newer versions of cmder the process is slightly simpler. You just have to uncomment the lines as described in the file, see my comment or other answer for more detail.

3
  • 1
    UPDATE: I just downloaded a newer version of cmder (v1.3.6) and now the file above has two lines commented, above which it says "# Uncomment these two lines for vanilla cmd.exe style completion." If you uncomment the two lines below it will achieve the same behaviour as my answer here.
    – Moustache
    Jun 22, 2018 at 14:24
  • Will it be possible to make <tab> works as: 1st <tab> -- list all possible commands, 2nd and after <tab> -- completion?
    – X.Arthur
    Apr 29, 2019 at 7:52
  • Instead of modifying clink_inputrc_base you can just place a .inputrc file to %USERPROFILE% folder that modifies "\t" and "\e`Z".
    – facetus
    May 17, 2020 at 8:08
13

Actually, in the \cmder\vendor\clink\clink_inputrc_base file there are already these lines at the end:

# Uncomment these two lines for vanilla cmd.exe style completion.
# "\t": clink-menu-completion-shim
# "\e`Z": clink-backward-menu-completion-shim

If you remove the # characters of the last two lines you will get the desired behavior.

3
  • Thanks, yes noted this in my comments on 22nd June. This wasn't present in earlier versions of cmder.
    – Moustache
    Jul 3, 2018 at 14:39
  • Anyway to exclude items that are not actually in the current working directory?
    – hellyale
    Jul 11, 2018 at 13:14
  • 1
    Still doesn't autocomplete for the git command May 16, 2019 at 17:58
2

Clink changes Tab completion behavior. So: remove clink from vendors folder, uncheck Use clink in prompt.

3
  • It works after I remove clink, though I didn't check Use clink in prompt at first place. One more problem is that now {lamb} and {git}{hg} appears. Git prompt seems to break when I cd to a git dir.
    – dofine
    Oct 25, 2015 at 10:48
  • Install official ConEmu and configure it for your taste
    – Maximus
    Oct 25, 2015 at 12:07
  • @Maximus how? can you expand
    – peval27
    Jul 5, 2019 at 8:14
0

The previous answers did not work for me. Here is how I got it to work, looking at Clink documentation and something from this post. First, instead of editing any base configuration file (which will probably be overwritten on updates anyway), create your own configuration file, which you can call .inputrc or _inputrc, in one of the following locations:

  • %CLINK_INPUTRC%
  • %USERPROFILE%
  • %LOCALAPPDATA%
  • %APPDATA%
  • %HOME%

Probably the most practical thing in most cases is to create it in your home directory (e.g. C:\Users\My Name\).

Inside that file, write the following content:

TAB: menu-complete
"\e[Z": menu-complete-backward

And that's it. It's still not exactly what I wanted, as I'd prefer it would show me the list of possible completions the first time I hit TAB and then scroll through them if I keep hitting it, but anyway.

Also, as pointed out in the Clink documentation, the settings in this .inputrc file may be used by other software that also uses readline. If you want these to only affect how Clink (and in turn ConEmu / Cmder) behave you can do something like this:

$if clink           # begin clink-only section
TAB: menu-complete
"\e[Z": menu-complete-backward
$endif              # end clink-only section

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.