-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc_dotfiles
86 lines (68 loc) · 2.85 KB
/
.zshrc_dotfiles
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
# This file contains bash settings and aliases that are
# used by every PC I have. It is sourced by .zshrc so
# the original zshrc for each system stays in place.
export EDITOR=vim
# --no-ignore-vcs makes it ignore .gitignore
export FZF_DEFAULT_COMMAND='fd --type f'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
FZF_CTRL_R_OPTS=()
FZF_CTRL_R_OPTS+=(--height 20%)
# line editing like vim
set -o vi
# vim: automatically open multiple files in tabs
alias vim="vim -p"
alias nvim="nvim -p"
alias v="nvim -p"
# ls aliases
export CLICOLOR=1
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# git aliases
alias g='git'
# complete for 'g' as well as 'git'
# complete -o default -o nospace -F _git g
alias gs='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gc='git commit'
alias gl='git log --graph --full-history --branches --remotes --tags --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit'
alias gitsearch='git rev-list --all | xargs git grep -F'
# Pretty print json
alias json="python -mjson.tool"
function mcd() {
mkdir -p "$1" && cd "$1";
}
function undozip(){
unzip -l "$1" | awk 'BEGIN { OFS="" ; ORS="" } ; { for ( i=4; i<NF; i++ ) print $i " "; print $NF "\n" }' | xargs -I{} rm -r {}
}
# Uninstall old kernels
cleankernels() {
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get purge --yes
}
alias aptupgrade='sudo apt-get update && sudo apt-get upgrade --yes && sudo apt-get clean --yes'
alias reload='source $HOME/.zshrc 1>/dev/null'
alias myip='curl ip.appspot.com'
# Server current directory on localhost:8765
# Works for versions less than 3. Py3 is python "-m http.server 8765"
alias servethis="python -c 'import SimpleHTTPServer; SimpleHTTPServer.test()'"
if [ -f /proc/version ] && [ grep -q Microsoft /proc/version ]; then
# Fix everything being highlighted in light green (due to the group
# write bit being set or something like that)
export LS_COLORS=$(echo $LS_COLORS | sed "s/ow=34;42/ow=01;34/g")
fi
# Only works on OS X obviously
alias setJdk8='export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)'
alias setJdk9='export JAVA_HOME=$(/usr/libexec/java_home -v9)'
alias setJdk10='export JAVA_HOME=$(/usr/libexec/java_home -v10)'
alias setJdk11='export JAVA_HOME=$(/usr/libexec/java_home -v11)'
alias setJdk17='export JAVA_HOME=$(/usr/libexec/java_home -v17)'
# TODO figure out zsh version of shopt stuff
#shopt -s histappend # Set history file mode to append
# -a writes current/new lines to history file
# -c clears the history list (bash in memory concept)
# -r reads history file into the history list
# PROMPT_COMMAND="history -a;history -c;history -r;$PROMPT_COMMAND"
export HISTSIZE=100000 # big big history
export HISTFILESIZE=1000000
setopt HIST_FIND_NO_DUPS