-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
104 lines (82 loc) · 2.69 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
#!/bin/bash
# vim: foldmethod=marker foldenable
# COLOR {{{1
autoload -U colors && colors
# COMPLETION {{{1
autoload -U compinit && compinit
setopt completeinword
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
setopt extendedglob
unsetopt caseglob
setopt auto_cd
# HISTORY {{{1
HISTSIZE=1000
HISTFILE=~/.history
SAVEHIST=1000
setopt SHARE_HISTORY
# ALIASES {{{1
# Shortcuts
alias npmls="npm ls --depth=0"
alias V="vim +V"
alias g="git"
alias gl="git log"
alias gs="git status"
# Better defaults
alias ghc="ghc -Wall -Werror"
alias vim="nvim" # Use `\vim` for true vim
alias less="less -FSRX"
# Rarely used
alias install-spacemacs="git clone --recursive https://github.com/syl20bnr/spacemacs ~/.emacs.d"
# FUNCTIONS {{{1
function rc {
case "$1" in
vim|vi|v ) $EDITOR ~/.vimrc ;;
neovim|nvim|n ) $EDITOR ~/.nvimrc ;;
zsh|z ) $EDITOR ~/.zshrc ;;
i3 ) $EDITOR ~/.i3/config ;;
xinit|xorg|x11|x) $EDITOR ~/.xinitrc ;;
bspwm|bs|b ) $EDITOR ~/.config/bspwm/bspwmrc ;;
sxhkd|sx|s ) $EDITOR ~/.config/sxhkd/sxhkdrc ;;
compton|comp|co ) $EDITOR ~/.compton.config ;;
fish|f ) $EDITOR ~/.config/fish/config.fish ;;
* ) echo "Not defined" ;;
esac
}
function mkcd() {
if [[ $1 = "" ]]; then
echo "Usage: mkcd <dir>";
else
mkdir -p $1
cd $1
fi
}
function foreground-current-job() { fg; }
zle -N foreground-current-job
bindkey -M emacs '^z' foreground-current-job
bindkey -M viins '^z' foreground-current-job
bindkey -M vicmd '^z' foreground-current-job
# ENVIRONMENT VARIABLES {{{1
export PATH=$HOME/.local/bin::$HOME/.cabal/bin:/usr/local/bin:$PATH
export EDITOR="nvim"
setopt PROMPT_SUBST
export NL=$'\n' # newline
# export PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg_no_bold[yellow]%}%1~ %{$reset_color%}% $ "
# export PROMPT="%{$fg_no_bold[yellow]%}%1~ %{$reset_color%}% λ "
export PROMPT="${NL}%F{yellow}%4~ %(!.%F{red}.%F{white}) %fλ "
export NVIM_TUI_ENABLE_CURSOR_SHAPE=1
# OS SPECIFIC {{{1
# Linux
if [[ "$(uname -s)" == "Linux" ]]; then
export PATH=$HOME/.npm/bin:$PATH
alias ls="/bin/ls -AFph --group-directories-first --color=always"
alias xload="xrdb -load ~/.Xresources"
fi
# Mac
if [[ "$(uname -s)" == "Darwin" ]]; then
alias ls="/bin/ls -AGFh"
alias ds-clean="sudo asepsisctl -v migratein"
alias cask="brew cask"
alias nvim="NVIM_TUI_ENABLE_TRUE_COLOR=1 nvim"
alias show-files="defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder"
alias hide-files="defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder"
fi