Search code examples
zshiterm2

How to disable table key in iTerm2


I am using zsh and iTerm2. I always use the Tab-key when i want to autocomplete the command. But if there is no command to be autocompleted, the cursor will move forward which is not what i want.

So is there a way to disable the cursor that moves forward when no command can be autocompeleted, thanks.


Solution

  • The behaviour of Tab on an empty line can be configured by the zstyle insert-tab:

    zstyle ':completion:*' insert-tab <VAL>
    

    where <VAL> can be

    • true [default]: insert TAB character
    • false: perform completion (completion list contains all commands)
    • pending or pending=val: insert TAB character IF there is unprocessed input (pasting text), otherwise perform completion

    So if you don't want it to insert a TAB, you can set it to false:

    zstyle ':completion:*' insert-tab false