diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-03-20 13:45:32 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-03-20 13:45:32 +0100 |
commit | b8741890ec8922426ca393e181df5769cd53a0f9 (patch) | |
tree | 2e7767c72436f1ab3a2895ef085e103cee8beaf3 | |
parent | 325d75531153da1a317e219f2e5da85abbe7ea48 (diff) |
refactor zsh
-rw-r--r-- | .config/zsh/aliases.zsh | 44 | ||||
-rw-r--r-- | .config/zsh/exports.zsh | 8 | ||||
-rw-r--r-- | .config/zsh/functions.zsh | 16 | ||||
-rw-r--r-- | .config/zsh/fzf.zsh | 2 | ||||
-rw-r--r-- | .config/zsh/history.zsh | 2 | ||||
-rw-r--r-- | .config/zsh/keybindings.zsh | 5 | ||||
-rw-r--r-- | .config/zsh/plugins.zsh (renamed from .config/zsh/antigen_pkgs.zsh) | 7 | ||||
-rw-r--r-- | .config/zsh/programs.zsh | 42 | ||||
-rw-r--r-- | .config/zsh/purs.zsh | 13 | ||||
-rw-r--r-- | .zshrc | 9 |
10 files changed, 74 insertions, 74 deletions
diff --git a/.config/zsh/aliases.zsh b/.config/zsh/aliases.zsh index e12f942..e53ecca 100644 --- a/.config/zsh/aliases.zsh +++ b/.config/zsh/aliases.zsh @@ -8,4 +8,48 @@ alias v='nvim' alias vi='nvim' alias vim='nvim' alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME' +alias tmux='tmux -f .config/tmux/.tmux.conf' + +# Rust CLI programs +if command -v exa > /dev/null; then + alias ls='exa -al --color=always --group-directories-first' # my preferred listing + alias la='exa -a --color=always --group-directories-first' # all files and dirs + alias ll='exa -l --color=always --group-directories-first' # long format + alias lt='exa -aT --color=always --group-directories-first' # tree listing + alias l.='exa -a | egrep "^\."' +else + echo "install exa" +fi + +if command -v bat > /dev/null; then + alias cat='bat' +else + echo "install bat" +fi + +if command -v rg > /dev/null; then + alias grep='rg' +else + echo "install ripgrep" +fi + +if command -v fd > /dev/null; then + alias find='fd' +else + echo "install fd" +fi + +if ! command -v tokei > /dev/null; then + echo "install tokei" +fi + +if command -v procs > /dev/null; then + alias ps='procs' +else + echo "install procs" +fi + +if ! command -v btm > /dev/null; then + echo "install bottom" +fi diff --git a/.config/zsh/exports.zsh b/.config/zsh/exports.zsh index ccfbd07..b62c515 100644 --- a/.config/zsh/exports.zsh +++ b/.config/zsh/exports.zsh @@ -3,14 +3,6 @@ CASE_SENSITIVE="true" zle_highlight=('paste:none') -# Which plugins would you like to load? -plugins=( - zsh-syntax-highlighting - zsh-autosuggestions - git - kubectl -) - autoload -U colors && colors # History in cache directory: diff --git a/.config/zsh/functions.zsh b/.config/zsh/functions.zsh index cca1d29..967a2d4 100644 --- a/.config/zsh/functions.zsh +++ b/.config/zsh/functions.zsh @@ -11,3 +11,19 @@ function zle-keymap-select { echo -ne '\e[5 q' fi } + + +# Prompt called purs +function zle-line-init zle-keymap-select { + PROMPT=`$HOME/purs/target/release/purs prompt -k "$KEYMAP" -r "$?" --venv "${${VIRTUAL_ENV:t}%-*}"` + zle reset-prompt +} +zle -N zle-line-init +zle -N zle-keymap-select + +autoload -Uz add-zsh-hook + +function _prompt_purs_precmd() { + /$HOME/purs/target/release/purs precmd +} +add-zsh-hook precmd _prompt_purs_precmd diff --git a/.config/zsh/fzf.zsh b/.config/zsh/fzf.zsh deleted file mode 100644 index b88c5ab..0000000 --- a/.config/zsh/fzf.zsh +++ /dev/null @@ -1,2 +0,0 @@ -source /usr/share/fzf/key-bindings.zsh -source /usr/share/fzf/completion.zsh diff --git a/.config/zsh/history.zsh b/.config/zsh/history.zsh deleted file mode 100644 index 2154040..0000000 --- a/.config/zsh/history.zsh +++ /dev/null @@ -1,2 +0,0 @@ -bindkey "^[[A" history-beginning-search-backward -bindkey "^[[B" history-beginning-search-forward diff --git a/.config/zsh/keybindings.zsh b/.config/zsh/keybindings.zsh index a436eb3..6565381 100644 --- a/.config/zsh/keybindings.zsh +++ b/.config/zsh/keybindings.zsh @@ -1 +1,6 @@ +# FZF search files bindkey "รง" fzf-cd-widget + +# Search history +bindkey "^[[A" history-beginning-search-backward +bindkey "^[[B" history-beginning-search-forward diff --git a/.config/zsh/antigen_pkgs.zsh b/.config/zsh/plugins.zsh index c2c335a..4bf7948 100644 --- a/.config/zsh/antigen_pkgs.zsh +++ b/.config/zsh/plugins.zsh @@ -1,8 +1,15 @@ +# FZF +source /usr/share/fzf/key-bindings.zsh +source /usr/share/fzf/completion.zsh + +# Antigen source $HOME/.config/zsh/antigen.zsh # Load Packages +antigen bundle tmux antigen bundle git antigen bundle pip +antigen bundle kubectl antigen bundle command-not-found antigen bundle zsh-users/zsh-syntax-highlighting antigen bundle zsh-users/zsh-history-substring-search ./zsh-history-substring-search.zsh diff --git a/.config/zsh/programs.zsh b/.config/zsh/programs.zsh deleted file mode 100644 index d8e827e..0000000 --- a/.config/zsh/programs.zsh +++ /dev/null @@ -1,42 +0,0 @@ -if command -v exa > /dev/null; then - alias ls='exa -al --color=always --group-directories-first' # my preferred listing - alias la='exa -a --color=always --group-directories-first' # all files and dirs - alias ll='exa -l --color=always --group-directories-first' # long format - alias lt='exa -aT --color=always --group-directories-first' # tree listing - alias l.='exa -a | egrep "^\."' -else - echo "install exa" -fi - -if command -v bat > /dev/null; then - alias cat='bat' -else - echo "install bat" -fi - -if command -v rg > /dev/null; then - alias grep='rg' -else - echo "install ripgrep" -fi - -if command -v fd > /dev/null; then - alias find='fd' -else - echo "install fd" -fi - -if ! command -v tokei > /dev/null; then - echo "install tokei" -fi - -if command -v procs > /dev/null; then - alias ps='procs' -else - echo "install procs" -fi - -if ! command -v btm > /dev/null; then - echo "install bottom" -fi - diff --git a/.config/zsh/purs.zsh b/.config/zsh/purs.zsh deleted file mode 100644 index ea2103a..0000000 --- a/.config/zsh/purs.zsh +++ /dev/null @@ -1,13 +0,0 @@ -function zle-line-init zle-keymap-select { - PROMPT=`$HOME/purs/target/release/purs prompt -k "$KEYMAP" -r "$?" --venv "${${VIRTUAL_ENV:t}%-*}"` - zle reset-prompt -} -zle -N zle-line-init -zle -N zle-keymap-select - -autoload -Uz add-zsh-hook - -function _prompt_purs_precmd() { - /$HOME/purs/target/release/purs precmd -} -add-zsh-hook precmd _prompt_purs_precmd @@ -1,14 +1,9 @@ # ZSH config -[ -f $HOME/.config/zsh/exports.zsh ] && source $HOME/.config/zsh/exports.zsh -[ -f $HOME/.config/zsh/prompt.zsh ] && source $HOME/.config/zsh/prompt.zsh [ -f $HOME/.config/zsh/aliases.zsh ] && source $HOME/.config/zsh/aliases.zsh +[ -f $HOME/.config/zsh/exports.zsh ] && source $HOME/.config/zsh/exports.zsh [ -f $HOME/.config/zsh/functions.zsh ] && source $HOME/.config/zsh/functions.zsh -[ -f $HOME/.config/zsh/purs.zsh ] && source $HOME/.config/zsh/purs.zsh -[ -f $HOME/.config/zsh/history.zsh ] && source $HOME/.config/zsh/history.zsh -[ -f $HOME/.config/zsh/antigen_pkgs.zsh ] && source $HOME/.config/zsh/antigen_pkgs.zsh [ -f $HOME/.config/zsh/keybindings.zsh ] && source $HOME/.config/zsh/keybindings.zsh -[ -f $HOME/.config/zsh/programs.zsh ] && source $HOME/.config/zsh/programs.zsh -[ -f $HOME/.config/zsh/fzf.zsh ] && source $HOME/.config/zsh/fzf.zsh +[ -f $HOME/.config/zsh/plugins.zsh ] && source $HOME/.config/zsh/plugins.zsh # Created by `pipx` on 2021-03-01 21:32:03 export PATH="$PATH:/home/aktersnurra/.local/bin" |