ZSH
This commit is contained in:
parent
f6a7963f1d
commit
20e67036df
|
@ -1,4 +1,4 @@
|
||||||
#include ".Xresources.d/xft"
|
#include ".Xresources.d/xft"
|
||||||
! #include ".Xresources.d/theme"
|
#include ".Xresources.d/theme"
|
||||||
#include ".Xresources.d/xterm"
|
#include ".Xresources.d/xterm"
|
||||||
#include ".Xresources.d/urxvt"
|
#include ".Xresources.d/urxvt"
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
.profile
|
|
7
bash_profile
Normal file
7
bash_profile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source ~/.config/shell/shenv
|
||||||
|
source ~/.config/shell/commonenv
|
||||||
|
source ~/.config/shell/shrc
|
||||||
|
source ~/.config/shell/commonrc
|
||||||
|
source ~/.config/shell/bashrc
|
191
bashrc
191
bashrc
|
@ -1,188 +1,5 @@
|
||||||
#
|
#!/usr/bin/env bash
|
||||||
# ~/.bashrc
|
|
||||||
#
|
|
||||||
|
|
||||||
# ENVIRONMENT VARIABLES
|
|
||||||
|
|
||||||
# Favourite commands
|
|
||||||
export PAGER=less
|
|
||||||
export EDITOR=nvim
|
|
||||||
export VISUAL=nvim
|
|
||||||
export BROWSER=qutebrowser
|
|
||||||
|
|
||||||
# Some programs need those changes
|
|
||||||
export PATH="/usr/lib/ccache/bin/:$PATH"
|
|
||||||
if [ -d /data/data/com.termux/ ]; then
|
|
||||||
export PATH="$HOME/.termux/scripts:$HOME/.termux/bin:$PATH"
|
|
||||||
fi
|
|
||||||
#export PATH="$(echo "$PATH" | sed 's|:|\n|g' | sort | uniq | tr '\n' ':' | sed 's|:$||')"
|
|
||||||
export JAVA_FONTS=/usr/share/fonts/TTF
|
|
||||||
export ANDROID_HOME=/opt/android-sdk
|
|
||||||
export GOPATH=$HOME/.go
|
|
||||||
export PATH=$GOPATH/bin:$PATH
|
|
||||||
export XDG_CONFIG_HOME=$HOME/.config
|
|
||||||
export ARDUINO=/usr/share/arduino
|
|
||||||
export ARDUINO_DIR=$ARDUINO
|
|
||||||
export ARDMK_VENDOR=archlinux-arduino
|
|
||||||
export PYTHONSTARTUP=$HOME/.config/pythonstartup.py
|
|
||||||
|
|
||||||
# ALIASES
|
|
||||||
|
|
||||||
# Completion for existing commands
|
|
||||||
export LS_OPTIONS='--group-directories-first --time-style=+"%Y-%m-%d %H:%M:%S" --color=auto --file-type --human-readable'
|
|
||||||
alias ls="ls $LS_OPTIONS"
|
|
||||||
alias grep='grep --color=tty -d skip'
|
|
||||||
alias mkdir='mkdir -v'
|
|
||||||
alias cp="cp -i --reflink=auto"
|
|
||||||
alias mv="mv -iv"
|
|
||||||
alias dd='dd status=progress'
|
|
||||||
alias rm='rm -Iv --one-file-system'
|
|
||||||
alias free='free -m'
|
|
||||||
alias df='df -h'
|
|
||||||
alias dmesg='dmesg --ctime'
|
|
||||||
alias ffmpeg='ffmpeg -hide_banner'
|
|
||||||
alias ffprobe='ffprobe -hide_banner'
|
|
||||||
alias ffplay='ffplay -hide_banner'
|
|
||||||
|
|
||||||
# Frequent mistakes
|
|
||||||
alias sl=ls
|
|
||||||
alias al=la
|
|
||||||
alias mdkir=mkdir
|
|
||||||
alias systemclt=systemctl
|
|
||||||
alias please=sudo
|
|
||||||
|
|
||||||
# Shortcuts for commonly used commands
|
|
||||||
alias ll="ls -l $LS_OPTIONS"
|
|
||||||
alias la="ls -la $LS_OPTIONS"
|
|
||||||
alias x='startx; logout'
|
|
||||||
alias nx='nvidia-xrun; logout'
|
|
||||||
alias s='sudo -s -E'
|
|
||||||
alias tracefiles="strace -f -t -e trace=file"
|
|
||||||
alias n='urxvtc &'
|
|
||||||
|
|
||||||
# Superseding commands with better ones if they are present
|
|
||||||
function _do_rank() { # executables... -- arguments...
|
|
||||||
for ex in "$@"
|
|
||||||
do
|
|
||||||
[ "$ex" == "--" ] && break
|
|
||||||
if which "$ex" &> /dev/null
|
|
||||||
then
|
|
||||||
for al in "$@"
|
|
||||||
do
|
|
||||||
shift
|
|
||||||
[ "$al" == "--" ] && break
|
|
||||||
alias "$al"="$ex"
|
|
||||||
done
|
|
||||||
"$ex" "$@"
|
|
||||||
return $?
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
for ex in "$@"
|
|
||||||
do
|
|
||||||
[ "$al" == "--" ] && break
|
|
||||||
if -z "$list"
|
|
||||||
then
|
|
||||||
list=$ex
|
|
||||||
else
|
|
||||||
list=$list, $ex
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "Not installed: $list"
|
|
||||||
}
|
|
||||||
|
|
||||||
function _install_rank() { # executables...
|
|
||||||
for ex in "$@"
|
|
||||||
do
|
|
||||||
list=$@
|
|
||||||
alias "$ex"="_do_rank $list --"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
_install_rank nvim vim vi
|
|
||||||
_install_rank gopass pass
|
|
||||||
_install_rank wakeonlan wol
|
|
||||||
_install_rank neomutt mutt
|
|
||||||
|
|
||||||
# SHELL CUSTOMIZATION
|
|
||||||
|
|
||||||
complete -cf sudo
|
|
||||||
|
|
||||||
shopt -s cdspell
|
|
||||||
shopt -s checkwinsize
|
|
||||||
shopt -s cmdhist
|
|
||||||
shopt -s dotglob
|
|
||||||
shopt -s expand_aliases
|
|
||||||
shopt -s extglob
|
|
||||||
shopt -s histappend
|
|
||||||
shopt -s hostcomplete
|
|
||||||
|
|
||||||
export HISTSIZE=100000
|
|
||||||
export HISTFILESIZE=${HISTSIZE}
|
|
||||||
export HISTCONTROL=ignorespace:erasedups
|
|
||||||
export HISTTIMEFORMAT="%y-%m-%d %H:%M:%S "
|
|
||||||
|
|
||||||
# PROMPT CUSTOMIZATION
|
|
||||||
|
|
||||||
if [[ $USER == 'root' ]]; then
|
|
||||||
col=31;
|
|
||||||
elif [[ $USER == 'geoffrey' || $USER == 'gbontoux' || $USER == 'gpreud' ]]; then
|
|
||||||
col=32;
|
|
||||||
else
|
|
||||||
col=33;
|
|
||||||
fi
|
|
||||||
export PS1="\[\e]2;\u@\h \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
|
|
||||||
export PS2="> "
|
|
||||||
export PS3="+ "
|
|
||||||
export PS4="- "
|
|
||||||
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD}\007"'
|
|
||||||
|
|
||||||
# CUSTOM SCRIPTS
|
|
||||||
|
|
||||||
export PATH="$HOME/.local/bin/:$HOME/.scripts/:$PATH"
|
|
||||||
[ -f ~/.gscripts/gprofile ] && source ~/.gscripts/gprofile
|
|
||||||
|
|
||||||
# UTILITIES
|
|
||||||
|
|
||||||
# Theme
|
|
||||||
[ -f ~/.local/bin/colorSchemeApply ] && source ~/.local/bin/colorSchemeApply
|
|
||||||
[ -f ~/.local/bin/colorSchemeApplyFzf ] && source ~/.local/bin/colorSchemeApplyFzf
|
|
||||||
|
|
||||||
# Bash completion
|
|
||||||
[ -f /etc/bash_completion ] && source /etc/bash_completion
|
|
||||||
|
|
||||||
# Fuzzy matching all the way
|
|
||||||
export FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS} --height 100% --layout=default"
|
|
||||||
export FZF_CTRL_T_OPTS="--preview '[[ -d {} ]] && ls -l --color=always {} || [[ \$(file --mime {}) =~ binary ]] && echo {} is a binary file || (highlight -O ansi -l {} || coderay {} || rougify {} || cat {}) 2> /dev/null | head -500'"
|
|
||||||
export FZF_COMPLETION_OPTS="${FZF_CTRL_T_OPTS}"
|
|
||||||
[ -f /usr/share/fzf/completion.bash ] && source /usr/share/fzf/completion.bash
|
|
||||||
[ -f /usr/share/fzf/key-bindings.bash ] && source /usr/share/fzf/key-bindings.bash
|
|
||||||
|
|
||||||
# Bad day mood-saver
|
|
||||||
function fuck {
|
|
||||||
if which thefuck &> /dev/null
|
|
||||||
then
|
|
||||||
eval $(thefuck --alias)
|
|
||||||
fuck $@
|
|
||||||
else
|
|
||||||
echo "thefuck is not installed on this system."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
alias FUCK='fuck'
|
|
||||||
|
|
||||||
# Node Version Manager
|
|
||||||
function nvm {
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
if [ -s "$NVM_DIR/nvm.sh" ]
|
|
||||||
then
|
|
||||||
. "$NVM_DIR/nvm.sh"
|
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
|
||||||
nvm $@
|
|
||||||
else
|
|
||||||
echo "NVM is not installed on this system."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Command not found handlers
|
|
||||||
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash # Arch
|
|
||||||
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh # Arch (alternative, for Manjaro mostly)
|
|
||||||
|
|
||||||
|
source ~/.config/shell/shrc
|
||||||
|
source ~/.config/shell/commonrc
|
||||||
|
source ~/.config/shell/bashrc
|
||||||
|
|
|
@ -51,7 +51,8 @@ bindsym $mod+Shift+d exec --no-startup-id rofi -modi drun -show drun
|
||||||
bindsym $mod+Return exec urxvtc
|
bindsym $mod+Return exec urxvtc
|
||||||
bindsym $mod+Shift+Return exec urxvt
|
bindsym $mod+Shift+Return exec urxvt
|
||||||
bindsym $mod+p exec thunar
|
bindsym $mod+p exec thunar
|
||||||
bindsym $mod+m exec qutebrowser --override-restore --backend=webengine
|
# bindsym $mod+m exec qutebrowser --override-restore --backend=webengine
|
||||||
|
bindsym $mod+m exec firefox
|
||||||
|
|
||||||
# Volume control
|
# Volume control
|
||||||
bindsym XF86AudioRaiseVolume exec pactl set-sink-mute @DEFAULT_SINK@ false; exec pactl set-sink-volume @DEFAULT_SINK@ +5%
|
bindsym XF86AudioRaiseVolume exec pactl set-sink-mute @DEFAULT_SINK@ false; exec pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||||
|
|
2
config/shell/.gitignore
vendored
Normal file
2
config/shell/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*.zwc
|
||||||
|
.zcompdump
|
4
config/shell/.zprofile
Normal file
4
config/shell/.zprofile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
source ~/.config/shell/shenv
|
||||||
|
source ~/.config/shell/commonenv
|
5
config/shell/.zshrc
Normal file
5
config/shell/.zshrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
source ~/.config/shell/shrc
|
||||||
|
source ~/.config/shell/commonrc
|
||||||
|
source ~/.config/shell/zshrc
|
42
config/shell/bashrc
Normal file
42
config/shell/bashrc
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bash aliases and customizations
|
||||||
|
#
|
||||||
|
|
||||||
|
# Shell options
|
||||||
|
|
||||||
|
shopt -s expand_aliases
|
||||||
|
shopt -s histappend
|
||||||
|
|
||||||
|
HISTCONTROL=ignoreboth:erasedups
|
||||||
|
|
||||||
|
# Prompt customization
|
||||||
|
|
||||||
|
INTERACTIVE_BASHPID_TIMER="${HOME}/.cache/bash_timer_$$"
|
||||||
|
|
||||||
|
PS0='$(echo $SECONDS > "$INTERACTIVE_BASHPID_TIMER")'
|
||||||
|
|
||||||
|
function _update_ps1() {
|
||||||
|
local __ERRCODE=$?
|
||||||
|
|
||||||
|
local __DURATION=0
|
||||||
|
if [ -e "$INTERACTIVE_BASHPID_TIMER" ]; then
|
||||||
|
local __END=$SECONDS
|
||||||
|
local __START=$(cat "$INTERACTIVE_BASHPID_TIMER")
|
||||||
|
__DURATION="$(($__END - ${__START:-__END}))"
|
||||||
|
\rm -f "$INTERACTIVE_BASHPID_TIMER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# echo -en "… $\r"
|
||||||
|
eval "$(powerline-go -shell bash -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
|
||||||
|
|
||||||
|
# Completion
|
||||||
|
trysource /usr/share/bash-completion/bash_completion
|
||||||
|
|
||||||
|
# Fuzzy matching all the way
|
||||||
|
trysource /usr/share/fzf/completion.bash
|
||||||
|
trysource /usr/share/fzf/key-bindings.bash
|
8
config/shell/commonenv
Normal file
8
config/shell/commonenv
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bash / ZSH common environment variables and functions
|
||||||
|
#
|
||||||
|
|
||||||
|
export TIME_STYLE='+%Y-%m-%d %H:%M:%S'
|
||||||
|
eval $(dircolors --sh)
|
32
config/shell/commonrc
Normal file
32
config/shell/commonrc
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bash / ZSH aliases and customizations
|
||||||
|
#
|
||||||
|
|
||||||
|
# Shell options
|
||||||
|
|
||||||
|
HISTSIZE=100000
|
||||||
|
HISTFILE="$HOME/.cache/shell_history"
|
||||||
|
|
||||||
|
## COMMAND CONFIGURATION
|
||||||
|
|
||||||
|
# Completion for existing commands
|
||||||
|
|
||||||
|
alias cp="cp -i --reflink=auto"
|
||||||
|
alias grep="grep --color=tty"
|
||||||
|
alias dd='dd status=progress'
|
||||||
|
alias rm='rm -Iv --one-file-system'
|
||||||
|
alias free='free -m'
|
||||||
|
alias dmesg='dmesg --ctime'
|
||||||
|
|
||||||
|
# [ -f ~/.local/bin/colorSchemeApplyFzf ] && . ~/.local/bin/colorSchemeApplyFzf # Only applies RGB colors...
|
||||||
|
POWERLINE_GO_DEFAULT_OPTS=(-colorize-hostname -max-width 25 -cwd-max-dir-size 10 -modules 'user,host,ssh,venv,cwd,perms,git' -modules-right 'jobs,exit,duration,load') # For reading by shell profiles
|
||||||
|
FZF_DEFAULT_OPTS="--height 100% --layout=default"
|
||||||
|
FZF_CTRL_T_OPTS="--preview '[[ -d {} ]] && ls -l --color=always {} || [[ \$(file --mime {}) =~ binary ]] && file --brief {} || (highlight -O ansi -l {} || coderay {} || rougify {} || cat {}) 2> /dev/null | head -500'"
|
||||||
|
FZF_COMPLETION_OPTS="${FZF_CTRL_T_OPTS}"
|
||||||
|
|
||||||
|
## FUNCTIONS
|
||||||
|
|
||||||
|
## MISC
|
||||||
|
trysource ~/.gscripts/gprofile
|
51
config/shell/shenv
Normal file
51
config/shell/shenv
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Shell common environment variables and functions (BusyBox compatible)
|
||||||
|
#
|
||||||
|
|
||||||
|
# Favourite commands
|
||||||
|
export PAGER=less
|
||||||
|
export EDITOR=nvim
|
||||||
|
export VISUAL=nvim
|
||||||
|
export BROWSER=qutebrowser
|
||||||
|
|
||||||
|
# Program-specific
|
||||||
|
|
||||||
|
[ -z "$SSH_AUTH_SOCK" ] && [ -x "$(command -v ssh-agent)" ] && eval "$(ssh-agent -s)"
|
||||||
|
export GOPATH=$HOME/.cache/go
|
||||||
|
# export JAVA_FONTS=/usr/share/fonts/TTF
|
||||||
|
# export ANDROID_HOME=/opt/android-sdk
|
||||||
|
# export ARDUINO=/usr/share/arduino
|
||||||
|
# export ARDUINO_DIR=$ARDUINO
|
||||||
|
# export ARDMK_VENDOR=archlinux-arduino
|
||||||
|
|
||||||
|
# Path
|
||||||
|
|
||||||
|
# Function stolen from Arch Linux /etc/profile
|
||||||
|
appendpath() {
|
||||||
|
if [ ! -d "$1" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
case ":$PATH:" in
|
||||||
|
*:"$1":*) ;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
# TODO Reverse order: I want the latest ones to supersedes the older ones
|
||||||
|
export PATH="${PATH:+$PATH:}$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
appendpath '/usr/lib/ccache/bin'
|
||||||
|
appendpath "$GOPATH"
|
||||||
|
appendpath "$HOME/.local/bin"
|
||||||
|
appendpath "$HOME/.scripts"
|
||||||
|
|
||||||
|
# If running on termux, load those extra scripts
|
||||||
|
[ -d /data/data/com.termux/ ] && (
|
||||||
|
appendpath "$HOME/.termux/scripts"
|
||||||
|
appendpath "$HOME/.termux/bin"
|
||||||
|
)
|
||||||
|
|
||||||
|
# For superseding commands with better ones if they are present
|
88
config/shell/shrc
Normal file
88
config/shell/shrc
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Shell common aliases and customizations (BusyBox compatible)
|
||||||
|
#
|
||||||
|
|
||||||
|
## COMMAND CONFIGURATION
|
||||||
|
|
||||||
|
# Completion for existing commands
|
||||||
|
alias ls='ls -h --color=auto'
|
||||||
|
alias mkdir='mkdir -v'
|
||||||
|
alias cp="cp -i"
|
||||||
|
alias mv="mv -iv"
|
||||||
|
alias free='free -h'
|
||||||
|
alias df='df -h'
|
||||||
|
|
||||||
|
alias ffmpeg='ffmpeg -hide_banner'
|
||||||
|
alias ffprobe='ffprobe -hide_banner'
|
||||||
|
alias ffplay='ffplay -hide_banner'
|
||||||
|
|
||||||
|
# ALIASES
|
||||||
|
|
||||||
|
# Frequent mistakes
|
||||||
|
alias sl=ls
|
||||||
|
alias al=la
|
||||||
|
alias mdkir=mkdir
|
||||||
|
alias systemclt=systemctl
|
||||||
|
alias please=sudo
|
||||||
|
|
||||||
|
# Shortcuts for commonly used commands
|
||||||
|
alias ll="ls -l"
|
||||||
|
alias la="ls -la"
|
||||||
|
alias s='sudo -s -E'
|
||||||
|
alias n='urxvtc &'
|
||||||
|
alias x='startx; logout'
|
||||||
|
alias nx='nvidia-xrun; logout'
|
||||||
|
|
||||||
|
# FUNCTIONS
|
||||||
|
trysource() {
|
||||||
|
if [ -f "$1" ]
|
||||||
|
then
|
||||||
|
. "$1"
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Superseding commands with better ones if they are present
|
||||||
|
_rank_select() { # executables... -- arguments...
|
||||||
|
for ex in "$@"; do
|
||||||
|
[ "$ex" = "--" ] && break
|
||||||
|
if which "$ex" &>/dev/null; then
|
||||||
|
for al in "$@"; do
|
||||||
|
shift
|
||||||
|
[ "$al" = "--" ] && break
|
||||||
|
alias "$al"="$ex"
|
||||||
|
done
|
||||||
|
"$ex" "$@"
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for ex in "$@"; do
|
||||||
|
[ "$al" = "--" ] && break
|
||||||
|
if [ -z "$list" ]; then
|
||||||
|
list=$ex
|
||||||
|
else
|
||||||
|
list=$list, $ex
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Not installed: $list"
|
||||||
|
}
|
||||||
|
|
||||||
|
_rank_install() { # executables...
|
||||||
|
for ex in "$@"; do
|
||||||
|
list=$@
|
||||||
|
alias "$ex"="_rank_select $list --"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
_rank_install nvim vim vi
|
||||||
|
_rank_install gopass pass
|
||||||
|
_rank_install wakeonlan wol
|
||||||
|
_rank_install neomutt mutt
|
||||||
|
|
||||||
|
## COLORS
|
||||||
|
|
||||||
|
[ -f ~/.local/bin/colorSchemeApply ] && . ~/.local/bin/colorSchemeApply
|
||||||
|
# Needed because xterm/urxvt won't use the last color, needed for vim
|
||||||
|
|
187
config/shell/zshrc
Normal file
187
config/shell/zshrc
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
#
|
||||||
|
# ZSH aliases and customizations
|
||||||
|
#
|
||||||
|
|
||||||
|
# TODO Learn `setopt extendedglob`
|
||||||
|
# TODO Add asdf (oh-my-zsh plugin is air, git clone is the way (aur package outdated))
|
||||||
|
|
||||||
|
# Approximate RGB colors by terminal colors
|
||||||
|
[[ "$COLORTERM" == (24bit|truecolor) || "${terminfo[colors]}" -eq '16777216' ]] || zmodload zsh/nearcolor
|
||||||
|
|
||||||
|
# Plugins
|
||||||
|
ADOTDIR=~/.cache/antigen
|
||||||
|
mkdir -p $ADOTDIR
|
||||||
|
typeset -a ANTIGEN_CHECK_FILES=(~/.config/shell/zshrc)
|
||||||
|
|
||||||
|
source ~/.local/share/zsh/antigen.zsh # Don't work with trysource, why?
|
||||||
|
antigen bundle zsh-users/zsh-completions
|
||||||
|
antigen bundle zsh-users/zsh-syntax-highlighting
|
||||||
|
antigen bundle zsh-users/zsh-autosuggestions
|
||||||
|
antigen bundle zsh-users/zsh-history-substring-search
|
||||||
|
antigen apply
|
||||||
|
|
||||||
|
|
||||||
|
# Prompt customization
|
||||||
|
zmodload zsh/datetime
|
||||||
|
|
||||||
|
function preexec() {
|
||||||
|
__TIMER=$EPOCHREALTIME
|
||||||
|
}
|
||||||
|
|
||||||
|
function powerline_precmd() {
|
||||||
|
local __ERRCODE=$?
|
||||||
|
local __DURATION=0
|
||||||
|
|
||||||
|
if [ -n $__TIMER ]; then
|
||||||
|
local __ERT=$EPOCHREALTIME
|
||||||
|
__DURATION="$(($__ERT - ${__TIMER:-__ERT}))"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# echo -en "… $\r"
|
||||||
|
eval "$(powerline-go -shell zsh -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
|
||||||
|
unset __TIMER
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_powerline_precmd() {
|
||||||
|
for s in "${precmd_functions[@]}"; do
|
||||||
|
if [ "$s" = "powerline_precmd" ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
precmd_functions+=(powerline_precmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
install_powerline_precmd
|
||||||
|
|
||||||
|
# Cursor based on mode
|
||||||
|
if [ $TERM = "linux" ]; then
|
||||||
|
_LINE_CURSOR="\e[?0c"
|
||||||
|
_BLOCK_CURSOR="\e[?8c"
|
||||||
|
else
|
||||||
|
_LINE_CURSOR="\e[6 q"
|
||||||
|
_BLOCK_CURSOR="\e[2 q"
|
||||||
|
fi
|
||||||
|
function zle-keymap-select zle-line-init
|
||||||
|
{
|
||||||
|
case $KEYMAP in
|
||||||
|
vicmd) print -n -- "$_BLOCK_CURSOR";;
|
||||||
|
viins|main) print -n -- "$_LINE_CURSOR";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# zle reset-prompt
|
||||||
|
# zle -R
|
||||||
|
}
|
||||||
|
|
||||||
|
function zle-line-finish
|
||||||
|
{
|
||||||
|
print -n -- "$_BLOCK_CURSOR"
|
||||||
|
}
|
||||||
|
|
||||||
|
zle -N zle-line-init
|
||||||
|
zle -N zle-line-finish
|
||||||
|
zle -N zle-keymap-select
|
||||||
|
|
||||||
|
# Should I really put a comment to explain what this does?
|
||||||
|
bindkey 'jk' vi-cmd-mode
|
||||||
|
|
||||||
|
# Edit command line
|
||||||
|
autoload edit-command-line
|
||||||
|
zle -N edit-command-line
|
||||||
|
bindkey -M vicmd v edit-command-line
|
||||||
|
|
||||||
|
# History search
|
||||||
|
# bind UP and DOWN arrow keys
|
||||||
|
zmodload zsh/terminfo
|
||||||
|
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||||
|
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||||
|
|
||||||
|
# bind UP and DOWN arrow keys (compatibility fallback
|
||||||
|
# for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users)
|
||||||
|
bindkey '^[[A' history-substring-search-up
|
||||||
|
bindkey '^[[B' history-substring-search-down
|
||||||
|
|
||||||
|
# bind P and N for EMACS mode
|
||||||
|
bindkey -M emacs '^P' history-substring-search-up
|
||||||
|
bindkey -M emacs '^N' history-substring-search-down
|
||||||
|
|
||||||
|
# bind k and j for VI mode
|
||||||
|
bindkey -M vicmd 'k' history-substring-search-up
|
||||||
|
bindkey -M vicmd 'j' history-substring-search-down
|
||||||
|
|
||||||
|
# Autocompletion
|
||||||
|
autoload -Uz compinit promptinit
|
||||||
|
compinit
|
||||||
|
promptinit
|
||||||
|
|
||||||
|
# Color common prefix
|
||||||
|
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==35=00}:${(s.:.)LS_COLORS}")'
|
||||||
|
|
||||||
|
setopt GLOBDOTS # Complete hidden files
|
||||||
|
|
||||||
|
setopt NO_BEEP # that annoying beep goes away
|
||||||
|
# setopt NO_LIST_BEEP # beeping is only turned off for ambiguous completions
|
||||||
|
setopt AUTO_LIST # when the completion is ambiguous you get a list without having to type ^D
|
||||||
|
# setopt BASH_AUTO_LIST # the list only happens the second time you hit tab on an ambiguous completion
|
||||||
|
# setopt LIST_AMBIGUOUS # this is modified so that nothing is listed if there is an unambiguous prefix or suffix to be inserted --- this can be combined with BASH_AUTO_LIST, so that where both are applicable you need to hit tab three times for a listing
|
||||||
|
unsetopt REC_EXACT # if the string on the command line exactly matches one of the possible completions, it is accepted, even if there is another completion (i.e. that string with something else added) that also matches
|
||||||
|
unsetopt MENU_COMPLETE # one completion is always inserted completely, then when you hit TAB it changes to the next, and so on until you get back to where you started
|
||||||
|
unsetopt AUTO_MENU # you only get the menu behaviour when you hit TAB again on the ambiguous completion.
|
||||||
|
unsetopt AUTO_REMOVE_SLASH
|
||||||
|
|
||||||
|
# Fuzzy matching all the way
|
||||||
|
# trysource /usr/share/fzf/completion.zsh
|
||||||
|
trysource /usr/share/fzf/key-bindings.zsh
|
||||||
|
|
||||||
|
# Help
|
||||||
|
autoload -Uz run-help
|
||||||
|
unalias run-help
|
||||||
|
alias help=run-help
|
||||||
|
autoload -Uz run-help-git
|
||||||
|
autoload -Uz run-help-ip
|
||||||
|
autoload -Uz run-help-openssl
|
||||||
|
autoload -Uz run-help-p4
|
||||||
|
autoload -Uz run-help-sudo
|
||||||
|
autoload -Uz run-help-svk
|
||||||
|
autoload -Uz run-help-svn
|
||||||
|
|
||||||
|
# Dir stack
|
||||||
|
DIRSTACKFILE="$HOME/.cache/zsh/dirs"
|
||||||
|
if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then
|
||||||
|
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
|
||||||
|
# [[ -d $dirstack[1] ]] && cd $dirstack[1]
|
||||||
|
fi
|
||||||
|
chpwd() {
|
||||||
|
print -l $PWD ${(u)dirstack} >$DIRSTACKFILE
|
||||||
|
}
|
||||||
|
|
||||||
|
DIRSTACKSIZE=100
|
||||||
|
|
||||||
|
setopt AUTO_PUSHD PUSHD_SILENT PUSHD_TO_HOME
|
||||||
|
setopt PUSHD_IGNORE_DUPS # Remove duplicate entries
|
||||||
|
setopt PUSHD_MINUS # This reverts the +/- operators.
|
||||||
|
|
||||||
|
|
||||||
|
# Command not found
|
||||||
|
# (since we have syntax highlighting there is no need to wait to see that we typed crap)
|
||||||
|
trysource /usr/share/doc/pkgfile/command-not-found.zsh
|
||||||
|
|
||||||
|
# History
|
||||||
|
|
||||||
|
# From https://unix.stackexchange.com/a/273863
|
||||||
|
SAVEHIST=$HISTSIZE
|
||||||
|
setopt BANG_HIST # Treat the '!' character specially during expansion.
|
||||||
|
unsetopt 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 SHARE_HISTORY # Share history between all sessions.
|
||||||
|
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.
|
||||||
|
unsetopt HIST_VERIFY # Don't execute immediately upon history expansion.
|
||||||
|
unsetopt HIST_BEEP # Beep when accessing nonexistent history.
|
||||||
|
|
23
inputrc
23
inputrc
|
@ -1,7 +1,8 @@
|
||||||
$include /etc/inputrc
|
$include /etc/inputrc
|
||||||
set bell-style none
|
set bell-style none
|
||||||
|
set colored-completion-prefix on
|
||||||
|
set colored-stats on
|
||||||
set completion-ignore-case on
|
set completion-ignore-case on
|
||||||
set completion-prefix-display-length 4
|
|
||||||
set completion-query-items 200
|
set completion-query-items 200
|
||||||
set editing-mode vi
|
set editing-mode vi
|
||||||
set history-preserve-point on
|
set history-preserve-point on
|
||||||
|
@ -11,25 +12,37 @@ set mark-directories on
|
||||||
set mark-modified-lines off
|
set mark-modified-lines off
|
||||||
set mark-symlinked-directories on
|
set mark-symlinked-directories on
|
||||||
set match-hidden-files on
|
set match-hidden-files on
|
||||||
|
set menu-complete-display-prefix on
|
||||||
set page-completions on
|
set page-completions on
|
||||||
set print-completions-horizontally on
|
set print-completions-horizontally off
|
||||||
set revert-all-at-newline off
|
set revert-all-at-newline off
|
||||||
set show-all-if-ambiguous on
|
set show-all-if-ambiguous on
|
||||||
set show-all-if-unmodified on
|
set show-all-if-unmodified on
|
||||||
|
set show-mode-in-prompt on
|
||||||
set skip-completed-text on
|
set skip-completed-text on
|
||||||
set visible-stats on
|
set visible-stats off
|
||||||
|
|
||||||
$if mode=vi
|
$if mode=vi
|
||||||
set keymap vi-command
|
|
||||||
# these are for vi-command mode
|
# these are for vi-command mode
|
||||||
|
set keymap vi-command
|
||||||
"\e[A": history-search-backward
|
"\e[A": history-search-backward
|
||||||
"\e[B": history-search-forward
|
"\e[B": history-search-forward
|
||||||
Control-l: clear-screen
|
Control-l: clear-screen
|
||||||
set keymap vi-insert
|
|
||||||
# these are for vi-insert mode
|
# these are for vi-insert mode
|
||||||
|
set keymap vi-insert
|
||||||
"jk": vi-movement-mode
|
"jk": vi-movement-mode
|
||||||
"\e[A": history-search-backward
|
"\e[A": history-search-backward
|
||||||
"\e[B": history-search-forward
|
"\e[B": history-search-forward
|
||||||
Control-l: clear-screen
|
Control-l: clear-screen
|
||||||
|
|
||||||
|
# Switch between thin cursor and thicc block depending on vi mode
|
||||||
|
$if term=linux
|
||||||
|
set vi-ins-mode-string \1\e[?0c\2
|
||||||
|
set vi-cmd-mode-string \1\e[?8c\2
|
||||||
|
$else
|
||||||
|
set vi-ins-mode-string \1\e[6 q\2
|
||||||
|
set vi-cmd-mode-string \1\e[2 q\2
|
||||||
|
$endif
|
||||||
$endif
|
$endif
|
||||||
|
|
||||||
|
|
11
profile
11
profile
|
@ -1,9 +1,4 @@
|
||||||
#
|
#!/usr/bin/env sh
|
||||||
# ~/.profile
|
|
||||||
#
|
|
||||||
|
|
||||||
# SSH agent
|
. ~/.config/shell/shenv
|
||||||
[[ -z "$SSH_AUTH_SOCK" && -x "$(which ssh-agent)" ]] && eval `ssh-agent -s` &> /dev/null
|
. ~/.config/shell/shrc
|
||||||
|
|
||||||
# Bashrc
|
|
||||||
[ -f ~/.bashrc ] && source ~/.bashrc
|
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
play -n synth sine E5 sine A4 remix 1-2 fade 0.5 1.2 0.5 2> /dev/null
|
play -n synth sine E5 sine A4 remix 1-2 fade 0.5 1.2 0.5 2> /dev/null
|
||||||
|
# echo
|
||||||
|
|
|
@ -41,6 +41,9 @@ curl "https://raw.githubusercontent.com/theova/base16-qutebrowser/master/themes/
|
||||||
# TODO highlight (there IS a template but the colors look different from vim and mostly the same from when there's no config)
|
# TODO highlight (there IS a template but the colors look different from vim and mostly the same from when there's no config)
|
||||||
|
|
||||||
# Reload a bunch of things to make changes immediate
|
# Reload a bunch of things to make changes immediate
|
||||||
source ~/.bashrc
|
~/.local/bin/colorSchemeApply
|
||||||
xrdb -load ~/.Xresources
|
~/.local/bin/colorSchemeApplyFzf
|
||||||
i3-msg reload
|
# Error masking in case X not running
|
||||||
|
xrdb -load ~/.Xresources 2> /dev/null
|
||||||
|
i3-msg reload 2> /dev/null
|
||||||
|
|
||||||
|
|
2
scripts/tracefiles
Executable file
2
scripts/tracefiles
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
strace -f -t -e trace=file
|
54
vimrc
54
vimrc
|
@ -31,11 +31,10 @@ Plug 'vim-airline/vim-airline'
|
||||||
Plug 'vim-airline/vim-airline-themes'
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
Plug 'airblade/vim-gitgutter'
|
Plug 'airblade/vim-gitgutter'
|
||||||
Plug 'mbbill/undotree'
|
Plug 'mbbill/undotree'
|
||||||
Plug 'xolox/vim-misc' " Required for 'xolox/vim-easytags'
|
Plug 'ludovicchabant/vim-gutentags'
|
||||||
Plug 'xolox/vim-easytags'
|
|
||||||
Plug 'majutsushi/tagbar'
|
Plug 'majutsushi/tagbar'
|
||||||
Plug 'wellle/targets.vim'
|
Plug 'wellle/targets.vim'
|
||||||
Plug 'Chiel92/vim-autoformat'
|
" Plug 'Chiel92/vim-autoformat'
|
||||||
Plug 'tomtom/tcomment_vim'
|
Plug 'tomtom/tcomment_vim'
|
||||||
" Plug 'Shougo/denite.nvim'
|
" Plug 'Shougo/denite.nvim'
|
||||||
" Plug 'tomlion/vim-solidity'
|
" Plug 'tomlion/vim-solidity'
|
||||||
|
@ -43,16 +42,16 @@ Plug 'tomtom/tcomment_vim'
|
||||||
" Plug 'jrozner/vim-antlr'
|
" Plug 'jrozner/vim-antlr'
|
||||||
"
|
"
|
||||||
" Plug 'maralla/completor.vim'
|
" Plug 'maralla/completor.vim'
|
||||||
if has('nvim')
|
" if has('nvim')
|
||||||
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||||
else
|
" else
|
||||||
Plug 'Shougo/deoplete.nvim'
|
" Plug 'Shougo/deoplete.nvim'
|
||||||
Plug 'roxma/nvim-yarp'
|
" Plug 'roxma/nvim-yarp'
|
||||||
Plug 'roxma/vim-hug-neovim-rpc'
|
" Plug 'roxma/vim-hug-neovim-rpc'
|
||||||
endif
|
" endif
|
||||||
Plug 'zchee/deoplete-jedi'
|
" Plug 'zchee/deoplete-jedi'
|
||||||
|
|
||||||
Plug 'python-mode/python-mode', { 'branch': 'develop' }
|
" Plug 'python-mode/python-mode', { 'branch': 'develop' }
|
||||||
Plug 'junegunn/fzf', {'do': './install --bin'}
|
Plug 'junegunn/fzf', {'do': './install --bin'}
|
||||||
Plug 'junegunn/fzf.vim'
|
Plug 'junegunn/fzf.vim'
|
||||||
Plug 'ervandew/supertab'
|
Plug 'ervandew/supertab'
|
||||||
|
@ -60,12 +59,19 @@ Plug 'dpelle/vim-LanguageTool'
|
||||||
Plug 'terryma/vim-smooth-scroll'
|
Plug 'terryma/vim-smooth-scroll'
|
||||||
Plug 'vim-pandoc/vim-pandoc'
|
Plug 'vim-pandoc/vim-pandoc'
|
||||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||||
|
Plug 'idanarye/vim-vebugger'
|
||||||
|
Plug 'w0rp/ale'
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
""" COMPLETOR """
|
""" ALE """
|
||||||
|
|
||||||
let g:deoplete#enable_at_startup = 1
|
nmap <F3> :ALEFix<CR>
|
||||||
|
|
||||||
|
let g:ale_sign_error = '×'
|
||||||
|
let g:ale_sign_warning = '!'
|
||||||
|
let g:ale_completion_enabled = 1
|
||||||
|
let g:ale_fixers = ['shfmt', 'uncrustify', 'remove_trailing_lines', 'trim_whitespace']
|
||||||
|
|
||||||
""" UNDOTREE """
|
""" UNDOTREE """
|
||||||
|
|
||||||
|
@ -87,27 +93,11 @@ let g:airline_section_a = airline#section#create(['mode'])
|
||||||
let g:airline_section_b = airline#section#create(['branch', 'hunks'])
|
let g:airline_section_b = airline#section#create(['branch', 'hunks'])
|
||||||
" let g:airline_section_z = airline#section#create(['%B', '@', '%l', ':', '%c'])
|
" let g:airline_section_z = airline#section#create(['%B', '@', '%l', ':', '%c'])
|
||||||
let g:airline_theme = 'base16_monokai'
|
let g:airline_theme = 'base16_monokai'
|
||||||
|
let g:airline#extensions#ale#enabled = 1
|
||||||
""" AUTOFORMAT """
|
|
||||||
nmap <F3> :Autoformat<CR>
|
|
||||||
|
|
||||||
""" PYMODE """
|
|
||||||
|
|
||||||
let g:pymode_virtualenv = 1
|
|
||||||
let g:pymode_lint_ignore = ["W0401"]
|
|
||||||
let g:pymode_lint_cwindow = 0
|
|
||||||
let g:pymode_lint_on_fly = 1
|
|
||||||
" let g:pymode_lint_checkers = ['pyflakes', 'pep8', 'mccabe']
|
|
||||||
let g:pymode_lint_checkers = ['pyflakes', 'mccabe']
|
|
||||||
" Pymode temporarly disabled for battle dev
|
|
||||||
|
|
||||||
" TODO Even with magic pymod_motion complains about the option `magic&` being not set :/
|
|
||||||
let g:pymode_motion = 0
|
|
||||||
set magic
|
|
||||||
|
|
||||||
""" FZF """
|
""" FZF """
|
||||||
|
|
||||||
let g:fzf_layout = { 'down': '~100%' }
|
let g:fzf_layout = { 'down': '~40%' }
|
||||||
let g:fzf_colors =
|
let g:fzf_colors =
|
||||||
\ { 'fg': ['fg', 'Normal'],
|
\ { 'fg': ['fg', 'Normal'],
|
||||||
\ 'bg': ['bg', 'Normal'],
|
\ 'bg': ['bg', 'Normal'],
|
||||||
|
|
Loading…
Reference in a new issue