This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/fish/alias.fish

126 lines
2.9 KiB
Fish
Raw Normal View History

2020-11-28 18:25:23 +01:00
# {{@@ header() @@}}
# __ _ _
# / _(_)___| |__
# | |_| / __| '_ \
# | _| \__ \ | | |
# |_| |_|___/_| |_|
2021-02-13 15:22:05 +01:00
function cabbr
command -qs ( echo $argv[2] | cut -d' ' -f1 )
and abbr -g $argv; end
function calias
command -qs ( echo $argv[2] | cut -d' ' -f1 )
and alias $argv; end
abbr -g mpn ncmpcpp
abbr -g dot "dotdrop install -f"
cabbr p emerge
cabbr p pacman
cabbr p pikaur
cabbr p yay
cabbr p paru
2020-11-28 18:25:23 +01:00
################################################################
# Editor
################################################################
2021-02-13 15:22:05 +01:00
cabbr v {{@@ editor @@}}
2020-11-28 18:25:23 +01:00
2021-02-13 15:22:05 +01:00
cabbr rv sudo {{@@ editor @@}}
cabbr rv doas {{@@ editor @@}}
2020-11-28 18:25:23 +01:00
################################################################
# Safe guard for rm
################################################################
2021-02-13 15:22:05 +01:00
calias rm trash
abbr -g crm command rm -i
2020-11-28 18:25:23 +01:00
################################################################
# ls and cat
################################################################
2021-02-13 15:22:05 +01:00
calias ls 'exa --git'
calias cat 'bat'
2021-02-22 00:48:51 +01:00
calias ip 'ip --color=auto'
2020-11-28 18:25:23 +01:00
################################################################
2021-02-13 15:22:05 +01:00
# Chang Directory
2020-11-28 18:25:23 +01:00
################################################################
2021-02-13 15:22:05 +01:00
# The ever usefull "z" command
2020-11-28 18:25:23 +01:00
command -qs zoxide &&
zoxide init fish | source
2021-02-13 15:22:05 +01:00
for i in (seq 3 10)
set -l dots (string repeat -n $i .)
set -l segs (string repeat -n $i ./.)
alias $dots "cd $segs"
end
2020-11-28 18:25:23 +01:00
################################################################
# Show reminders on startup
################################################################
command -qs khard &&
function fish_greeting
command -qs khal
2020-11-28 18:25:23 +01:00
or return
set -l khalList (khal --color list now 10d --format " {title}")
test -n "$khalList"
or return
echo $khalList | strip-escape | string match -qr '^No events$'
2020-11-28 18:25:23 +01:00
and return
printf "%s\n" $khalList
2020-11-28 18:25:23 +01:00
end
################################################################
# Git
################################################################
2021-02-13 15:22:05 +01:00
abbr -g g 'git'
2021-04-16 06:49:10 +02:00
abbr -g ga 'git add'
2021-02-13 15:22:05 +01:00
abbr -g gs 'git status'
abbr -g gd 'git diff'
2021-02-21 05:21:13 +01:00
abbr -g gc 'git commit'
2021-03-23 15:58:08 +01:00
abbr -g gr 'cd (git root)'
2020-11-28 18:25:23 +01:00
################################################################
2021-02-13 15:22:05 +01:00
# open
2020-11-28 18:25:23 +01:00
################################################################
2021-02-13 15:22:05 +01:00
function open -w xdg-open
xdg-open $argv &> /dev/null & disown
2020-11-28 18:25:23 +01:00
end
2021-03-31 22:57:47 +02:00
################################################################
# man
################################################################
function man -w man
env COLUMNS=(math $COLUMNS - 2) man $argv
end
2020-11-28 18:25:23 +01:00
################################################################
# quickly edit dotfiles
################################################################
function edit-config
pushd "{{@@ parent_dir ( _dotdrop_dotpath ) @@}}"
2021-03-05 03:36:16 +01:00
set -l dotfile (fd -HE .git | wdmenu)
2021-02-13 18:24:20 +01:00
test -n "$dotfile" || return 1
2021-02-13 15:22:05 +01:00
{{@@ editor @@}} "$dotfile"
2020-11-28 18:25:23 +01:00
popd
end
2021-02-13 15:22:05 +01:00
abbr -g ec edit-config