Add .config/fish/config.fish
Add .config/fish/functions/cd.fish Add .config/fish/functions/compress.fish Add .config/fish/functions/dcim.fish Add .config/fish/functions/decompress.fish Add .config/fish/functions/ff.fish Add .config/fish/functions/fish_greeting.fish Add .config/fish/functions/ls.fish Add .config/fish/functions/lsa.fish Add .config/fish/functions/lt.fish Add .config/fish/functions/lta.fish Add .config/fish/functions/open.fish Add .config/fish/functions/repo.fish Add .config/fish/user-dirs.fish
This commit is contained in:
parent
f80c45dc3e
commit
5b3b5d0730
14 changed files with 114 additions and 0 deletions
47
private_dot_config/fish/config.fish
Normal file
47
private_dot_config/fish/config.fish
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
set -x PATH $HOME/.local/bin $PATH
|
||||||
|
set -x PATH $HOME/.cargo/bin $PATH
|
||||||
|
|
||||||
|
if status is-interactive
|
||||||
|
if test -z "$TMUX"
|
||||||
|
if type -q tmux
|
||||||
|
tmux attach-session -t default 2>/dev/null; or tmux new-session -s default
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if type -q starship
|
||||||
|
starship init fish | source
|
||||||
|
end
|
||||||
|
|
||||||
|
if type -q zoxide
|
||||||
|
zoxide init fish | source
|
||||||
|
end
|
||||||
|
|
||||||
|
set -x BAT_THEME ansi
|
||||||
|
|
||||||
|
if test -f "$HOME/.config/fish/user-dirs.fish"
|
||||||
|
source "$HOME/.config/fish/user-dirs.fish"
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -d "$HOME/.config/fish/"
|
||||||
|
alias fishconf="cd $HOME/.config/fish"
|
||||||
|
end
|
||||||
|
|
||||||
|
alias dcim="cd ~/dcim"
|
||||||
|
alias docs="cd $XDG_DOCUMENTS_DIR; or cd ~/Documents"
|
||||||
|
alias notes="cd $XDG_DOCUMENTS_DIR/lib; or cd ~/Documents/lib; ls"
|
||||||
|
alias dl="cd $XDG_DOWNLOAD_DIR; or cd ~/Downloads"
|
||||||
|
alias dt="cd $XDG_DESKTOP_DIR; or cd ~/Desktop"
|
||||||
|
alias music="cd $XDG_MUSIC_DIR; or cd ~/Music"
|
||||||
|
alias pics="cd $XDG_PICTURES_DIR; or cd ~/Pictures"
|
||||||
|
alias vids="cd $XDG_VIDEOS_DIR; or cd ~/Videos"
|
||||||
|
|
||||||
|
abbr -a -- .. 'cd ..'
|
||||||
|
abbr -a -- ... 'cd ../..'
|
||||||
|
abbr -a -- .... 'cd ../../..'
|
||||||
|
abbr -a -- ..... 'cd ../../../..'
|
||||||
|
|
||||||
|
function last_history_item
|
||||||
|
echo $history[1]
|
||||||
|
end
|
||||||
|
abbr -a !! --position anywhere --function last_history_item
|
||||||
12
private_dot_config/fish/functions/cd.fish
Normal file
12
private_dot_config/fish/functions/cd.fish
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
function cd
|
||||||
|
if test (count $argv) -eq 0
|
||||||
|
builtin cd ~
|
||||||
|
else if test -d $argv[1]
|
||||||
|
builtin cd $argv[1]
|
||||||
|
else
|
||||||
|
z $argv
|
||||||
|
and printf "\U000F17A9 "
|
||||||
|
pwd
|
||||||
|
or echo "Error: Directory not found"
|
||||||
|
end
|
||||||
|
end
|
||||||
3
private_dot_config/fish/functions/compress.fish
Normal file
3
private_dot_config/fish/functions/compress.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function compress
|
||||||
|
tar -cfz "$argv[1].tar.gz" "$argv[1]";
|
||||||
|
end
|
||||||
9
private_dot_config/fish/functions/dcim.fish
Normal file
9
private_dot_config/fish/functions/dcim.fish
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
function dcim
|
||||||
|
if test -d $XDG_DCIM_DIR
|
||||||
|
cd $XDG_DCIM_DIR
|
||||||
|
else if test -d ~/dcim
|
||||||
|
cd ~/dcim
|
||||||
|
else
|
||||||
|
echo "no dcim dir found"
|
||||||
|
end
|
||||||
|
end
|
||||||
3
private_dot_config/fish/functions/decompress.fish
Normal file
3
private_dot_config/fish/functions/decompress.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function decompress --wraps='tar -xzf' --description 'alias decompress=tar -xzf'
|
||||||
|
tar -xzf $argv
|
||||||
|
end
|
||||||
3
private_dot_config/fish/functions/ff.fish
Normal file
3
private_dot_config/fish/functions/ff.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function ff --wraps="fzf --preview 'bat --style=numbers --color=always {}'" --wraps="fzf --preview 'bat --style=numbers --color=always{}'" --description "alias ff=fzf --preview 'bat --style=numbers --color=always {}'"
|
||||||
|
fzf --preview 'bat --style=numbers --color=always {}' $argv
|
||||||
|
end
|
||||||
3
private_dot_config/fish/functions/fish_greeting.fish
Normal file
3
private_dot_config/fish/functions/fish_greeting.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function fish_greeting
|
||||||
|
echo "fsh🐟";
|
||||||
|
end
|
||||||
3
private_dot_config/fish/functions/ls.fish
Normal file
3
private_dot_config/fish/functions/ls.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function ls --wraps='eza -lh --group-directories-first --icons=auto --git' --description 'alias ls=eza -lh --group-directories-first --icons=auto --git'
|
||||||
|
eza -lh --group-directories-first --icons=auto --git $argv
|
||||||
|
end
|
||||||
3
private_dot_config/fish/functions/lsa.fish
Normal file
3
private_dot_config/fish/functions/lsa.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function lsa --wraps='ls -a' --description 'alias lsa=ls -a'
|
||||||
|
ls -a $argv
|
||||||
|
end
|
||||||
3
private_dot_config/fish/functions/lt.fish
Normal file
3
private_dot_config/fish/functions/lt.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function lt --wraps='eza --tree --level=2 --long --icons --git' --description 'alias lt=eza --tree --level=2 --long --icons --git'
|
||||||
|
eza --tree --level=2 --long --icons --git $argv
|
||||||
|
end
|
||||||
3
private_dot_config/fish/functions/lta.fish
Normal file
3
private_dot_config/fish/functions/lta.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function lta --wraps='lt -a' --description 'alias lta=lt -a'
|
||||||
|
lt -a $argv
|
||||||
|
end
|
||||||
3
private_dot_config/fish/functions/open.fish
Normal file
3
private_dot_config/fish/functions/open.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function open
|
||||||
|
xdg-open $argv >/dev/null 2>&1 &;
|
||||||
|
end
|
||||||
11
private_dot_config/fish/functions/repo.fish
Normal file
11
private_dot_config/fish/functions/repo.fish
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
function repo
|
||||||
|
if test (count $argv) -ge 1
|
||||||
|
set SRC_DIRECTORY $argv[1]
|
||||||
|
else
|
||||||
|
set SRC_DIRECTORY $HOME/src
|
||||||
|
end
|
||||||
|
set repo (find $SRC_DIRECTORY -mindepth 1 -maxdepth 3 -type d -exec test -d "{}/.git" \; -print \
|
||||||
|
| fzf --preview "bash -c '[ -f {}/README.md ] && bat --style=plain --color=always {}/README.md || echo \"No README\"; echo; git -C {} status --short --branch'" --preview-window=up:60%)
|
||||||
|
or return
|
||||||
|
cd $repo
|
||||||
|
end
|
||||||
8
private_dot_config/fish/user-dirs.fish
Normal file
8
private_dot_config/fish/user-dirs.fish
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
set -Ux XDG_DESKTOP_DIR "$HOME/desktop"
|
||||||
|
set -Ux XDG_DOWNLOAD_DIR "$HOME/downloads"
|
||||||
|
set -Ux XDG_TEMPLATES_DIR "$HOME/dcim/templates"
|
||||||
|
set -Ux XDG_PUBLICSHARE_DIR "$HOME/dcim/public"
|
||||||
|
set -Ux XDG_DOCUMENTS_DIR "$HOME/dcim/documents"
|
||||||
|
set -Ux XDG_MUSIC_DIR "$HOME/dcim/music"
|
||||||
|
set -Ux XDG_PICTURES_DIR "$HOME/dcim/pictures"
|
||||||
|
set -Ux XDG_VIDEOS_DIR "$HOME/dcim/videos"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue