From 0e325e0ac2110e9832aae051bb21f05dc6f8ccdc Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Sun, 8 Apr 2018 11:25:59 +0100 Subject: Remove oh-my-zsh --- zsh/.zsh/.zprofile | 7 --- zsh/.zsh/.zshenv | 11 ---- zsh/.zsh/.zshrc | 161 --------------------------------------------------- zsh/.zshenv | 13 ++++- zsh/.zshrc | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 178 insertions(+), 180 deletions(-) delete mode 100644 zsh/.zsh/.zprofile delete mode 100644 zsh/.zsh/.zshenv delete mode 100644 zsh/.zsh/.zshrc mode change 120000 => 100644 zsh/.zshenv create mode 100644 zsh/.zshrc (limited to 'zsh') diff --git a/zsh/.zsh/.zprofile b/zsh/.zsh/.zprofile deleted file mode 100644 index e6c4265..0000000 --- a/zsh/.zsh/.zprofile +++ /dev/null @@ -1,7 +0,0 @@ -export EDITOR=nvim -export VISUAL=nvim -export HISTSIZE=1000000 -export SAVEHIST=$HISTSIZE - -# Start X automatically -[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx diff --git a/zsh/.zsh/.zshenv b/zsh/.zsh/.zshenv deleted file mode 100644 index 2cd7b6a..0000000 --- a/zsh/.zsh/.zshenv +++ /dev/null @@ -1,11 +0,0 @@ -export ZDOTDIR=$HOME/.zsh - -# Source guix & nix profiles -guix_profile=$HOME/.guix-env -nix_profile=$HOME/.nix-profile/etc/profile.d/nix.sh - -[[ -f $guix_profile ]] && . $guix_profile -[[ -f $nix_profile ]] && . $nix_profile - -# Export pass without repetitions -export -U PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:$HOME/bin:$HOME/.gem/ruby/2.5.0/bin:/usr/lib/surfraw${PATH:+:}$PATH" diff --git a/zsh/.zsh/.zshrc b/zsh/.zsh/.zshrc deleted file mode 100644 index 0728e57..0000000 --- a/zsh/.zsh/.zshrc +++ /dev/null @@ -1,161 +0,0 @@ -## zgen {{{ - -[ ! -d ~/.zsh/zgen ] && git clone https://github.com/tarjoilija/zgen.git ~/.zsh/zgen -source "$HOME/.zsh/zgen/zgen.zsh" - -# Load plugins -if ! zgen saved; then - - echo "Creating a zgen save" - - # Load oh-my-zsh framework - zgen oh-my-zsh - - # Oh-my-zsh plugins - zgen oh-my-zsh plugins/git - - # Navigation plugins - zgen load urbainvaes/fzf-marks - # zgen load wfxr/fzf-marks - - # Other plugins - zgen load rupa/z - - # zsh-users plugins - zgen load zsh-users/zsh-completions src - zgen load zsh-users/zsh-syntax-highlighting - zgen load zsh-users/zsh-autosuggestions - - # Save all to init script - zgen save -fi - -# Autosuggestion -{ - ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6' -} - -# }}} -## Overwrite default options {{{ -if [[ -n $SSH_CLIENT ]]; then -PROMPT='%F{red}[%M]%f %0~ $ ' -else -PROMPT='%0~ $ ' -fi - -# Options -unsetopt histverify -# }}} -## My bindings {{{ -bindkey -v -bindkey -a 'k' history-beginning-search-backward -bindkey -a 'j' history-beginning-search-forward -bindkey '^?' backward-delete-char # backspace -bindkey '^N' history-beginning-search-forward -bindkey '^P' history-beginning-search-backward -bindkey '^a' beginning-of-line -bindkey '^b' backward-char -bindkey '^e' end-of-line -bindkey '^f' forward-char -bindkey '^g' jump -bindkey '^h' backward-delete-char -bindkey '^k' kill-line -bindkey '^u' kill-whole-line -bindkey '^v' visual-mode -bindkey '^w' backward-kill-word -bindkey '^y' autosuggest-accept -bindkey '^z' z -# }}} -## fzf {{{ - -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - -# Use fzf with z -unalias z 2> /dev/null -z() { - [ $# -gt 0 ] && _z "$*" && return - cd "$(_z -l 2>&1 | fzf --height 40% --reverse --inline-info +s --tac --query "$*" | sed 's/^[0-9,.]* *//')" - zle && zle reset-prompt -} -zle -N z - -# }}} -## Colors {{{ - -[[ -f $HOME/.local/colors.zsh ]] && source $HOME/.local/colors.zsh - -colorschemes=$(ls ${HOME}/.Xresources) - -function colo { - - COLORSCHEME=$1 - XRESOURCE_FILE=${HOME}/.Xresources/$COLORSCHEME - - # Change colors for current session - if [[ ! -z "$TMUX" ]]; then - printf '\x1bPtmux;' - esc='\x1b\x1b' - else - esc='\x1b' - fi - - /usr/bin/cpp ${XRESOURCE_FILE} | tr -d ' \t' | sed -n \ - -e "s/.*background:/${esc}]11;/p" \ - -e "s/.*foreground:/${esc}]10;/p" \ - -e "s/.*cursorColor:/${esc}]12;/p" \ - -e "s/.*borderColor:/${esc}]708;/p" \ - -e "s/.*color\\([0-9][^:]*\\):/${esc}]4;\\1;/p" | tr \\n \\a - - # Change color for future sessions - xrdb ${XRESOURCE_FILE} - - echo "export COLORSCHEME=$1" > $HOME/.local/colors.zsh - source $HOME/.local/colors.zsh -} - -# Completion for colorschemes (-M -> Case insensitive) -compctl -k "(${colorschemes})" -M 'm:{a-z}={A-Z}' colo - -function show256 { - for i in {0..255} ; do - printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" - if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then - printf "\n"; - fi - done -} - -# }}} -## Aliases {{{ - -# Commands -alias cdd='cd ~/dotfiles' - -# Programs -alias a='vifm . .' -alias ff='FreeFem++' -alias m='cd ~/.mutt/attachments && mutt && cd -' -alias e='nvim' -alias mux='tmuxinator' -alias n='nvim' -alias ns='nvim -S Session.vim' -alias v='vim' -alias vs="vim -S Session.vim" -alias email="mbsync -a" - -# Git -alias g='git' -alias rd='cd $(git rev-parse --show-toplevel)' - -# GNU Make -alias mi='make install' -alias mc='make clean' -alias mca='make clean-all' - -# Applications -alias -s pdf='xdg-open' - -# Global -alias -g grep='grep --color=auto --exclude-dir={.git,.hg}' - -# }}} diff --git a/zsh/.zshenv b/zsh/.zshenv deleted file mode 120000 index 135f05c..0000000 --- a/zsh/.zshenv +++ /dev/null @@ -1 +0,0 @@ -.zsh/.zshenv \ No newline at end of file diff --git a/zsh/.zshenv b/zsh/.zshenv new file mode 100644 index 0000000..aea57fc --- /dev/null +++ b/zsh/.zshenv @@ -0,0 +1,12 @@ +export EDITOR=nvim +export VISUAL=nvim + +# Source guix & nix profiles +guix_profile=$HOME/.guix-env +nix_profile=$HOME/.nix-profile/etc/profile.d/nix.sh + +[[ -f $guix_profile ]] && . $guix_profile +[[ -f $nix_profile ]] && . $nix_profile + +# Export PATH without repetitions +export -U PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:$HOME/bin:$HOME/.gem/ruby/2.5.0/bin:/usr/lib/surfraw${PATH:+:}$PATH" diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..ec4a213 --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,166 @@ +## startx automatically {{{ +[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx +# }}} +## Bindings {{{ +bindkey -v +bindkey -a 'k' history-beginning-search-backward +bindkey -a 'j' history-beginning-search-forward +bindkey '^?' backward-delete-char # backspace +bindkey '^N' history-beginning-search-forward +bindkey '^P' history-beginning-search-backward +bindkey '^a' beginning-of-line +bindkey '^b' backward-char +bindkey '^e' end-of-line +bindkey '^f' forward-char +bindkey '^h' backward-delete-char +bindkey '^k' kill-line +bindkey '^u' kill-whole-line +bindkey '^v' visual-mode +bindkey '^w' backward-kill-word +# }}} +## Options and modules {{{ + +# History +HISTFILE=$HOME/.zsh_history +HISTSIZE=1000000 +SAVEHIST=$HISTSIZE + +setopt append_history +setopt extended_history +setopt hist_ignore_space +setopt inc_append_history +setopt share_history + +# Completion +zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' + +# Prompt +if [[ -n $SSH_CLIENT ]]; then +PROMPT='%F{red}[%M]%f %0~ $ ' +else +PROMPT='%0~ $ ' +fi +# }}} +## Plugins {{{ +[ ! -d ~/.zsh/zgen ] && git clone https://github.com/tarjoilija/zgen.git ~/.zsh/zgen +source "$HOME/.zsh/zgen/zgen.zsh" + +if ! zgen saved; then + echo "Creating a zgen save" + zgen load rupa/z + zgen load urbainvaes/fzf-marks + zgen load zsh-users/zsh-completions src + zgen load zsh-users/zsh-syntax-highlighting + zgen load zsh-users/zsh-autosuggestions + zgen save +fi + +bindkey '^y' autosuggest-accept +bindkey '^z' z + +ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6' + +# }}} +## fzf {{{ + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +# Use fzf with z +unalias z 2> /dev/null +z() { + [ $# -gt 0 ] && _z "$*" && return + cd "$(_z -l 2>&1 | fzf --height 40% --reverse --inline-info +s --tac --query "$*" | sed 's/^[0-9,.]* *//')" + zle && zle reset-prompt +} +zle -N z + +# }}} +## Colors {{{ + +[[ -f $HOME/.local/colors.zsh ]] && source $HOME/.local/colors.zsh + +colorschemes=$(ls ${HOME}/.Xresources) + +function colo { + + COLORSCHEME=$1 + XRESOURCE_FILE=${HOME}/.Xresources/$COLORSCHEME + + # Change colors for current session + if [[ ! -z "$TMUX" ]]; then + printf '\x1bPtmux;' + esc='\x1b\x1b' + else + esc='\x1b' + fi + + /usr/bin/cpp ${XRESOURCE_FILE} | tr -d ' \t' | sed -n \ + -e "s/.*background:/${esc}]11;/p" \ + -e "s/.*foreground:/${esc}]10;/p" \ + -e "s/.*cursorColor:/${esc}]12;/p" \ + -e "s/.*borderColor:/${esc}]708;/p" \ + -e "s/.*color\\([0-9][^:]*\\):/${esc}]4;\\1;/p" | tr \\n \\a + + # Change color for future sessions + xrdb ${XRESOURCE_FILE} + + echo "export COLORSCHEME=$1" > $HOME/.local/colors.zsh + source $HOME/.local/colors.zsh +} + +# Completion for colorschemes (-M -> Case insensitive) +compctl -k "(${colorschemes})" -M 'm:{a-z}={A-Z}' colo + +function show256 { + for i in {0..255} ; do + printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" + if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then + printf "\n"; + fi + done +} + +# }}} +## Aliases {{{ + +# Directories +alias cdd='cd ~/dotfiles' + +# Vim +alias n='nvim' +alias ns='nvim -S Session.vim' +alias v='vim' +alias vs="vim -S Session.vim" + +# Git +alias g='git' +alias ga='git add' +alias gc='git commit' +alias gd='git diff' +alias gl='git pull' +alias gp='git push' +alias gr='git remote' +alias gra='git remote add' +alias gst='git status' +alias rd='cd $(git rev-parse --show-toplevel)' + +# GNU Make +alias mi='make install' +alias mc='make clean' +alias mca='make clean-all' + +# Misc +alias a='vifm . .' +alias ff='FreeFem++' +alias m='cd ~/.mutt/attachments && mutt && cd -' +alias e='nvim' +alias mux='tmuxinator' +alias email="mbsync -a" + +# Applications +alias -s pdf='xdg-open' + +# Global +alias -g grep='grep --color=auto --exclude-dir={.git,.hg}' + +# }}} -- cgit v1.2.3