# -*- mode: shell-script -*- # vim:ft=zsh # Opciones principales {{{ autoload -Uz bracketed-paste-url-magic zle -N bracketed-paste bracketed-paste-url-magic setopt RM_STAR_WAIT setopt COMBINING_CHARS # Combine accents with the base character. setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell. setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'. unsetopt MAIL_WARNING # Don't print a warning message if a mail file has been accessed. setopt LONG_LIST_JOBS # List jobs in the long format by default. setopt AUTO_RESUME # Attempt to resume existing job before creating a new process. setopt NOTIFY # Report status of background jobs immediately. unsetopt BG_NICE # Don't run all background jobs at a lower priority. unsetopt HUP # Don't kill jobs on shell exit. unsetopt CHECK_JOBS # Don't report on jobs when shell exit. setopt AUTO_CD # Auto changes to a directory without typing cd. setopt AUTO_PUSHD # Push the old directory onto the stack on cd. setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack. setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd. setopt PUSHD_TO_HOME # Push to home directory when no argument is given. setopt CDABLE_VARS # Change directory to a path stored in a variable. setopt MULTIOS # Write to multiple descriptors. # }}} # Historial {{{ export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help:* --version:* -v:man *:up:tuir *" HISTFILE="$ZDOTDIR/histfile" HISTSIZE=10000 SAVEHIST=10000 setopt BANG_HIST # Treat the '!' character specially during expansion. setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format. setopt SHARE_HISTORY # Share history between all sessions. setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history. setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again. setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate. setopt HIST_FIND_NO_DUPS # Do not display a previously found event. setopt HIST_IGNORE_SPACE # Do not record an event starting with a space. setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file. setopt HIST_VERIFY # Do not execute immediately upon history expansion. setopt HIST_BEEP # Beep when accessing non-existent history. # }}} # Plugins y extras {{{ foreach programa ( doc/fzf/completion.zsh doc/fzf/key-bindings.zsh zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ) { source /usr/share/$programa } foreach extra ( lf-icons.zsh up.plugin.zsh zsh-autopair/autopair.plugin.zsh zsh-system-clipboard/zsh-system-clipboard.plugin.zsh git-extras-completion.zsh autocompletar.zsh aliases.zsh zmarks.zsh zsh-history-substring-search/zsh-history-substring-search.plugin.zsh teclas.zsh ) { source $ZDOTDIR/$extra } HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1 typeset -g ZSH_SYSTEM_CLIPBOARD_TMUX_SUPPORT='true' source $XDG_DATA_HOME/lscolors.sh # }}} # Prompt {{{ function precmd() { if [ -z "$NEW_LINE_BEFORE_PROMPT" ]; then NEW_LINE_BEFORE_PROMPT=1 elif [ "$NEW_LINE_BEFORE_PROMPT" -eq 1 ]; then echo "\n" fi } setopt PROMPT_SUBST # Anonymous function to avoid leaking variables. function () { # Check for tmux by looking at $TERM, because $TMUX won't be propagated to any # nested sudo shells but $TERM will. local TMUXING=$([[ "$TERM" =~ "tmux" ]] && echo tmux) if [ -n "$TMUXING" -a -n "$TMUX" ]; then # In a a tmux session created in a non-root or root shell. local LVL=$(($SHLVL - 1)) else # Either in a root shell created inside a non-root tmux session, # or not in a tmux session. local LVL=$SHLVL fi if [[ $EUID -eq 0 ]]; then local SUFFIX='%F{yellow}%n%f'$(printf '%%F{yellow}\uf460%.0s%%f' {1..$LVL}) else local SUFFIX=$(printf '\uf460%.0s%%f' {1..$LVL}) fi export PS1="%(?..%{%F{red}%}(%?%)%{%f%} )%F{green}${SSH_TTY:+%n@%m}%f%B${SSH_TTY:+:}%b%F{blue}%B%2~%b%F{yellow}%B%(1j.*.)%b%f %B${SUFFIX}%b " if [[ -n "$TMUXING" ]]; then # Outside tmux, ZLE_RPROMPT_INDENT ends up eating the space after PS1, and # prompt still gets corrupted even if we add an extra space to compensate. export ZLE_RPROMPT_INDENT=0 fi } export SPROMPT="zsh: correct %F{red}'%R'%f to %F{green}'%r'%f [%B%Uy%u%bes, %B%Un%u%bo, %B%Ue%u%bdit, %B%Ua%u%bbort]? " function zle-keymap-select { if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then echo -ne '\e[2 q' elif [[ ${KEYMAP} == main ]] || [[ ${KEYMAP} == viins ]] || [[ ${KEYMAP} = '' ]] || [[ $1 = 'beam' ]]; then echo -ne '\e[6 q' fi } zle -N zle-keymap-select zle-line-init() { echo -ne "\e[6 q" } zle -N zle-line-init echo -ne '\e[5 q' # Use beam shape cursor on startup. preexec() { echo -ne '\e[6 q' ;} # Use beam shape cursor for each new prompt. # }}} # vim:foldmethod=marker:foldlevel=0