0

Original Question

When cding into a folder through a link, auto-completes does not add the last / unless I hit tab twice. How to change that behavior?


MWE:

cd /tmp/ && mkdir test && cd test && mkdir folder && ln -s folder link

Then do cd lin and TAB: it auto-completes to link and not to link/ (but hitting TAB one more time auto-completes to link/).


Clarification

  • I want auto-completion to add the / before I want to move into another folder inside that folder.
  • When cding into a folder that is not a link, the / is automatically added.
  • There are no files with the same name as the link in that folder.
  • Everything takes place in Konsole, which runs /bin/bash.
Clément
  • 288
  • 1
  • 7
  • 20
  • Why? To cd into a folder, the trailing slash is just noise. It's used to separate names of directories, and if no name follows, there is no reason to separate the first name from anything, i.e. `cd /tmp` already does the job. – user unknown May 09 '23 at 02:18
  • Because, ultimately, I want to navigate to `link/test2/`. – Clément May 09 '23 at 02:25
  • Is Konsole performing autocompletion of your keystrokes, or a shell? – Sotto Voce May 09 '23 at 02:40
  • All of this takes place in Konsole. – Clément May 09 '23 at 03:16
  • It takes place in Konsole, but the tab-completion is performed by the shell. Which shell are you using, `zsh`? `bash`? Something else? – Philippos May 09 '23 at 05:37
  • @Philippos Sorry, `/bin/bash`. – Clément May 09 '23 at 13:33
  • Side note (because of "Konsole auto-completion" in the title): Konsole is a terminal emulator, Bash is a shell. Auto-completion is a feature of the latter. Your Bash in xterm would auto-complete in the same way. See [*What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?*](https://unix.stackexchange.com/q/4126/108618) – Kamil Maciorowski May 10 '23 at 07:49

1 Answers1

0

I followed the answered shared on that post, and:

  1. Created ~/.inputrc and added to it:
set mark-directories on
set mark-symlinked-directories on
  1. Added export INPUTRC=~/.inputrc to my ~/.bashrc
  2. Restarted konsole.

And now it works :-)

Clément
  • 288
  • 1
  • 7
  • 20