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.
if [ -d "$1" ]; then
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
elif exists exa; then
fifo_pager exa -G --colour=always 2>/dev/null
else
fifo_pager ls --color=always
fi

View file

@ -1,31 +1,16 @@
#!/usr/bin/env fish
# TODO: exa?
alias lk 'ls -lSr' # order by filesize reversed
alias lt 'ls -ltr' # order by file modified time
alias lc 'ls -ltcr' # order by filectime
alias lu 'ls -ltur' # order by file access time
alias ls 'ls -h --color --group-directories-first' # flat view w/ directories first
alias l 'ls -h --color --group-directories-first' # same as above
alias ll 'ls -lv --group-directories-first' # non-flat view
alias la 'll -A' # show all
alias ls 'exa --group-directories-first'
alias tree 'ls --tree --level=3'
alias lA 'ls -a'
alias ll 'ls -l'
alias la 'll -a'
alias lt 'll -t modified'
alias lT 'lt -r'
alias lc 'lt -t accessed'
alias lC 'lc -r'
# TODO: cat > bat
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."
function d -w cd --description "Quickly jump to NICE_HOME (or given relative or absolute path) and list files."
if scount $argv
cd $argv || exit 1
else
@ -34,7 +19,6 @@ function d -w cd --description "Quickly jump to NICE_HOME (or given dir) and sho
la
end
# navigation aliases
function c --description "Quickly jump to a subdirectory of NICE_HOME (or just to NICE_HOME if none given)"
if scount $argv
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)"
alias cd.. "d .."
alias cdd "d $DOTFILES_PATH" # go to dotfiles
alias cde "d $ENV_PATH" # go to env dotfiles
alias cdc "d $XDG_CONFIG_HOME" # go to ~/.config
alias cdd "d $DOTFILES_PATH"
alias cde "d $ENV_PATH"
alias cdc "d $XDG_CONFIG_HOME"
alias cdn "d $NOTES_PATH"
alias cdl "d $XDG_DOWNLOAD_DIR"
alias cdg "d $XDG_GAMES_DIR"
alias cdnx "d $DOTFILES_PATH/env/nix"
# quick parent-directory aliases
alias .. "d .."
alias ... "d ../.."
alias .... "d ../../.."
@ -65,31 +46,57 @@ 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
if scount $argv
git $argv
else
git status
end
if scount $argv; git $argv
else; git status; end
end
# docker aliases
alias dlf "docker 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"
# misc aliases
function pp
while not ping -n 1 -t 5 8.8.8.8
sleep 1
end
function chat
set -l pass (pass config/weechat-passphrase | head -n 1)
env WEECHAT_PASSPHRASE=$pass weechat
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 C "clear && tmux clear-history"
alias l "nnn"
alias C "clear; set -q TMUX && tmux clear-history"
alias sctl "sudo systemctl"
alias sctlu "systemctl --user"
# TODO: a vi-like tui for bluetooth would be great
alias bt "sctl start bluetooth && sudo bluetoothctl"
alias btctl "bt"
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 disks "lsblk && df -h"
alias dd "dd status=progress"
alias wifi "sudo nmtui"
alias svim "sudo -E nvim"
alias wifi "sudo iwctl"
alias year 'cal (date +%Y)'
alias mount 'sudo -E mount'
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` \
weechat `# IRC Client` \
aria2 `# Downloads Manager` \
tree `# Handy Filesystem Viewing Utility` \
dmenu `# Application Launcher` \
ripgrep `# Code Search Utilities` \
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
```
# Dependencies
+ `bat`
+ `fd`
+ `sd`
+ `fzf`
+ `fish`
+ `tmux`
+ `rsync`
+ `exa`
+ `nnn`
+ `nvim`
# To Do
+ Hibernation and proper automatic power controls