Added various improvements to zsh config files, part 2
Some more zsh configuration proposed changes:
-
bindkey '^I' complete-word: remaps tab key to only suggest completion, not also expand globs. Without this, ls *<tab>, for example, would instantly expand to all files in the current directory, or $HOME would expand to /home/user. This instead would make zsh tab completion behave more like default bash. -
setopt hist_verify: whenever a command has some history expansion, it doesn't instantly run the command, but expands it before. This would be safer, as it allows users to actually see what their actual command is. Counterpoint: for expert users now !!, for example, requires pressing enter twice, but overall i think this slight inconvenience might be worth actually knowing what is going to run before executing it. -
setopt auto_cd: this allows changing directory without typing cd. Instead of 'cd ./project' now one can do './project'. This do would probably be convenient to have enabled by default, and I could not think of big enough cons to not have it. -
ZLE_REMOVE_SUFFIX_CHARS=$' \t\n;&|'andZLE_SPACE_SUFFIX_CHARS=$';&|': this forces zsh completion to add spaces after completions, instead of removing them when typing some chars, such as ;, &, |. To make an example: typing 'ls /tm<tab>` will result in ls /tmp/. Now if & or | or ; is typed instantly after, zsh will just keep those attached (aka 'ls /tmp&'), which is horrendous to read. With this change, instead, it would add a space in between and thus completing to 'ls /tmp &'. See Screencast_20260405_153419.webm
Also: I have taken the liberty to format the file a little, and move some lines around, so that logically connected configs are close to each other, making the config file easier to read.
P.S: Zsh is a good shell, but damn its defaults are atrocious!
Edited by Daniele Md