Update shell configuration
This commit is contained in:
parent
565b9b3ea4
commit
50ebe825f1
@ -59,7 +59,8 @@ alias \
|
|||||||
scr='cd ~/.local/bin/scripts' \
|
scr='cd ~/.local/bin/scripts' \
|
||||||
cfg='cd ~/.config/' \
|
cfg='cd ~/.config/' \
|
||||||
crn='cd ~/.local/bin/cron' \
|
crn='cd ~/.local/bin/cron' \
|
||||||
cd..='cd ..'
|
cd..='cd ..' \
|
||||||
|
,='cd ~'
|
||||||
|
|
||||||
alias copy='xclip -sel clip'
|
alias copy='xclip -sel clip'
|
||||||
|
|
||||||
|
@ -1,40 +1,27 @@
|
|||||||
#
|
#!/bin/zsh
|
||||||
# ██
|
|
||||||
# ░██
|
|
||||||
# ██████ ██████░██
|
|
||||||
# ░░░░██ ██░░░░ ░██████
|
|
||||||
# ██ ░░█████ ░██░░░██
|
|
||||||
# ██ ░░░░░██░██ ░██
|
|
||||||
# ██████ ██████ ░██ ░██
|
|
||||||
# ░░░░░░ ░░░░░░ ░░ ░░
|
|
||||||
|
|
||||||
#~~~~~~~~~
|
|
||||||
# General
|
|
||||||
#~~~~~~~~~
|
|
||||||
# zsh directory
|
# zsh directory
|
||||||
ZDIR="${HOME}/.config/zsh"
|
ZDIR="${HOME}/.config/zsh"
|
||||||
|
|
||||||
# history
|
|
||||||
SAVEHIST=9999999
|
SAVEHIST=9999999
|
||||||
HISTFILE="${ZDIR}/history"
|
HISTFILE="${ZDIR}/history"
|
||||||
|
|
||||||
# imports
|
|
||||||
source $HOME/.profile
|
source $HOME/.profile
|
||||||
source $HOME/.config/shellrc
|
source $HOME/.config/shellrc
|
||||||
|
source $ZDIR/bindings
|
||||||
|
|
||||||
# error message
|
# error message
|
||||||
command_not_found_handler() {
|
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
|
exit 127
|
||||||
}
|
}
|
||||||
|
|
||||||
# prompt
|
# prompt
|
||||||
setopt prompt_subst
|
|
||||||
setopt autocd
|
|
||||||
PROMPT='%F{green}%m%f in %B%F{#299b9b}%~%f%b $(git_status)
|
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 '
|
%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)
|
ref=$(git symbolic-ref --quiet --short HEAD 2> /dev/null || git rev-parse --short HEAD 2> /dev/null)
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo -n "on %B%F{magenta}$ref"
|
echo -n "on %B%F{magenta}$ref"
|
||||||
@ -50,34 +37,26 @@ setopt complete_aliases
|
|||||||
zstyle ':completion:*' completer _expand _complete _ignored
|
zstyle ':completion:*' completer _expand _complete _ignored
|
||||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
||||||
|
|
||||||
# setopt correct
|
setopt correct
|
||||||
zmodload zsh/complist
|
zmodload zsh/complist
|
||||||
compinit
|
compinit
|
||||||
_comp_options+=(globdots)
|
_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
|
# vi mode
|
||||||
bindkey -v
|
bindkey -v
|
||||||
export KEYTIMEOUT=1
|
export KEYTIMEOUT=1
|
||||||
|
|
||||||
# cursor change
|
# cursor change
|
||||||
function zle-keymap-select {
|
function zle-keymap-select {
|
||||||
if [[ ${KEYMAP} == vicmd ]] ||
|
if [[ ${KEYMAP} == vicmd ]] ||
|
||||||
[[ $1 = 'block' ]]; then
|
[[ $1 = 'block' ]]; then
|
||||||
echo -ne '\e[2 q'
|
echo -ne '\e[2 q'
|
||||||
elif [[ ${KEYMAP} == main ]] ||
|
elif [[ ${KEYMAP} == main ]] ||
|
||||||
[[ ${KEYMAP} == viins ]] ||
|
[[ ${KEYMAP} == viins ]] ||
|
||||||
[[ ${KEYMAP} = '' ]] ||
|
[[ ${KEYMAP} = '' ]] ||
|
||||||
[[ $1 = 'beam' ]]; then
|
[[ $1 = 'beam' ]]; then
|
||||||
echo -ne '\e[6 q'
|
echo -ne '\e[6 q'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
zle -N zle-keymap-select
|
zle -N zle-keymap-select
|
||||||
@ -89,12 +68,7 @@ zle-line-init() {
|
|||||||
echo -ne '\e[6 q'
|
echo -ne '\e[6 q'
|
||||||
preexec() { echo -ne '\e[6 q' ;}
|
preexec() { echo -ne '\e[6 q' ;}
|
||||||
|
|
||||||
# other
|
|
||||||
bindkey '^x' clear-screen
|
|
||||||
|
|
||||||
#~~~~~~~~~
|
|
||||||
# Plugins
|
# Plugins
|
||||||
#~~~~~~~~~
|
|
||||||
PDIR="${ZDIR}/plugins"
|
PDIR="${ZDIR}/plugins"
|
||||||
|
|
||||||
# zsh-autosuggestions
|
# 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