-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_bash_aliases.tmpl
91 lines (81 loc) · 2.36 KB
/
dot_bash_aliases.tmpl
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
# pwsh-like aliases
alias cls=clear
alias where=which
{{- if .wsl }}
alias explorer=explorer.exe
alias notepad=notepad.exe
alias pwsh=pwsh.exe
alias neovide='neovide.exe'
alias sumatra='sumatrapdf.exe'
alias sumatrapdf='sumatrapdf.exe'
{{- end }}
# Shorten aliases, convenient aliases
alias lgit=lazygit
alias what='type -a'
alias wtf='type -a'
alias nmutt=neomutt
alias mail=neomutt
alias la='ls -A' # Include hidden files
alias ll='ls -AlF'
{{- if .wsl }}
alias np=notepad
alias exp=explorer
alias gvim='neovide --wsl'
{{- end }}
{{- if .linux }}
alias gvim='neovide'
# Neovim profiles
alias lvim="NVIM_APPNAME=nvim-lazy nvim"
alias chad="NVIM_APPNAME=nvchad nvim"
alias kvim="NVIM_APPNAME=nvim-kickstart nvim"
{{- end }}
alias path='echo -e ${PATH//:/\\n}' # Print path in newline each
alias cz=chezmoi
if [ -x "$(command -v batman)" ]; then
alias man=batman
fi
alias cht=cht.sh
alias sci='nircmd.exe clipboard saveimage'
# dotfiles manage
# alias cfg='git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
alias cfg='chezmoi managed -p absolute -i files | fzf --preview="bat --color=always {}" | xargs -r ${EDITOR:-nvim}'
# Open Nvim and enter Neotree
ntree() {
nvim -c "Neotree position=current"
}
# cd on exit
cdi() {
# `command` is needed in case `lfcd` is aliased to `lf`
cd "$(command lf -print-last-dir "$@")"
}
y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
yazi "$@" --cwd-file="$tmp"
if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
builtin cd -- "$cwd"
fi
rm -f -- "$tmp"
}
# bat help
alias bathelp='bat --plain --language=help'
help() {
"$@" --help 2>&1 | bathelp
}
# Add an "alert" alias for long running commands (Useless in WSL)
# Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# enable color support of ls and also add handy aliases
if [ -x "$(command -v dircolors)" ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
if [ -x "$(command -v eza)" ]; then
alias ls='eza --icons -1 --hyperlink --time-style relative'
else
alias ls='ls --color=auto -1'
fi
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi