Compare commits
4 Commits
da44e5f457
...
2c189c87e6
Author | SHA1 | Date | |
---|---|---|---|
2c189c87e6 | |||
a450b3cb45 | |||
2846e7d68e | |||
9da4d8ee71 |
@ -17,6 +17,7 @@
|
||||
src: prompt_fresh_setup
|
||||
dst: ~/.local/share/zsh/site-functions/prompt_fresh_setup
|
||||
- repo:
|
||||
- https://github.com/zsh-users/zsh-syntax-highlighting.git
|
||||
- https://github.com/zsh-users/zsh-autosuggestions.git
|
||||
- https://github.com/zsh-users/zsh-history-substring-search.git
|
||||
- https://github.com/zsh-users/zsh-syntax-highlighting.git
|
||||
- message: zsh will be the default prompt after next login
|
||||
|
38
zshrc
38
zshrc
@ -3,8 +3,12 @@
|
||||
|
||||
# Load plugin scripts
|
||||
plugin-load() { source ~/.config/zsh/$1/$1.plugin.zsh }
|
||||
plugin-load zsh-syntax-highlighting
|
||||
plugin-load zsh-autosuggestions
|
||||
plugin-load zsh-history-substring-search
|
||||
plugin-load zsh-syntax-highlighting
|
||||
|
||||
# Disable non end-of-line autosuggest accept widgets
|
||||
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(end-of-line vi-end-of-line)
|
||||
|
||||
# Remove duplicates from history
|
||||
setopt hist_ignore_all_dups
|
||||
@ -50,6 +54,10 @@ bindkey -M vicmd 'gcc' vi-pound-insert
|
||||
|
||||
# TODO: vi-pipe???
|
||||
|
||||
# Enable accepting autosuggestions
|
||||
bindkey '^O' forward-word
|
||||
bindkey '^P' autosuggest-accept
|
||||
|
||||
# Enable substring history search with 'j' and 'k'
|
||||
bindkey -M vicmd 'k' history-substring-search-up
|
||||
bindkey -M vicmd 'j' history-substring-search-down
|
||||
@ -61,26 +69,28 @@ bindkey -M vicmd 'K' run-help
|
||||
# Disable Ex mode with ':'
|
||||
bindkey -rM vicmd ':'
|
||||
|
||||
# Enable '<Shirt><Tab>' reverse order completions
|
||||
bindkey '^[[Z' reverse-menu-complete
|
||||
|
||||
# Use editor to edit command line with '<Ctrl>V'
|
||||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey -M vicmd '^V' edit-command-line
|
||||
|
||||
# Get the shells parent process name.
|
||||
ppid_name() { echo $(ps -p $(ps -p $(echo $$) -o ppid=) -o comm=) }
|
||||
|
||||
# Enable changing cursor shape based on vi mode
|
||||
if [ "$TMUX" != "" ]; then
|
||||
tmux_before="\EPtmux;\E"
|
||||
tmux_after="\E\\"
|
||||
if [ "$ITERM_PROFILE" != "" ] && [ "$TMUX" = "" ]; then
|
||||
# iTerm2 cursor shape escape sequences outside tmux
|
||||
cursor_block="\e]50;CursorShape=0\C-G"
|
||||
cursor_line="\e]50;CursorShape=1\C-G"
|
||||
elif [ "$(ppid_name)" != "python2" ]; then
|
||||
# iTerm2 inside tmux or VTE compatible cursor shape escape sequences,
|
||||
# exclude Guake even though it's VTE based it doesn't like these
|
||||
cursor_block="\e[2 q"
|
||||
cursor_line="\e[6 q"
|
||||
fi
|
||||
if [ "$ITERM_SESSION_ID" != "" ]; then
|
||||
# iterm2 cursor shape escape sequences
|
||||
cursor_block="$tmux_before\E]50;CursorShape=0\C-G$tmux_after"
|
||||
cursor_line="$tmux_before\E]50;CursorShape=1\C-G$tmux_after"
|
||||
else
|
||||
# VTE compatible cursor shape escape sequences
|
||||
cursor_block="$tmux_before\E[2 q$tmux_after"
|
||||
cursor_line="$tmux_before\E[6 q$tmux_after"
|
||||
fi
|
||||
unset tmux_before tmux_after
|
||||
|
||||
if [[ ! -z "$cursor_block" && ! -z "$cursor_line" ]]; then
|
||||
# Change cursor shape when vi mode changes
|
||||
|
Loading…
x
Reference in New Issue
Block a user