zsh: without oh-my-zsh and Emacs directory tracking

This commit is contained in:
Łukasz Pankowski 2020-07-19 14:24:46 +02:00
parent 723398dead
commit 29d5924a78

View File

@ -1,48 +1,82 @@
# Path to oh-my-zsh installation. # History.
export ZSH="/home/lupan/.config/zsh/oh-my-zsh"
# Set name of the theme to load.
ZSH_THEME="lukerandall"
# Disable auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Change the command execution time stamp shown in the history command output.
HIST_STAMPS="yyyy-mm-dd"
# Change path to history file.
HISTFILE="$ZDOTDIR/.zsh_history" HISTFILE="$ZDOTDIR/.zsh_history"
SCD_HISTFILE="$ZDOTDIR/.scdhistory" SCD_HISTFILE="$ZDOTDIR/.scdhistory"
HISTSIZE=10000
SAVEHIST=10000
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_find_no_dups
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt hist_reduce_blanks
setopt inc_append_history
setopt share_history
# Styles. # Prompt.
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=5,underline"
# Plugins to load. autoload -Uz vcs_info
plugins=(git scd zsh-syntax-highlighting zsh-autosuggestions) precmd () { vcs_info }
setopt prompt_subst
zstyle ':vcs_info:git:*' formats '%F{yellow}(%b)%r%f '
zstyle ':vcs_info:*' enable git
PS1='%B%F{green}%n@%m%f %F{blue}%~%f%b ${vcs_info_msg_0_}%B%#%f%b '
RPROMPT='%(?..%B%F{red}%?%f%b)'
source $ZSH/oh-my-zsh.sh # Completion.
# Directory tracking in Emacs vterm. autoload -Uz compinit
compinit
zstyle ':completion:*' menu select
function vterm_printf(){ # Options.
if [ -n "$TMUX" ]; then
# tell tmux to pass the escape sequences through setopt auto_cd
# (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324) setopt extended_glob
printf "\ePtmux;\e\e]%s\007\e\\" "$1" setopt glob_complete
elif [ "${TERM%%-*}" = "screen" ]; then setopt interactive_comments
# GNU screen (screen, screen-256color, screen-256color-bce) setopt no_flow_control
printf "\eP\e]%s\007\e\\" "$1" WORDCHARS=
else
printf "\e]%s\e\\" "$1" # Terminal title.
fi
autoload -Uz add-zsh-hook
function xterm_title_precmd () {
print -Pn -- '\e]2;%n@%m %~\a'
} }
vterm_prompt_end() { function xterm_title_preexec () {
vterm_printf "51;A$(whoami)@$(hostname):$(pwd)"; print -Pn -- '\e]2;%n@%m %~ %# ' && print -n -- "${(q)1}\a"
} }
if [ "$TERM" != "dumb" ]; then
PROMPT=$PROMPT'%{$(vterm_prompt_end)%}' if [[ "$TERM" == (alacritty*|gnome*|konsole*|putty*|rxvt*|screen*|tmux*|xterm*) ]]; then
add-zsh-hook -Uz precmd xterm_title_precmd
add-zsh-hook -Uz preexec xterm_title_preexec
fi fi
# Plugins.
source_if_exists() {
[ -e "$1" ] && source "$1"
}
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=5,underline"
source_if_exists ~/.config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
if source_if_exists ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh; then
ZSH_HIGHLIGHT_STYLES[comment]=fg=cyan,bold
fi
# Directory stack.
DIRSTACKSIZE=10
setopt auto_pushd pushd_minus pushd_silent pushd_to_home pushd_ignore_dups
# Aliases. # Aliases.
alias dh='dirs -v'
alias e='emacsclient -n' alias e='emacsclient -n'
alias history='history -i'
alias ls='ls --color=tty'