summaryrefslogtreecommitdiffstats
path: root/zsh/zshrc
blob: 4790c77f101ff46d81bef0f03eca9399436129ce (plain) (blame)
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
# Editors

# export
export KEYTIMEOUT=10
export EDITOR=nvim
export VISUAL=nvim
export PAGER=cat
export MANPAGER="nvim +Man!"
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

setopt AUTO_CD
setopt AUTO_PUSHD
setopt PUSHD_IGNORE_DUPS
setopt PUSHD_SILENT
setopt EXTENDED_GLOB
setopt HIST_IGNORE_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt SHARE_HISTORY
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt PROMPT_SUBST

HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
PROMPT='%n :: %~ :: '

bindkey -v
bindkey '^F' autosuggest-accept
bindkey '^E' edit-command-line

autoload -Uz edit-command-line
autoload -Uz compinit
autoload -Uz vcs_info

zle -N edit-command-line

# alias
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."

alias ports="ss -tulpn"
alias mem="free -h"
alias cpu="lscpu | sed -n '1,12p'"
alias top="btop"

alias vim="nvim"
alias vi="nvim"

alias server="python -m http.server 8000"

alias ll="ls -hal"

alias checkpoint="git add . && git commit -m 'checkpoint' && git push"

alias attach="tmux attach-session -t"
alias new="tmux new-session -s"
alias list="tmux list-sessions"
alias ta="tmux attach"
alias tls="tmux list-sessions"

alias copypath="pwd | xsel --clipboard"
alias copy="xsel --clipboard"
alias t="todocli"
alias weather="curl wttr.in"
alias zshconfig="nvim ~/.zshrc"
alias reload="source ~/.zshrc"


# credits to luca
memleak() {
    while true
    do
        grep -E "VmRSS|VmSize|VmPeak" /proc/70409/status
        sleep 1
    done
}

# jump to the root of the project
groot() {
    local root=$(git rev-parse --show-toplevel 2>/dev/null)
    if [[ -n "$root" ]]; then
        cd "$root"
    else
        echo "Not in a git repository"
        return 1
    fi
}

if command -v fzf &> /dev/null; then
    source <(fzf --zsh)
fi