-
Notifications
You must be signed in to change notification settings - Fork 2
/
.zshrc
106 lines (86 loc) · 3.17 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
# Update PATH
if [[ -z $TMUX ]]; then
export PATH="$PATH:$HOME/.scripts:$HOME/.rvm/bin:usr/local/opt/grep/libexec/gnubin:/home/linuxbrew/.linuxbrew/bin/"
# RVM
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
fi
if [[ "$HOST" == "laptocat"* ]]; then
export PATH=$PATH:/Users/maclarel/tools/
fi
# Path to your oh-my-zsh installation.
export ZSH=$(eval echo "~$USER/.oh-my-zsh")
# unset PAGER, set by ^
unset PAGER
# Disable the damn bell
unsetopt BEEP
# Set theme
ZSH_THEME="agnoster"
# Add plugins
plugins=(zsh-syntax-highlighting)
# Oh my ZSH goodies
source $ZSH/oh-my-zsh.sh
# User configuration
# Set EDITOR to nvim
export EDITOR="nvim"
# vi mode
bindkey -v
export KEYTIMEOUT=1
# Use vim keys in tab complete menu:
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
# Edit line in vim with ctrl-e:
autoload edit-command-line; zle -N edit-command-line
bindkey '^e' edit-command-line
# Reverse search
bindkey '^R' history-incremental-search-backward
# Enable colors and change prompt:
autoload -U colors && colors
export LS_COLORS="$LS_COLORS:ow=1;34:tw=1;34:"
# Aliases
alias flushdns='sudo killall -HUP mDNSResponder' # Flush DNS Cache
alias ll='ls -lAtr' # `ll` ala Linux
alias f='open -a Finder ./' # Open Finder at current directory
alias myip='curl http://ipecho.net/plain; echo' # Get Public IP
alias c='clear' # Clear terminal
alias v='nvim' # Saving keystrokes for vim
alias sv='sudo nvim' # See above
alias reload='source ~/.zshrc' # Reload dotfile
alias ytd="youtube-dl -f bestvideo+bestaudio " # youtube-dl best video/audio
alias ga='git add' # Save keystrokes for git
alias gac='git add -A && git commit -m'
alias pull='git pull'
alias push='git push'
alias gs='git status'
alias gc='git checkout'
alias gd='git diff'
alias updog='python3 -m http.server 9001' # Create webserver serving content from cwd
alias suspend='~/.scripts/scrlock.sh suspend'
alias copy='rsync -Phua'
alias phone="sudo aft-mtp-mount -o allow_other"
# File Management
extract () { # Extract basically all known formats
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}