posix 모드에서 bash 완료

posix 모드에서 bash 완료

대화형 posix bash 쉘을 사용하고 싶지만 자동 완성이 작동하지 않습니다. 탭 문자를 입력하면 탭 문자만 인쇄됩니다. 탭 완성은 posix가 아닌 대화형 셸이나 emacs 입력 모드가 있는 posix 대화형 셸을 사용하는 경우에만 작동합니다. emacs 입력모드가 많이 어색한 느낌이고, vi 입력모드도 익숙해서요. 문제는 posix 모드와 vi 입력 모드에 있을 때만 발생합니다. 이 경우 탭 키는 쉘에 탭 공백만 인쇄합니다. 또한 sh 명령을 사용하여 bash를 호출할 때도 동일한 문제가 발생합니다.

이것은 내 /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

답변1

vi패턴에 대해 탭 완성을 명시적으로 활성화해야 합니다.

"\C-i": complete

존재하다 .inputrc. vi-complete패턴에 더 잘 맞는 (문서화되지 않은) 명령도 있다는 점에 유의하세요 vi.

관련 정보