mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2025-06-29 04:00:42 +00:00
POSIX compliance, shellcheck
This commit is contained in:
parent
d843e90462
commit
826cef4e6e
5 changed files with 114 additions and 96 deletions
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
# shellcheck disable=SC2030,SC2031
|
||||
# Set default keybindings (mostly from oh-my-zsh)
|
||||
|
||||
# Make sure that the terminal is in application mode when zle is active, since
|
||||
|
@ -18,30 +19,30 @@ fi
|
|||
bindkey -e
|
||||
|
||||
# Start typing + [Up-Arrow] - fuzzy find history forward
|
||||
if [[ -n "${terminfo[kcuu1]}" ]]; then
|
||||
if [ -n "${terminfo[kcuu1]}" ]; then
|
||||
autoload -U up-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||
fi
|
||||
# Start typing + [Down-Arrow] - fuzzy find history backward
|
||||
if [[ -n "${terminfo[kcud1]}" ]]; then
|
||||
if [ -n "${terminfo[kcud1]}" ]; then
|
||||
autoload -U down-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||
fi
|
||||
|
||||
# [Home] - Go to beginning of line
|
||||
[[ -n "${terminfo[khome]}" ]] && bindkey "${terminfo[khome]}" beginning-of-line || bindkey "^[[H" beginning-of-line
|
||||
([ -n "${terminfo[khome]}" ] && bindkey "${terminfo[khome]}" beginning-of-line) || bindkey "^[[H" beginning-of-line
|
||||
# [End] - Go to end of line
|
||||
[[ -n "${terminfo[kend]}" ]] && bindkey "${terminfo[kend]}" end-of-line || bindkey "^[[F" end-of-line
|
||||
([ -n "${terminfo[kend]}" ] && bindkey "${terminfo[kend]}" end-of-line) || bindkey "^[[F" end-of-line
|
||||
|
||||
# [Shift-Tab] - move through the completion menu backwards
|
||||
[[ -n "${terminfo[kcbt]}" ]] && bindkey "${terminfo[kcbt]}" reverse-menu-complete
|
||||
[ -n "${terminfo[kcbt]}" ] && bindkey "${terminfo[kcbt]}" reverse-menu-complete
|
||||
|
||||
# [Backspace] - delete backward
|
||||
bindkey '^?' backward-delete-char
|
||||
# [Delete] - delete forward
|
||||
[[ -n "${terminfo[kdch1]}" ]] && bindkey "${terminfo[kdch1]}" delete-char || bindkey "^[[3~" delete-char
|
||||
([ -n "${terminfo[kdch1]}" ] && bindkey "${terminfo[kdch1]}" delete-char) || bindkey "^[[3~" delete-char
|
||||
# [Ctrl-Delete] - delete whole forward-word
|
||||
bindkey '^[[3;5~' kill-word
|
||||
|
||||
|
@ -53,9 +54,9 @@ bindkey '^[[1;5D' backward-word
|
|||
# [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
# [PageUp] - Up a line of history
|
||||
[[ -n "${terminfo[kpp]}" ]] && bindkey "${terminfo[kpp]}" up-line-or-history
|
||||
[ -n "${terminfo[kpp]}" ] && bindkey "${terminfo[kpp]}" up-line-or-history
|
||||
# [PageDown] - Down a line of history
|
||||
[[ -n "${terminfo[knp]}" ]] && bindkey "${terminfo[knp]}" down-line-or-history
|
||||
[ -n "${terminfo[knp]}" ] && bindkey "${terminfo[knp]}" down-line-or-history
|
||||
|
||||
# [Space] - do history expansion on space
|
||||
bindkey ' ' magic-space
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue