From ba1032317f7d81a773f63677909ffefbfe8d44ac Mon Sep 17 00:00:00 2001 From: dalahast Date: Mon, 18 May 2020 11:06:15 +0200 Subject: [PATCH] zsh config cleanup --- .config/zsh/aliases.zsh | 2 ++ .config/zsh/functions.zsh | 6 ++++ .config/zsh/keybinds.zsh | 35 +++++++++++++++++++++++ .config/zsh/plugins | 1 + .zshrc | 60 ++++++++++----------------------------- 5 files changed, 59 insertions(+), 45 deletions(-) create mode 100644 .config/zsh/aliases.zsh create mode 100644 .config/zsh/functions.zsh create mode 100644 .config/zsh/keybinds.zsh create mode 120000 .config/zsh/plugins diff --git a/.config/zsh/aliases.zsh b/.config/zsh/aliases.zsh new file mode 100644 index 0000000..8a622cb --- /dev/null +++ b/.config/zsh/aliases.zsh @@ -0,0 +1,2 @@ +alias hstat="stat -c \"%A %a %n\" *" +alias rsync="rsync -P -r" diff --git a/.config/zsh/functions.zsh b/.config/zsh/functions.zsh new file mode 100644 index 0000000..b2bd23e --- /dev/null +++ b/.config/zsh/functions.zsh @@ -0,0 +1,6 @@ +function cpr() { + rsync --archive -hh --partial --info=stats1 --info=progress2 --modify-window=1 "$@" +} +function mvr() { + rsync --archive -hh --partial --info=stats1 --info=progress2 --modify-window=1 --remove-source-files "$@" +} diff --git a/.config/zsh/keybinds.zsh b/.config/zsh/keybinds.zsh new file mode 100644 index 0000000..70b727f --- /dev/null +++ b/.config/zsh/keybinds.zsh @@ -0,0 +1,35 @@ +bindkey -v +# If NumLock is off, translate keys to make them appear the same as with NumLock on. +bindkey -s '^[OM' '^M' # enter +bindkey -s '^[Ok' '+' +bindkey -s '^[Om' '-' +bindkey -s '^[Oj' '*' +bindkey -s '^[Oo' '/' +bindkey -s '^[OX' '=' + +# If someone switches the terminal to application mode (smkx), translate keys to make +# them appear the same as in raw mode (rmkx). +bindkey -s '^[OH' '^[[H' # home +bindkey -s '^[OF' '^[[F' # end +bindkey -s '^[OA' '^[[A' # up +bindkey -s '^[OB' '^[[B' # down +bindkey -s '^[OD' '^[[D' # left +bindkey -s '^[OC' '^[[C' # right + +# TTY sends different key codes. Translate them to regular. +bindkey -s '^[[1~' '^[[H' # home +bindkey -s '^[[4~' '^[[F' # end + +bindkey '^?' backward-delete-char # bs delete one char backward +bindkey '^[[3~' delete-char # delete delete one char forward +bindkey '^[[H' beginning-of-line # home go to the beginning of line +bindkey '^[[F' end-of-line # end go to the end of line +bindkey '^[[1;5C' forward-word # ctrl+right go forward one word +bindkey '^[[1;5D' backward-word # ctrl+left go backward one word +bindkey '^H' backward-kill-word # ctrl+bs delete previous word +bindkey '^[[3;5~' kill-word # ctrl+del delete next word +bindkey '^J' backward-kill-line # ctrl+j delete everything before cursor +bindkey '^[[D' backward-char # left move cursor one char backward +bindkey '^[[C' forward-char # right move cursor one char forward +bindkey '^[[A' up-line-or-beginning-search # up prev command in history +bindkey '^[[B' down-line-or-beginning-search # down next command in history diff --git a/.config/zsh/plugins b/.config/zsh/plugins new file mode 120000 index 0000000..7d28faf --- /dev/null +++ b/.config/zsh/plugins @@ -0,0 +1 @@ +/home/drew/.oh-my-zsh/custom/plugins \ No newline at end of file diff --git a/.zshrc b/.zshrc index 37e28a6..9c02d94 100644 --- a/.zshrc +++ b/.zshrc @@ -1,23 +1,11 @@ -# If you come from bash you might have to change your $PATH. -# export PATH=$HOME/bin:/usr/local/bin:$PATH - # Path to your oh-my-zsh installation. export ZSH="/home/drew/.oh-my-zsh" -# Set name of the theme to load --- if set to "random", it will -# load a random theme each time oh-my-zsh is loaded, in which case, -# to know which specific one was loaded, run: echo $RANDOM_THEME -# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +# Set name of the theme to load ZSH_THEME="agnoster" -# Set list of themes to pick from when loading at random -# Setting this variable when ZSH_THEME=random will cause zsh to load -# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ -# If set to an empty array, this variable will have no effect. -# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) - # Uncomment the following line to use case-sensitive completion. -# CASE_SENSITIVE="true" +CASE_SENSITIVE="true" # Uncomment the following line to use hyphen-insensitive completion. # Case-sensitive completion must be off. _ and - will be interchangeable. @@ -27,10 +15,10 @@ ZSH_THEME="agnoster" # DISABLE_AUTO_UPDATE="true" # Uncomment the following line to automatically update without prompting. -# DISABLE_UPDATE_PROMPT="true" +DISABLE_UPDATE_PROMPT="true" # Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_ZSH_DAYS=13 +export UPDATE_ZSH_DAYS=14 # Uncomment the following line if pasting URLs and other text is messed up. # DISABLE_MAGIC_FUNCTIONS=true @@ -41,11 +29,8 @@ ZSH_THEME="agnoster" # Uncomment the following line to disable auto-setting terminal title. # DISABLE_AUTO_TITLE="true" -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" - # Uncomment the following line to display red dots whilst waiting for completion. -# COMPLETION_WAITING_DOTS="true" +COMPLETION_WAITING_DOTS="true" # Uncomment the following line if you want to disable marking untracked files # under VCS as dirty. This makes repository status check for large repositories @@ -61,7 +46,7 @@ ZSH_THEME="agnoster" # HIST_STAMPS="mm/dd/yyyy" # Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder +ZSH_CUSTOM=~/.config/zsh # Which plugins would you like to load? # Standard plugins can be found in ~/.oh-my-zsh/plugins/* @@ -81,41 +66,26 @@ source $ZSH/oh-my-zsh.sh # User configuration -# export MANPATH="/usr/local/man:$MANPATH" - -# You may need to manually set your language environment -# export LANG=en_US.UTF-8 - -# Preferred editor for local and remote sessions -# if [[ -n $SSH_CONNECTION ]]; then -# export EDITOR='vim' -# else -# export EDITOR='mvim' -# fi +export LANG=en_US.UTF-8 # Compilation flags # export ARCHFLAGS="-arch x86_64" -# Set personal aliases, overriding those provided by oh-my-zsh libs, -# plugins, and themes. Aliases can be placed here, though oh-my-zsh -# users are encouraged to define aliases within the ZSH_CUSTOM folder. -# For a full list of active aliases, run `alias`. -# -# Example aliases -# alias zshconfig="mate ~/.zshrc" -# alias ohmyzsh="mate ~/.oh-my-zsh" # Lines configured by zsh-newuser-install HISTFILE=~/.histfile -HISTSIZE=1000 -SAVEHIST=1000 +HISTSIZE=10000 +SAVEHIST=10000 setopt appendhistory autocd extendedglob unsetopt beep -bindkey -e # End of lines configured by zsh-newuser-install + # The following lines were added by compinstall zstyle :compinstall filename '/home/drew/.zshrc' - autoload -Uz compinit compinit -# End of lines added by compinstall prompt_context(){} + +autoload -Uz up-line-or-beginning-search +autoload -Uz down-line-or-beginning-search +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search