0

This question already has an answer here:

I would like to use an interactive posix bash shell but the autocompletion feature doesn't work. When i type the tab character it simply prints a tab. The tab completion only works when i'm on a non posix interactive shell or on a posix interactive shell with emacs input mode. I find emacs input mode very awkward and i am used to vi input mode. The problem only arises when i am on posix mode and vi input mode in which case the tab key only prints a tab space on my shell. Also, the same problem arises when i invoke bash with the sh command.

Here is my /etc/inputrc :

# do not bell on tab-completion
set bell-style audible

set meta-flag on
set input-meta on
set convert-meta off
set output-meta on

# Completed names which are symbolic links to
# directories have a slash appended.
set mark-symlinked-directories on

set editing-mode vi
set keymap vi-insert
set mark-modified-lines on

$if mode=emacs

# for linux console and RH/Debian xterm
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# commented out keymappings for pgup/pgdown to reach begin/end of history
#"\e[5~": beginning-of-history
#"\e[6~": end-of-history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word

# for rxvt
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word

# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
"\eOH": beginning-of-line
"\eOF": end-of-line

# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
$endif

marked as duplicate by terdon, Braiam, Gilles bash May 27 '14 at 15:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from stackoverflow.com May 27 '14 at 15:34

This question came from our site for professional and enthusiast programmers.

  • Please don't cross-post the same question on multiple stack exchange sites. This can result in situations like this one where your (identical) question was migrated from Stack Overflow to us and now appears twice here. – terdon May 27 '14 at 15:48
0

You'll need to explicitly enable tab completion for vi mode with

"\C-i": complete

in .inputrc. Note there is also an (undocumented?) vi-complete command that might be more suitable for vi mode.

  • Thanks a lot, I tried ' "\C-i": complete' and it works fine! – neoprout May 27 '14 at 18:58

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