Integrate exa, fix nnn

This commit is contained in:
Daniel Flanagan 2020-12-17 10:12:21 -06:00
parent 1be1b65904
commit 3ecb925039
Signed by: lytedev
GPG Key ID: 5B2020A0F9921EF4
4 changed files with 70 additions and 76 deletions

View File

@ -70,10 +70,10 @@ preview_file () {
# Otherwise, falling back to the defaults. # Otherwise, falling back to the defaults.
if [ -d "$1" ]; then if [ -d "$1" ]; then
cd "$1" || return cd "$1" || return
if exists tree; then if exists exa; then
fifo_pager exa --tree --level 3 --colour=always 2>/dev/null
elif exists tree; then
fifo_pager tree -L 3 -F fifo_pager tree -L 3 -F
elif exists exa; then
fifo_pager exa -G --colour=always 2>/dev/null
else else
fifo_pager ls --color=always fifo_pager ls --color=always
fi fi

View File

@ -1,31 +1,16 @@
#!/usr/bin/env fish #!/usr/bin/env fish
# TODO: exa? alias ls 'exa --group-directories-first'
alias lk 'ls -lSr' # order by filesize reversed alias tree 'ls --tree --level=3'
alias lt 'ls -ltr' # order by file modified time alias lA 'ls -a'
alias lc 'ls -ltcr' # order by filectime alias ll 'ls -l'
alias lu 'ls -ltur' # order by file access time alias la 'll -a'
alias ls 'ls -h --color --group-directories-first' # flat view w/ directories first alias lt 'll -t modified'
alias l 'ls -h --color --group-directories-first' # same as above alias lT 'lt -r'
alias ll 'ls -lv --group-directories-first' # non-flat view alias lc 'lt -t accessed'
alias la 'll -A' # show all alias lC 'lc -r'
# TODO: cat > bat function d -w cd --description "Quickly jump to NICE_HOME (or given relative or absolute path) and list files."
alias tree 'tree -Csuh'
alias f fzf
alias t "tmux"
alias rcp 'rsync -r -ah --progress'
function r --wraps nnn --description 'support nnn quit and change directory'
set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
nnn -P p $argv
test -e $NNN_TMPFILE && source $NNN_TMPFILE && rm $NNN_TMPFILE
end
alias vltl "$EDITOR (ltl)"
alias cdltl "cd (ltld)"
function d -w cd --description "Quickly jump to NICE_HOME (or given dir) and show files."
if scount $argv if scount $argv
cd $argv || exit 1 cd $argv || exit 1
else else
@ -34,7 +19,6 @@ function d -w cd --description "Quickly jump to NICE_HOME (or given dir) and sho
la la
end end
# navigation aliases
function c --description "Quickly jump to a subdirectory of NICE_HOME (or just to NICE_HOME if none given)" function c --description "Quickly jump to a subdirectory of NICE_HOME (or just to NICE_HOME if none given)"
if scount $argv if scount $argv
cd $NICE_HOME && d $argv || exit 1 cd $NICE_HOME && d $argv || exit 1
@ -47,15 +31,12 @@ complete --command c -a \
"(pushd $NICE_HOME && fd . . --max-depth 1 --min-depth 1 -x ls -p && popd)" "(pushd $NICE_HOME && fd . . --max-depth 1 --min-depth 1 -x ls -p && popd)"
alias cd.. "d .." alias cd.. "d .."
alias cdd "d $DOTFILES_PATH" # go to dotfiles alias cdd "d $DOTFILES_PATH"
alias cde "d $ENV_PATH" # go to env dotfiles alias cde "d $ENV_PATH"
alias cdc "d $XDG_CONFIG_HOME" # go to ~/.config alias cdc "d $XDG_CONFIG_HOME"
alias cdn "d $NOTES_PATH" alias cdn "d $NOTES_PATH"
alias cdl "d $XDG_DOWNLOAD_DIR" alias cdl "d $XDG_DOWNLOAD_DIR"
alias cdg "d $XDG_GAMES_DIR" alias cdg "d $XDG_GAMES_DIR"
alias cdnx "d $DOTFILES_PATH/env/nix"
# quick parent-directory aliases
alias .. "d .." alias .. "d .."
alias ... "d ../.." alias ... "d ../.."
alias .... "d ../../.." alias .... "d ../../.."
@ -65,31 +46,57 @@ alias ....... "d ../../../../../.."
alias ........ "d ../../../../../../.." alias ........ "d ../../../../../../.."
alias ......... "d ../../../../../../../.." alias ......... "d ../../../../../../../.."
function r --wraps nnn --description 'Run nnn with support for jump-to-directory-on-exit via ^G'
# TODO: this would break with multiple nnn instances, right?
# probably need to mktemp instead
set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
nnn -P p $argv
test -e $NNN_TMPFILE && source $NNN_TMPFILE && rm $NNN_TMPFILE
end
alias l r
alias t "tmux"
alias rcp 'rsync -r -ah --progress'
alias cat bat
function g -w git function g -w git
if scount $argv if scount $argv; git $argv
git $argv else; git status; end
else
git status
end
end end
# docker aliases
alias dlf "docker logs --tail=500 -f" alias dlf "docker logs --tail=500 -f"
alias dclf "docker-compose logs --tail=500 -f" alias dclf "docker-compose logs --tail=500 -f"
alias ctop "docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock quay.io/vektorlab/ctop:latest" alias ctop "docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock quay.io/vektorlab/ctop:latest"
# misc aliases function chat
function pp set -l pass (pass config/weechat-passphrase | head -n 1)
while not ping -n 1 -t 5 8.8.8.8 env WEECHAT_PASSPHRASE=$pass weechat
sleep 1
end
end end
function rgl; rg --color always $argv | less -r; end
alias k "kubectl"
alias kg "k get"
alias rg "rg --text"
alias grep "rg"
alias gr "rg"
alias vim "$EDITOR"
alias vi "$EDITOR"
alias v "$EDITOR"
alias e "$EDITOR"
alias se "sudo -E $EDITOR"
alias svim "se"
alias vltl "$EDITOR (ltl)"
alias cdltl "cd (ltld)"
function pp; while not ping -n 1 -t 5 8.8.8.8; sleep 1; end; end
alias p "ping 8.8.8.8" alias p "ping 8.8.8.8"
alias C "clear && tmux clear-history" alias C "clear; set -q TMUX && tmux clear-history"
alias l "nnn"
alias sctl "sudo systemctl" alias sctl "sudo systemctl"
alias sctlu "systemctl --user" alias sctlu "systemctl --user"
# TODO: a vi-like tui for bluetooth would be great
alias bt "sctl start bluetooth && sudo bluetoothctl" alias bt "sctl start bluetooth && sudo bluetoothctl"
alias btctl "bt" alias btctl "bt"
alias resrc "source $XDG_CONFIG_HOME/fish/config.fish" alias resrc "source $XDG_CONFIG_HOME/fish/config.fish"
@ -97,32 +104,7 @@ alias sc "sc-im"
alias scs "sc-im $NOTES_PATH/_scratch.sc" alias scs "sc-im $NOTES_PATH/_scratch.sc"
alias disks "lsblk && df -h" alias disks "lsblk && df -h"
alias dd "dd status=progress" alias dd "dd status=progress"
alias wifi "sudo nmtui" alias wifi "sudo iwctl"
alias svim "sudo -E nvim"
alias year 'cal (date +%Y)' alias year 'cal (date +%Y)'
alias mount 'sudo -E mount' alias mount 'sudo -E mount'
alias pa pulsemixer alias pa pulsemixer
# weechat aliases
function chat
set -l pass (pass config/weechat-passphrase | head -n 1)
env WEECHAT_PASSPHRASE=$pass weechat
end
function rgl
# ripgrep | less
rg --color always $argv | less -r
end
# kubernetes aliases
alias k "kubectl"
alias kg "k get"
# grep aliases
alias rg "rg --text"
alias grep "rg"
alias vim nvim
alias vi nvim
alias v nvim

View File

@ -47,7 +47,6 @@ yay -Sy \
gammastep `# Redshift for Wayland` \ gammastep `# Redshift for Wayland` \
weechat `# IRC Client` \ weechat `# IRC Client` \
aria2 `# Downloads Manager` \ aria2 `# Downloads Manager` \
tree `# Handy Filesystem Viewing Utility` \
dmenu `# Application Launcher` \ dmenu `# Application Launcher` \
ripgrep `# Code Search Utilities` \ ripgrep `# Code Search Utilities` \
fd `# File Search` \ fd `# File Search` \

View File

@ -14,6 +14,19 @@ like.
curl -s -L https://git.lyte.dev/lytedev/dotfiles/raw/branch/master/bin/init-dotfiles | sh curl -s -L https://git.lyte.dev/lytedev/dotfiles/raw/branch/master/bin/init-dotfiles | sh
``` ```
# Dependencies
+ `bat`
+ `fd`
+ `sd`
+ `fzf`
+ `fish`
+ `tmux`
+ `rsync`
+ `exa`
+ `nnn`
+ `nvim`
# To Do # To Do
+ Hibernation and proper automatic power controls + Hibernation and proper automatic power controls