zsh
Ctrl-u
source: https://unix.stackexchange.com/questions/522663/ctrl-u-deletes-whole-line-regardless-of-cursor-position
compinit
source
The first 3 lines of of simple .zshrc
is:
autoload -Uz compinit promptinit
compinit
promptinit
What it does is simply bring the functions compinit
and promptinit
into
scope and execute them. These functions will be in scope if they're under $fpath
, this will be the
case if zsh if installed properly in your system.
compinit will initialize completion for the current session when called directly, in .zshrc
.
zshrc complete
This is what I roll with for now. Might need to improve it someday after reading the docs and
figuring out what's what.
~/.zshrc |
---|
| # Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[blue]%}%n%{$fg[white]%}@%{$fg[white]%}%M %{$fg[magenta]%}%~%{$fg[white]%}%{$reset_color%} $%b "
# For some reason, this block should be preceding the block that follows it.
HISTSIZE=10000000
SAVEHIST=10000000
HISTFILE=~/.zsh_history
# setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command” format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY # Don't execute immediately upon history expansion
export HISTORY_IGNORE=""
# Bail out by prepending #, preserve history
setopt INTERACTIVECOMMENTS
# The location in this file where compinit is important
# See 20.2.1 https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Completion-System-Configuration
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
# emacs mode on shell. vi on editor.
bindkey -e
# hjkl is still the better way to navigate menu
bindkey -M menuselect 'h' backward-char
bindkey -M menuselect 'k' up-line-or-history
bindkey -M menuselect 'l' forward-char
bindkey -M menuselect 'j' down-line-or-history
# https://unix.stackexchange.com/questions/522663/ctrl-u-deletes-whole-line-regardless-of-cursor-position
bindkey \^U backward-kill-line
# Source file generated by fzf --zsh
if [[ -e $HOME/.fzf.zsh ]];
then
source "$HOME/.fzf.zsh"
else
if which fzf 2>&1 1>/dev/null
then
fzf --zsh > $HOME/.fzf.zsh
source "$HOME/.fzf.zsh"
else
echo 'fzf not installed'
fi
fi
export FZF_DEFAULT_OPTS="--height 50% --layout=reverse --multi --bind ctrl-a:select-all,ctrl-d:deselect-all,ctrl-t:toggle,ctrl-y:accept $1"
# source /usr/share/zsh/plugins/zsh-z/zsh-z.plugin.zsh
# Useful aliases
alias gn="cd $HOME/vectorspace.xyz/docs"
alias ls='ls --color'
# export ANDROID_HOME="$HOME/Android/Sdk"
# export PATH="$HOME/bin:$HOME/flutter/bin:$HOME/.pub-cache/bin:$HOME/.local/bin:$HOME/Android/Sdk/cmdline-tools/latest/bin:$HOME/Android/Sdk/platform-tools:$PATH"
export PATH="$HOME/bin:$HOME/.pub-cache/bin:$PATH"
export EDITOR=nvim
## [Completion]
## Completion scripts setup. Remove the following line to uninstall
[[ -f /home/vector/.dart-cli-completion/zsh-config.zsh ]] && . /home/vector/.dart-cli-completion/zsh-config.zsh || true
## [/Completion]
# nnn
export NNN_PLUG='f:finder;o:fzopen;p:preview-tui;d:diffs;t:nmount;v:imgview'
export NNN_FIFO=/tmp/nnn.fifo
export NNN_TERMINAL=kitty
export imv_config=$HOME/.config/imv/config
export CHROME_EXECUTABLE="/usr/bin/thorium-browser-avx2"
eval "$(zoxide init zsh)"
export USE_CCACHE=1
export CCACHE_EXEC=/usr/bin/ccache
# Load zsh-syntax-highlighting; should be last.
# pacman -S zsh-syntax-highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null
export ZSH_HIGHLIGHT_STYLES[comment]="fg=#808080"
|