blob: ca38703a23b4117c822c09b480f0d81de0806c7a (
plain)
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
|
# Luke's config for the Zoomer Shell
#
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Enable colors and change prompt:
autoload -U colors && colors # Load colors
setopt prompt_subst
setopt autocd # Automatically cd into typed directory.
stty stop undef # Disable ctrl-s to freeze terminal.
setopt interactive_comments
autoload -U promptinit
promptinit
PROMPT="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]\$(parse_git_branch)%{$reset_color%} $%b "
# History in cache directory:
HISTSIZE=10000000
SAVEHIST=10000000
HISTFILE=~/.cache/zsh/history
# Load aliases and shortcuts if existent.
# [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
# [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
# vi mode
bindkey -v
export KEYTIMEOUT=1
# Change cursor shape for different vi modes.
function zle-keymap-select () {
case $KEYMAP in
vicmd) echo -ne '\e[1 q';; # block
viins|main) echo -ne '\e[5 q';; # beam
esac
}
zle -N zle-keymap-select
zle-line-init() {
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# Use lf to switch directories and bind it to ctrl-o
lfcd () {
tmp="$(mktemp)"
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp" >/dev/null
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
}
bindkey -s '^o' 'ranger_cd\n'
bindkey -s '^a' 'bc -lq\n'
bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n'
bindkey '^[[P' delete-char
# Edit line in vim with ctrl-e:
autoload edit-command-line; zle -N edit-command-line
bindkey '^e' edit-command-line
# Load syntax highlighting; should be last.
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null
alias books="cd $HOME/Documents/books"
alias calcurse="calcurse -D ~/.config/calcurse"
alias cdgo="cd $HOME/code/go/src/git.jacksontaylor.xyz"
alias code="cd $HOME/code"
alias dox="cd $HOME/Documents"
alias dl="cd $HOME/Downloads"
alias gs="git status"
alias jojo="cd $HOME/Documents/books/manga/jojos_bizarre_adventure"
alias ll="ls -lAh"
alias ls="ls -hA --color=auto --group-directories-first"
alias music-dl="youtube-dl -x --audio-format mp3 "
alias music_info="python3 -m music_tag --print"
# alias music="cd $HOME/Music"
alias pix="cd $HOME/Pictures"
alias ranger="ranger_cd"
alias site="cd ~/code/jacksontaylor.xyz"
alias up="cd ../"
alias vim="nvim"
alias vrc="vim ~/.config/nvim/init.vim"
alias wiki="nvim +VimwikiIndex"
alias diary="nvim +Diary"
alias xmpp="$TERMINAL -e profanity"
alias wisecow='clear && fortune | cowsay'
alias \
cp="cp -iv" \
mv="mv -iv" \
rm="rm -vI" \
bc="bc -ql" \
mkd="mkdir -pv" \
yt="youtube-dl --add-metadata -i" \
yta="yt -x -f bestaudio/best" \
ffmpeg="ffmpeg -hide_banner"
alias \
grep="grep --color=auto" \
diff="diff --color=auto" \
ccat="highlight --out-format=ansi"
source /usr/share/doc/mcfly/mcfly.zsh
# Function to cd to last open dir in ranger
ranger_cd() {
temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")"
ranger="${1:-ranger}"
if [ -n "$1" ]; then
shift
fi
"$ranger" --choosedir="$temp_file" -- "${@:-$PWD}"
return_value="$?"
if chosen_dir="$(cat -- "$temp_file")" && [ -n "$chosen_dir" ] && [ "$chosen_dir" != "$PWD" ]; then
cd -- "$chosen_dir"
fi
rm -f -- "$temp_file"
return "$return_value"
}
|