Update shell configuration

This commit is contained in:
Wiktor Zykubek 2020-05-26 19:49:00 +02:00
parent 565b9b3ea4
commit 50ebe825f1
3 changed files with 36 additions and 40 deletions

View File

@ -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'

View File

@ -1,26 +1,13 @@
#
# ██
# ░██
# ██████ ██████░██
# ░░░░██ ██░░░░ ░██████
# ██ ░░█████ ░██░░░██
# ██ ░░░░░██░██ ░██
# ██████ ██████ ░██ ░██
# ░░░░░░ ░░░░░░ ░░ ░░
#~~~~~~~~~
# 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() {
@ -29,12 +16,12 @@ command_not_found_handler() {
}
# 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,19 +37,11 @@ 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
@ -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
View 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