Update shell configuration
This commit is contained in:
parent
565b9b3ea4
commit
50ebe825f1
@ -59,7 +59,8 @@ alias \
|
||||
scr='cd ~/.local/bin/scripts' \
|
||||
cfg='cd ~/.config/' \
|
||||
crn='cd ~/.local/bin/cron' \
|
||||
cd..='cd ..'
|
||||
cd..='cd ..' \
|
||||
,='cd ~'
|
||||
|
||||
alias copy='xclip -sel clip'
|
||||
|
||||
|
@ -1,40 +1,27 @@
|
||||
#
|
||||
# ██
|
||||
# ░██
|
||||
# ██████ ██████░██
|
||||
# ░░░░██ ██░░░░ ░██████
|
||||
# ██ ░░█████ ░██░░░██
|
||||
# ██ ░░░░░██░██ ░██
|
||||
# ██████ ██████ ░██ ░██
|
||||
# ░░░░░░ ░░░░░░ ░░ ░░
|
||||
|
||||
#~~~~~~~~~
|
||||
# General
|
||||
#~~~~~~~~~
|
||||
#!/bin/zsh
|
||||
# zsh directory
|
||||
ZDIR="${HOME}/.config/zsh"
|
||||
|
||||
# history
|
||||
SAVEHIST=9999999
|
||||
HISTFILE="${ZDIR}/history"
|
||||
|
||||
# imports
|
||||
source $HOME/.profile
|
||||
source $HOME/.config/shellrc
|
||||
source $ZDIR/bindings
|
||||
|
||||
# error message
|
||||
command_not_found_handler() {
|
||||
printf "\nahh shit, command not found\n\033[0;31m(╯°□°)╯︵ ┻━┻\n\n"
|
||||
printf "\nahh shit, command not found\n\033[0;31m(╯°□°)╯︵ ┻━┻\n\n"
|
||||
exit 127
|
||||
}
|
||||
|
||||
# prompt
|
||||
setopt prompt_subst
|
||||
setopt autocd
|
||||
PROMPT='%F{green}%m%f in %B%F{#299b9b}%~%f%b $(git_status)
|
||||
%f%b% {%B%F{red}%?%f%b}%F{#299b9b}%B>%b%f '
|
||||
setopt prompt_subst # allow commands to run after prompt
|
||||
setopt autocd
|
||||
|
||||
function git_status() {
|
||||
git_status() {
|
||||
ref=$(git symbolic-ref --quiet --short HEAD 2> /dev/null || git rev-parse --short HEAD 2> /dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -n "on %B%F{magenta}$ref"
|
||||
@ -50,34 +37,26 @@ setopt complete_aliases
|
||||
zstyle ':completion:*' completer _expand _complete _ignored
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
||||
|
||||
# setopt correct
|
||||
setopt correct
|
||||
zmodload zsh/complist
|
||||
compinit
|
||||
_comp_options+=(globdots)
|
||||
|
||||
#~~~~~~~~~~
|
||||
# Bindings
|
||||
#~~~~~~~~~~
|
||||
## edit line in vim with ctrl-e:
|
||||
autoload edit-command-line; zle -N edit-command-line
|
||||
bindkey -M vicmd '^e' edit-command-line
|
||||
bindkey '^e' edit-command-line
|
||||
|
||||
# vi mode
|
||||
bindkey -v
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# cursor change
|
||||
function zle-keymap-select {
|
||||
if [[ ${KEYMAP} == vicmd ]] ||
|
||||
[[ $1 = 'block' ]]; then
|
||||
if [[ ${KEYMAP} == vicmd ]] ||
|
||||
[[ $1 = 'block' ]]; then
|
||||
echo -ne '\e[2 q'
|
||||
elif [[ ${KEYMAP} == main ]] ||
|
||||
[[ ${KEYMAP} == viins ]] ||
|
||||
[[ ${KEYMAP} = '' ]] ||
|
||||
[[ $1 = 'beam' ]]; then
|
||||
[[ ${KEYMAP} == viins ]] ||
|
||||
[[ ${KEYMAP} = '' ]] ||
|
||||
[[ $1 = 'beam' ]]; then
|
||||
echo -ne '\e[6 q'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
zle -N zle-keymap-select
|
||||
@ -89,12 +68,7 @@ zle-line-init() {
|
||||
echo -ne '\e[6 q'
|
||||
preexec() { echo -ne '\e[6 q' ;}
|
||||
|
||||
# other
|
||||
bindkey '^x' clear-screen
|
||||
|
||||
#~~~~~~~~~
|
||||
# Plugins
|
||||
#~~~~~~~~~
|
||||
PDIR="${ZDIR}/plugins"
|
||||
|
||||
# zsh-autosuggestions
|
||||
|
21
.config/zsh/bindings
Normal file
21
.config/zsh/bindings
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/zsh
|
||||
# edit line in vim
|
||||
autoload edit-command-line; zle -N edit-command-line
|
||||
bindkey -M vicmd '^e' edit-command-line
|
||||
bindkey -M viins '^e' edit-command-line
|
||||
|
||||
# scr
|
||||
fscr_run() { fscr; zle redisplay; }
|
||||
zle -N fscr_run
|
||||
bindkey -M vicmd "^n" fscr_run
|
||||
bindkey -M viins "^n" fscr_run
|
||||
|
||||
# cfg
|
||||
fcfg_run() { fcfg; zle redisplay; }
|
||||
zle -N fcfg_run
|
||||
bindkey -M vicmd "^b" fcfg_run
|
||||
bindkey -M viins "^b" fcfg_run
|
||||
|
||||
# clear
|
||||
bindkey -M viins "^x" clear-screen
|
||||
bindkey -M vicmd "^x" clear-screen
|
Loading…
x
Reference in New Issue
Block a user