-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
142 lines (116 loc) · 3.47 KB
/
.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
HISTFILE=~/.histfile
HISTSIZE=60000
SAVEHIST=60000
setopt notify
setopt autocd
setopt extendedglob
setopt globdots # add .dot files to completion
#setopt rmstarsilent # do not ask for comfirmation to rm *
setopt HIST_IGNORE_DUPS # Ignore duplicate lines in History
bindkey -e
zstyle ':completion:*' completer _expand _complete _ignored
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle :compinstall filename '/home/yukigaru/.zshrc'
autoload -Uz compinit
compinit
bindkey "^[[1;5D" backward-word # Ctrl+Left
bindkey "^[[1;5C" forward-word # Ctrl+Right
setopt menucomplete
zstyle ':completion:*' menu select=1 _complete _ignored _approximate
# PROMPT SETUP
autoload -U colors && colors
# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable
zstyle ':vcs_info:git:*' formats 'on branch %b'
# Set up the prompt (with git branch name)
setopt PROMPT_SUBST
PROMPT=$'\n''%{$fg[blue]%}%n%{$reset_color%}@%{$fg[green]%}%m%{$reset_color%} %d> '
#RPROMPT=\$vcs_info_msg_0_
# ALIASES
mkdir-cd() {
if [ -z "$1" ]; then
echo 'Wrong arguments'
return 1
fi
mkdir -p $1
cd $1
}
cd-ls() {
cd $1 && ls -al --color=auto
}
alias c="cd-ls"
alias mkcd="mkdir-cd"
alias g="git"
alias vim="nvim"
alias v="nvim"
alias ll="ls -al --color=auto"
alias l="ll"
alias ranger='ranger --choosedir=$HOME/.rangerdir; LASTDIR=`cat $HOME/.rangerdir`; cd "$LASTDIR"'
alias r="ranger"
alias setclip="xclip -selection c" # using: echo "abc" | setclip
alias open="xdg-open"
alias sc="systemctl"
alias jc="journalctl"
alias sudo='sudo ' # so that all aliases above also expanded via `sudo cmd`
alias la='find -printf "%TY-%Tm-%Td %TT %p\n" | sort --numeric-sort --reverse | head -20' # top N last modified files, sorted
alias gs='g s'
alias gd='g d'
alias gl='g l'
alias ga='g a'
alias gc='g c'
alias gb='g b'
alias gp='g p'
alias gch='g ch'
alias gsh='g sh'
alias grb='g rb'
alias gfix='git add -u && git commit --fixup HEAD && GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash HEAD~~'
alias cont='--continue'
echo "Remember aliases:"
echo "jc - journalctl, sc - systemctl, c - cd, v - vim, mkcd, r - ranger"
echo "F2 - jump to a parent dir, Alt+D - delete until end of the line"
echo "g au - git add -u, g sta - git stash apply, g ds - diff --staged"
echo "la - top N last modified files, sorted"
echo "i3: mod+shift+S - screenshot with flameshot"
# Alt+Backspace
backward-kill-dir () {
local WORDCHARS=${WORDCHARS}/\/
zle backward-kill-word
}
zle -N backward-kill-dir
bindkey '^[^?' backward-kill-dir
# Alt+Left
backward-word-dir () {
local WORDCHARS=${WORDCHARS}/\/
zle backward-word
}
zle -N backward-word-dir
bindkey "^[[1;3C" forward-word-dir
# Alt+Right
forward-word-dir () {
local WORDCHARS=${WORDCHARS/\/}
zle forward-word
}
zle -N forward-word-dir
bindkey "^[[1;3D" backward-word-dir
# F2 - cd to the parent directory
cdparent() { cd .. ; pwd ; zle reset-prompt }
zle -N cdparent
bindkey "^[OQ" cdparent # F2
#
export PATH=~/.local/bin:${PATH}
source ~/.localvars
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
# load a zsh script specific to the hostname
if [[ -f "$HOME/env/$(hostname -s).zsh" ]]; then
source "$HOME/env/$(hostname -s).zsh"
fi
# load every script in local folder
mkdir -p ~/.zsh-local/
for config_file in ~/.zsh-local/*; do
echo "loading ${config_file}"
source ${config_file}
done