Cleanup
This commit is contained in:
parent
c6b19fcbb4
commit
6b374f6278
9
common/bash/rc
Normal file
9
common/bash/rc
Normal file
|
@ -0,0 +1,9 @@
|
|||
# return if not running interactively
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
command -v fish >/dev/null 2>&1 && grep fish /etc/shells >/dev/null 2>&1 && {
|
||||
echo "This user is configured to use 'fish' as its primary shell."
|
||||
echo " You may want to run 'chsh' and set your shell to $(grep fish /etc/shells | head -n1)'."
|
||||
echo " You may also temporarily use fish by simply running 'fish'."
|
||||
echo " If you're in bash for intentionally for some reason, then ignore this message."
|
||||
}
|
7
common/bin/arch-in-docker
Executable file
7
common/bin/arch-in-docker
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
if test (count $argv) -lt 2
|
||||
docker run -it --rm archlinux bash
|
||||
else
|
||||
docker run -it --rm $argv[1..-2] archlinux $argv[-1]
|
||||
end
|
8
common/bin/dotfiles-clone-and-setup
Normal file
8
common/bin/dotfiles-clone-and-setup
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
command -v git >/dev/null 2>&1 || { echo "git not installed"; exit 1; }
|
||||
command -v fish >/dev/null 2>&1 || { echo "fish not installed"; exit 2; }
|
||||
|
||||
mkdir -p "$HOME/.config"
|
||||
git clone https://git.lyte.dev/lytedev/dotfiles.git "$HOME/.config/lytedev-dotfiles"
|
||||
exec "$HOME/.config/lytedev-dotfiles/common/bin/dotfiles-setup"
|
|
@ -7,8 +7,8 @@ set dfp (realpath (dirname (status -f))/../..)
|
|||
set lock_file $HOME/.using-lytedev-dotfiles.lock
|
||||
|
||||
if not test -f $lock_file
|
||||
echo This will delete existing files. Make sure you know what you\'re doing.
|
||||
printf 'Are you sure you want to continue? [y/N] '
|
||||
echo "This will delete existing files. Make sure you know what you're doing."
|
||||
echo 'Are you sure you want to continue? [y/N]'
|
||||
read response
|
||||
set response (string lower $response)
|
||||
if string match $response y
|
||||
|
@ -38,6 +38,7 @@ end
|
|||
pushd $dfp
|
||||
l common/tmux/conf $h/.tmux.conf
|
||||
l common/fish $c/fish
|
||||
l common/bash/rc $h/.bashrc
|
||||
l common/neovim $c/nvim
|
||||
l common/wezterm $c/wezterm
|
||||
l common/colors/vim $c/nvim/colors/base16-donokai.vim
|
||||
|
@ -59,6 +60,6 @@ for s in $c/lytedev-env/*/dotfiles-setup.d.fish
|
|||
end
|
||||
|
||||
# execute the user's shell
|
||||
set ush (getent passwd $LOGNAME | cut -d: -f7)
|
||||
set ush (getent passwd (whoami) | cut -d: -f7)
|
||||
echo "Dotfiles Installed! Don't forget to setup environments!"
|
||||
exec $ush
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
krita "$(ltl "$NICE_HOME/img/scrots/")"
|
||||
#!/usr/bin/env sh
|
||||
opener="$(command -v xdg-open 2>&1 >/dev/null && echo "xdg-open" || echo "open")"
|
||||
exec nohup "$opener" "$NICE_HOME/img/scrots/$(ls -t "$NICE_HOME/img/scrots/" | head -n1)" >/dev/null 2>&1 &
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
# Echoes the newest file in the specified directory (or current directory if none is given)
|
||||
|
||||
set d $argv[1] .
|
||||
set -l l ""
|
||||
for f in $d[1]/*
|
||||
if test -z $l; set l $f; continue; end
|
||||
if command test $f -nt $l; and test ! -d $f
|
||||
set l $f
|
||||
end
|
||||
end
|
||||
echo $l
|
|
@ -1,13 +0,0 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
# Echoes the newest subdirectory in the specified directory (or current directory if none is given)
|
||||
|
||||
set d $argv[1] .
|
||||
set -l l ""
|
||||
for f in $d[1]/*
|
||||
if test -z $l; set l $f; continue; end
|
||||
if command test $f -nt $l; and test -d $f
|
||||
set l $f
|
||||
end
|
||||
end
|
||||
echo $l
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
# Silent count
|
||||
|
||||
count $argv > /dev/null
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
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 -s modified'
|
||||
alias lT 'lt -r'
|
||||
alias lc 'lt -s accessed'
|
||||
alias lC 'lc -r'
|
||||
|
||||
set -gx CDPATH $CDPATH . $NICE_HOME
|
||||
|
||||
function d -w cd --description "Quickly jump to NICE_HOME (or given relative or absolute path) and list files."
|
||||
if scount $argv
|
||||
cd $argv
|
||||
else
|
||||
cd $NICE_HOME
|
||||
end
|
||||
la
|
||||
end
|
||||
|
||||
function c -w cd --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
|
||||
else
|
||||
d $NICE_HOME
|
||||
end
|
||||
end
|
||||
|
||||
alias cd.. "d .."
|
||||
alias cdd "d $DOTFILES_PATH"
|
||||
alias cde "d $XDG_CONFIG_HOME/lytedev-env"
|
||||
alias cdc "d $XDG_CONFIG_HOME"
|
||||
alias cdn "d $NOTES_PATH"
|
||||
alias cdl "d $XDG_DOWNLOAD_DIR"
|
||||
alias cdg "d $XDG_GAMES_DIR"
|
||||
alias .. "d .."
|
||||
alias ... "d ../.."
|
||||
alias .... "d ../../.."
|
||||
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
|
||||
if scount $argv; git $argv
|
||||
else; git status; end
|
||||
end
|
||||
|
||||
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"
|
||||
|
||||
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 sv "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; set -q TMUX && tmux clear-history || true"
|
||||
alias sctl "sudo systemctl"
|
||||
alias sctlu "systemctl --user"
|
||||
alias bt "sctl start bluetooth && sudo bluetoothctl"
|
||||
alias btctl "bt"
|
||||
alias resrc "source $XDG_CONFIG_HOME/fish/config.fish; fish_user_key_bindings"
|
||||
alias scs "sc $NOTES_PATH/_scratch.sc"
|
||||
alias disks "lsblk && df -h"
|
||||
alias dd "dd status=progress"
|
||||
alias wifi "sudo iwctl"
|
||||
alias year 'cal (date +%Y)'
|
||||
alias mount 'sudo -E mount'
|
||||
alias umount 'sudo -E umount'
|
||||
alias pa pulsemixer
|
||||
alias mail neomutt
|
||||
alias wje work-journal-entry
|
||||
alias miex 'iex -S mix'
|
11
common/fish/colors.fish
Executable file → Normal file
11
common/fish/colors.fish
Executable file → Normal file
|
@ -1,13 +1,3 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
# TODO: once, I could set backgrounds
|
||||
|
||||
# unused since we handle it ourselves in fish_prompt
|
||||
set -U fish_color_cwd magenta
|
||||
set -U fish_color_cwd_root red
|
||||
set -U fish_color_host normal
|
||||
set -U fish_color_user blue
|
||||
|
||||
set -U fish_color_normal normal # default color
|
||||
set -U fish_color_command white # base command being run (>ls< -la)
|
||||
set -U fish_color_param white # command's parameters
|
||||
|
@ -25,7 +15,6 @@ set -U fish_color_selection blue # vi mode visual selection (only fg)
|
|||
set -U fish_color_valid_path yellow # if an argument is a valid path (only -u?)
|
||||
set -U fish_color_comment 666 brblack # comments like this one!
|
||||
|
||||
# pager shown when completing
|
||||
set -U fish_pager_color_completion white # main color for pager
|
||||
set -U fish_pager_color_description magenta # color for meta description
|
||||
set -U fish_pager_color_prefix blue # the string being completed
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
set -Ux XDG_CONFIG_HOME $HOME/.config
|
||||
set -Ux DOTFILES_PATH $XDG_CONFIG_HOME/lytedev-dotfiles
|
||||
set -Ux ENV_PATH $XDG_CONFIG_HOME/lytedev-env
|
||||
set -Ux FISH_PATH $XDG_CONFIG_HOME/fish
|
||||
|
||||
source $FISH_PATH/paths.fish
|
||||
source (dirname (status --current-filename))/paths.fish
|
||||
|
||||
for s in $ENV_PATH/*/config.d.fish
|
||||
source $s (dirname $s)
|
||||
|
@ -13,32 +6,10 @@ end
|
|||
|
||||
status --is-interactive || exit
|
||||
|
||||
for f in key-bindings colors prompt aliases
|
||||
for f in vars colors prompt functions key-bindings
|
||||
source $FISH_PATH/$f.fish
|
||||
end
|
||||
|
||||
has_command nnn && source $DOTFILES_PATH/common/nnn/config.fish
|
||||
|
||||
set -Ux _JAVA_AWT_WM_NONREPARENTING 1
|
||||
set -Ux TERMINAL kitty
|
||||
set -Ux BROWSER firefox-nightly
|
||||
set -Ux ERL_AFLAGS "-kernel shell_history enabled -kernel shell_history_file_bytes 1024000" # iex history
|
||||
set -Ux LESS "-r"
|
||||
set -Ux LS_COLORS 'ow=01;36;40' # more sane ls colors
|
||||
set -Ux EXA_COLORS '*=0'
|
||||
set -Ux EDITOR nvim
|
||||
set -Ux VISUAL nvim
|
||||
set -Ux PAGER less
|
||||
set -Ux MANPAGER 'env MANWIDTH="" nvim --cmd "let g:prosession_on_startup=0" +Man!'
|
||||
|
||||
function fish_greeting;
|
||||
set_color -b black brblack
|
||||
printf "%s@%s %s\n" $USER (hostname) (date)
|
||||
printf "%6d processes running\n" (ps -aux | wc -l)
|
||||
has_command free && printf "%6sGB memory available\n" (free -g | grep '^Mem:' | tr -s ' ' | cut -d ' ' -f7)
|
||||
test -f /proc/sys/kernel/pty/nr && printf "%6d PTYs open\n" (cat /proc/sys/kernel/pty/nr)
|
||||
end
|
||||
|
||||
if has_command brew && test -f (brew --prefix asdf)/lib/asdf.fish
|
||||
set -Ux ASDF_DIR (brew --prefix asdf)
|
||||
source (brew --prefix asdf)/lib/asdf.fish
|
||||
|
@ -48,12 +19,4 @@ else if test -f /opt/asdf-vm/asdf.fish
|
|||
source /opt/asdf-vm/asdf.fish
|
||||
end
|
||||
|
||||
# assume the user uses "$HOME" to just store their mess of dotfiles and other
|
||||
# nonsense that clutters it up and that they have a preferred starting
|
||||
# directory where they keep the stuff they actually care about
|
||||
# we only do this if the user is opening a shell at $HOME
|
||||
if test $PWD = $HOME; or test $PWD = $NICE_HOME;
|
||||
cd $NICE_HOME || cd
|
||||
end
|
||||
|
||||
# test -f '/home/daniel/.home/.config/netlify/helper/path.fish.inc' && source '/home/daniel/.home/.config/netlify/helper/path.fish.inc'
|
||||
test $PWD = $HOME && begin; cd $NICE_HOME || cd; end
|
||||
|
|
164
common/fish/functions.fish
Normal file
164
common/fish/functions.fish
Normal file
|
@ -0,0 +1,164 @@
|
|||
function has_command --wraps=command --description "Exits non-zero if the given command cannot be found"
|
||||
command --quiet --search $argv[1]
|
||||
end
|
||||
|
||||
if has_command exa
|
||||
alias ls 'exa --group-directories-first'
|
||||
alias tree 'ls --tree --level=3'
|
||||
alias lt 'll --sort=modified'
|
||||
alias lc 'lt --sort=accessed'
|
||||
alias lT 'lt --reverse'
|
||||
alias lC 'lc --reverse'
|
||||
end
|
||||
|
||||
alias lA 'ls --all'
|
||||
alias ll 'ls -l'
|
||||
alias la 'll --all'
|
||||
|
||||
function scount --wraps=count --description "Silent count exits with a non-zero status if no arguments given to count"
|
||||
count $argv > /dev/null
|
||||
end
|
||||
|
||||
function d --wraps=cd --description "Quickly jump to NICE_HOME (or given relative or absolute path) and list files."
|
||||
if scount $argv
|
||||
cd $argv
|
||||
else
|
||||
cd $NICE_HOME
|
||||
end
|
||||
la
|
||||
end
|
||||
|
||||
function c --wraps=cd --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
|
||||
else
|
||||
d $NICE_HOME
|
||||
end
|
||||
end
|
||||
|
||||
alias cd.. "d .."
|
||||
alias cdd "d $DOTFILES_PATH"
|
||||
alias cde "d $XDG_CONFIG_HOME/lytedev-env"
|
||||
alias cdc "d $XDG_CONFIG_HOME"
|
||||
alias cdn "d $NOTES_PATH"
|
||||
alias cdl "d $XDG_DOWNLOAD_DIR"
|
||||
alias cdg "d $XDG_GAMES_DIR"
|
||||
alias .. "d .."
|
||||
alias ... "d ../.."
|
||||
alias .... "d ../../.."
|
||||
alias ..... "d ../../../.."
|
||||
alias ...... "d ../../../../.."
|
||||
alias ....... "d ../../../../../.."
|
||||
alias ........ "d ../../../../../../.."
|
||||
alias ......... "d ../../../../../../../.."
|
||||
|
||||
if has_command nnn
|
||||
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
|
||||
end
|
||||
|
||||
has_command tmux && alias t "tmux"
|
||||
has_command rsync && alias rcp 'rsync -r -ah --progress'
|
||||
has_command bat && alias cat bat
|
||||
|
||||
if has_command git
|
||||
function g -w git
|
||||
if scount $argv; git $argv
|
||||
else; git status; end
|
||||
end
|
||||
end
|
||||
|
||||
if has_command docker
|
||||
alias dlf "docker logs --tail=500 -f"
|
||||
alias ctop "docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock quay.io/vektorlab/ctop:latest"
|
||||
end
|
||||
|
||||
if has_command docker-compose
|
||||
alias dclf "docker-compose logs --tail=500 -f"
|
||||
end
|
||||
|
||||
if has_command weechat
|
||||
function chat
|
||||
set -l pass (pass config/weechat-passphrase | head -n 1)
|
||||
env WEECHAT_PASSPHRASE=$pass weechat
|
||||
end
|
||||
end
|
||||
|
||||
if has_command rg
|
||||
function rgl; rg --color always $argv | less -r; end
|
||||
alias rg "rg --text"
|
||||
alias grep "rg"
|
||||
alias gr "rg"
|
||||
end
|
||||
|
||||
if has_command kubectl
|
||||
alias k "kubectl"
|
||||
alias kg "k get"
|
||||
end
|
||||
|
||||
alias vim $EDITOR
|
||||
alias vi $EDITOR
|
||||
alias v $EDITOR
|
||||
alias e $EDITOR
|
||||
alias sv "sudo -E $EDITOR"
|
||||
alias se sv
|
||||
alias svim sv
|
||||
|
||||
function ltl --wraps=ls --description "Echoes the name of the file most recently modified either in the current directory or in the given path"
|
||||
set d $argv[1] .
|
||||
set -l l ""
|
||||
for f in $d[1]/*
|
||||
if test -z $l; set l $f; continue; end
|
||||
if command test $f -nt $l; and test ! -d $f
|
||||
set l $f
|
||||
end
|
||||
end
|
||||
echo $l
|
||||
end
|
||||
|
||||
function ltld --wraps=ls --description "Echoes the name of the directory most recently modified either in the current directory or in the given path"
|
||||
set d $argv[1] .
|
||||
set -l l ""
|
||||
for f in $d[1]/*
|
||||
if test -z $l; set l $f; continue; end
|
||||
if command test $f -nt $l; and test -d $f
|
||||
set l $f
|
||||
end
|
||||
end
|
||||
echo $l
|
||||
end
|
||||
|
||||
alias vltl "$EDITOR (ltl)"
|
||||
alias cdltl "cd (ltld)"
|
||||
|
||||
alias p "ping 8.8.8.8"
|
||||
function pp --description "Keeps trying to ping 8.8.8.8 forever"
|
||||
while not ping -n 1 -t 5 8.8.8.8
|
||||
sleep 1
|
||||
end
|
||||
end
|
||||
|
||||
alias C "clear; set -q TMUX && begin; has_command tmux && tmux clear-history; end || true"
|
||||
|
||||
if has_command systemctl
|
||||
alias sctl "sudo systemctl"
|
||||
alias sctlu "systemctl --user"
|
||||
alias bt "sctl start bluetooth && sudo bluetoothctl"
|
||||
alias btctl "bt"
|
||||
end
|
||||
|
||||
alias resrc "source $XDG_CONFIG_HOME/fish/config.fish; fish_user_key_bindings"
|
||||
has_command sc && alias scs "sc $NOTES_PATH/_scratch.sc"
|
||||
|
||||
alias dd "dd status=progress"
|
||||
alias year 'cal (date +%Y)'
|
||||
alias mount 'sudo -E mount'
|
||||
alias umount 'sudo -E umount'
|
||||
|
||||
has_command xdg-open && alias open xdg-open
|
35
common/fish/key-bindings.fish
Executable file → Normal file
35
common/fish/key-bindings.fish
Executable file → Normal file
|
@ -1,11 +1,7 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
function fish_user_key_bindings
|
||||
# has_command fd && set -Ux FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --exclude .git'
|
||||
|
||||
test -f $HOME/.fzf/shell/key-bindings.fish && source $HOME/.fzf/shell/key-bindings.fish
|
||||
|
||||
fzf_key_bindings
|
||||
type -q fzf_key_bindings && fzf_key_bindings
|
||||
fish_vi_key_bindings insert --no-erase
|
||||
|
||||
set vi_esc "if commandline -P; commandline -f cancel; else; set fish_bind_mode default; commandline -f backward-char force-repaint; end"
|
||||
|
@ -23,36 +19,7 @@ function fish_user_key_bindings
|
|||
bind -M insert \cn down-or-search
|
||||
bind -M insert \ce end-of-line
|
||||
bind -M insert \ca beginning-of-line
|
||||
bind -M insert \cw forward-word
|
||||
|
||||
bind -M insert \cv edit_command_buffer
|
||||
bind -M default \cv edit_command_buffer
|
||||
|
||||
bind -M insert \ee false
|
||||
bind -M insert \ev false
|
||||
bind -M default \ee false
|
||||
bind -M default \ev false
|
||||
|
||||
bind -M insert --erase \ct
|
||||
bind -M default --erase \ct
|
||||
bind --erase \c\t
|
||||
bind --erase \cs
|
||||
bind --erase btab
|
||||
bind --erase --preset -M visual -k btab
|
||||
bind --erase --preset -M insert -k btab
|
||||
bind --erase --preset -M default -k btab
|
||||
bind --erase --preset -k btab
|
||||
bind --erase -M visual -k btab
|
||||
bind --erase -M insert -k btab
|
||||
bind --erase -M default -k btab
|
||||
bind --erase -k btab
|
||||
|
||||
bind --erase \cs
|
||||
bind --erase -M insert \cs
|
||||
bind --erase -M default \cs
|
||||
|
||||
bind -M insert \cs 'tmux info && tmux attach -t default || tmux new-session -s default'
|
||||
bind -M default \cs 'tmux info && tmux attach -t default || tmux new-session -s default'
|
||||
bind -M insert \ct 'tmux info && tmux new-window -t default || tmux new-session -s default'
|
||||
bind -M default \ct 'tmux info && tmux new-window -t default || tmux new-session -s default'
|
||||
end
|
||||
|
|
89
common/fish/paths.fish
Executable file → Normal file
89
common/fish/paths.fish
Executable file → Normal file
|
@ -1,61 +1,70 @@
|
|||
#!/usr/bin/env fish
|
||||
set --export --universal XDG_CONFIG_HOME $HOME/.config
|
||||
set --export --universal DOTFILES_PATH $XDG_CONFIG_HOME/lytedev-dotfiles
|
||||
set --export --universal ENV_PATH $XDG_CONFIG_HOME/lytedev-env
|
||||
set --export --universal FISH_PATH $XDG_CONFIG_HOME/fish
|
||||
|
||||
set -Ux GOPATH $HOME/.go
|
||||
if not set --query NICE_HOME
|
||||
# default NICE_HOME to HOME
|
||||
set --export --universal NICE_HOME $HOME
|
||||
|
||||
# if HOME ends with a dir called .home, assume that NICE_HOME is HOME's parent dir
|
||||
test (basename $HOME) = .home && set --export --universal NICE_HOME (realpath $HOME/..)
|
||||
end
|
||||
|
||||
# reset paths on shell start
|
||||
set --erase --global fish_user_paths
|
||||
|
||||
# add NICE_HOME to CDPATH (see `man 1 cd`)
|
||||
set --erase CDPATH
|
||||
set --export --global CDPATH . $NICE_HOME
|
||||
|
||||
set --export --universal GOPATH $HOME/.go
|
||||
|
||||
set paths_candidates \
|
||||
$HOME/.go \
|
||||
$GOPATH/bin \
|
||||
$DOTFILES_PATH/common/bin \
|
||||
$HOME/.bin \
|
||||
$HOME/.cargo/bin \
|
||||
$HOME/.local/bin \
|
||||
$HOME/.deno/bin \
|
||||
$HOME/.nimble/bin \
|
||||
$HOME/.yarn/bin \
|
||||
$HOME/.nimble/bin \
|
||||
$HOME/.cargo/bin \
|
||||
$HOME/.go \
|
||||
$GOPATH/bin \
|
||||
$HOME/.netlify/helper/bin
|
||||
|
||||
set -ge fish_user_paths
|
||||
# add candidate paths to PATH if they exist
|
||||
for d in $paths_candidates $ENV_PATH/*/bin
|
||||
test -d $d && set -gxa fish_user_paths $d
|
||||
test -d $d && set --append --export --global fish_user_paths $d
|
||||
end
|
||||
|
||||
test -d $HOME/.local/bin && set -gxa fish_user_paths $HOME/.local/bin
|
||||
test -d $HOME/.bin && set -gxa fish_user_paths $HOME/.local/bin
|
||||
command --search --quiet python && \
|
||||
set --append --export --global fish_user_paths (python -m site --user-base)/bin
|
||||
|
||||
has_command python && set -gxa fish_user_paths (python -m site --user-base)/bin
|
||||
has_command ruby && set -gxa fish_user_paths (ruby -e 'print Gem.user_dir')/bin
|
||||
command --search --quiet ruby && \
|
||||
set --append --export --global fish_user_paths (ruby -e 'print Gem.user_dir')/bin
|
||||
|
||||
if set -q NICE_HOME
|
||||
else
|
||||
set -Ux NICE_HOME $HOME
|
||||
test (basename $HOME) = .home && set -Ux NICE_HOME (realpath $HOME/..)
|
||||
test -f $HOME/.nice_home && set -Ux NICE_HOME (cat $HOME/.nice_home)
|
||||
test -f $ENV_PATH/.nice_home && set -Ux NICE_HOME (cat $ENV_PATH/.nice_home)
|
||||
end
|
||||
for p in $NICE_HOME $HOME $ENV_PATH
|
||||
test -f $p/.nice_home && set -Ux NICE_HOME (cat $p/.nice_home)
|
||||
end
|
||||
set --export --universal NOTES_PATH $NICE_HOME/doc/notes
|
||||
set --export --universal SCROTS_PATH $NICE_HOME/img/scrots
|
||||
set --export --universal USER_LOGS_PATH $NICE_HOME/doc/logs
|
||||
|
||||
set -Ux NOTES_PATH $NICE_HOME/doc/notes
|
||||
set -Ux SCROTS_PATH $NICE_HOME/img/scrots
|
||||
set -Ux USER_LOGS_PATH $NICE_HOME/doc/logs
|
||||
set --export --universal XDG_DESKTOP_DIR $HOME/desktop
|
||||
set --export --universal XDG_PUBLICSHARE_DIR $HOME/public
|
||||
set --export --universal XDG_TEMPLATES_DIR $HOME/templates
|
||||
|
||||
set -Ux XDG_DESKTOP_DIR $HOME/desktop
|
||||
set -Ux XDG_PUBLICSHARE_DIR $HOME/public
|
||||
set -Ux XDG_TEMPLATES_DIR $HOME/templates
|
||||
set --export --universal XDG_DOCUMENTS_DIR $NICE_HOME/doc
|
||||
set --export --universal XDG_DOWNLOAD_DIR $NICE_HOME/dl
|
||||
set --export --universal XDG_MUSIC_DIR $NICE_HOME/music
|
||||
set --export --universal XDG_PICTURES_DIR $NICE_HOME/img
|
||||
set --export --universal XDG_VIDEOS_DIR $NICE_HOME/video
|
||||
set --export --universal XDG_GAMES_DIR $NICE_HOME/games
|
||||
|
||||
set -Ux XDG_DOCUMENTS_DIR $NICE_HOME/doc
|
||||
set -Ux XDG_DOWNLOAD_DIR $NICE_HOME/dl
|
||||
set -Ux XDG_MUSIC_DIR $NICE_HOME/music
|
||||
set -Ux XDG_PICTURES_DIR $NICE_HOME/img
|
||||
set -Ux XDG_VIDEOS_DIR $NICE_HOME/video
|
||||
set -Ux XDG_GAMES_DIR $NICE_HOME/games
|
||||
|
||||
set -Ux TMUX_PLUGIN_MANAGER_PATH $XDG_CONFIG_HOME/tmux/plugins/
|
||||
set -Ux NOTES_PATH $XDG_DOCUMENTS_DIR/notes
|
||||
set -Ux USER_LOGS_PATH $XDG_DOCUMENTS_DIR/logs
|
||||
set -Ux SCROTS_PATH $XDG_PICTURES_DIR/scrots
|
||||
set --export --universal TMUX_PLUGIN_MANAGER_PATH $XDG_CONFIG_HOME/tmux/plugins/
|
||||
set --export --universal NOTES_PATH $XDG_DOCUMENTS_DIR/notes
|
||||
set --export --universal USER_LOGS_PATH $XDG_DOCUMENTS_DIR/logs
|
||||
set --export --universal SCROTS_PATH $XDG_PICTURES_DIR/scrots
|
||||
|
||||
if test -n "$NIX_PATH"
|
||||
set NIX_PATH :
|
||||
end
|
||||
set -Ux NIX_PATH $HOME/.nix-defexpr/channels:$NIX_PATH
|
||||
test -d $HOME/.nix-defexpr/channels && \
|
||||
set --export --universal NIX_PATH $HOME/.nix-defexpr/channels:$NIX_PATH
|
||||
|
|
17
common/fish/prompt.fish
Executable file → Normal file
17
common/fish/prompt.fish
Executable file → Normal file
|
@ -1,17 +1,18 @@
|
|||
#!/usr/bin/env fish
|
||||
set MAX_PATH_PIECE_CHARS 3
|
||||
|
||||
# TODO: if root, background instead?
|
||||
function get_hostname
|
||||
has_command hostname && hostname || cat /etc/hostname
|
||||
end
|
||||
|
||||
set MAX_PATH_PIECE_CHARS $BASH_PROMPT_MAX_PATH_PIECE_CHARS 3
|
||||
function fish_greeting
|
||||
set_color -b black brblack
|
||||
printf "%s@%s %s\n" $USER (get_hostname) (date)
|
||||
end
|
||||
|
||||
# prompt rendering functions
|
||||
function preprocess_pwd
|
||||
test (pwd) = / && echo "/" && return 1
|
||||
test (pwd) = $NICE_HOME && echo "~" && return 0
|
||||
# with ellipsis
|
||||
# echo "$(<<< "$p" cut -c2- | awk '{split($0,p,"/");for(k in p){if(k==length(p)){printf "/%s",p[k]}else{if(length(p[k])>'"
|
||||
# $((MAX_PATH_PIECE_CHARS+1))"'){printf "/%.'"$((MAX_PATH_PIECE_CHARS))"'s…",p[k]}else{printf "/%s",p[k]}}}}')"
|
||||
# without ellipsis
|
||||
# TODO: fix for macOS
|
||||
echo (pwd) | cut -c2- | \
|
||||
awk '{split($0,p,"/");for(k in p){if(k==length(p)){printf "/%s",p[k]}else{printf "/%.'$MAX_PATH_PIECE_CHARS[1]'s",p[k]}}}'
|
||||
end
|
||||
|
|
24
common/fish/vars.fish
Normal file
24
common/fish/vars.fish
Normal file
|
@ -0,0 +1,24 @@
|
|||
# sane ls colors
|
||||
set --export --universal LS_COLORS 'ow=01;36;40'
|
||||
set --export --universal EXA_COLORS '*=0'
|
||||
|
||||
# iex history
|
||||
set --export --universal ERL_AFLAGS "-kernel shell_history enabled -kernel shell_history_file_bytes 1024000"
|
||||
|
||||
set --export --universal TERMINAL kitty
|
||||
set --export --universal BROWSER firefox-nightly
|
||||
|
||||
set --export --universal PAGER less
|
||||
set --export --universal LESS "-r"
|
||||
|
||||
set --export --universal MANPAGER 'env MANWIDTH="" nvim --cmd "let g:prosession_on_startup=0" +Man!'
|
||||
|
||||
if command --search --quiet nvim
|
||||
set --export --universal EDITOR nvim
|
||||
set --export --universal VISUAL nvim
|
||||
else
|
||||
set --export --universal EDITOR vi
|
||||
set --export --universal VISUAL vi
|
||||
end
|
||||
|
||||
# has_command fd && set -Ux FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --exclude .git'
|
|
@ -1,9 +1,9 @@
|
|||
# Beware! This file is rewritten by htop when settings are changed in the interface.
|
||||
# The parser is also very primitive, and not human-friendly.
|
||||
htop_version=3.1.0
|
||||
htop_version=3.1.1
|
||||
config_reader_min_version=2
|
||||
fields=0 48 17 18 38 39 40 2 46 47 49 1
|
||||
sort_key=46
|
||||
sort_key=47
|
||||
sort_direction=-1
|
||||
tree_sort_key=0
|
||||
tree_sort_direction=1
|
||||
|
|
|
@ -1 +1 @@
|
|||
/home/daniel/.home/.config/lytedev-dotfiles/common/colors/vim
|
||||
/root/.config/lytedev-dotfiles/common/colors/vim
|
5
os/linux/config.d.fish
Normal file
5
os/linux/config.d.fish
Normal file
|
@ -0,0 +1,5 @@
|
|||
alias disks "lsblk && df -h"
|
||||
has_command nmtui && alias wifi "sudo -E nmtui"
|
||||
has_command pulsemixer && alias pa pulsemixer
|
||||
has_command neomutt && alias mail neomutt
|
||||
has_command iex && alias miex 'iex -S mix'
|
|
@ -1,29 +1,37 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
set -q XDG_CONFIG_HOME || begin
|
||||
set --query XDG_CONFIG_HOME || begin
|
||||
echo XDG_CONFIG_HOME not set
|
||||
exit 1
|
||||
end
|
||||
|
||||
set -q DOTFILES_PATH || begin
|
||||
set --query DOTFILES_PATH || begin
|
||||
echo DOTFILES_PATH not set
|
||||
exit 1
|
||||
end
|
||||
|
||||
# set -Ux QT_QPA_PLATFORM xcb
|
||||
# set -Ux QT_QPA_PLATFORM_PLUGIN_PATH /usr/lib/qt/plugins
|
||||
set -Ux CLUTTER_BACKEND wayland
|
||||
set -Ux SDL_VIDEODRIVER wayland
|
||||
set -Ux MOZ_ENABLE_WAYLAND 1
|
||||
set -Ux XDG_CURRENT_DESKTOP sway
|
||||
# set --export --universal QT_QPA_PLATFORM xcb
|
||||
# set --export --universal QT_QPA_PLATFORM_PLUGIN_PATH /usr/lib/qt/plugins
|
||||
|
||||
set --export --universal CLUTTER_BACKEND wayland
|
||||
set --export --universal SDL_VIDEODRIVER wayland
|
||||
set --export --universal MOZ_ENABLE_WAYLAND 1
|
||||
set --export --universal XDG_CURRENT_DESKTOP sway
|
||||
set --export --universal _JAVA_AWT_WM_NONREPARENTING 1
|
||||
|
||||
for s in $ENV_PATH/*/sway-init.d.fish
|
||||
source $s (dirname $s)
|
||||
end
|
||||
|
||||
set initstr "\n(date): Initializsing Sway WM"
|
||||
set --query SWAY_LOGGING || set SWAY_LOGGING 0
|
||||
|
||||
if test $SWAY_LOGGING = 1
|
||||
set initstr "\n(date): Starting Sway"
|
||||
set elogfile ~/.sway.error.log
|
||||
set logfile ~/.sway.log
|
||||
|
||||
echo $initstr >> $logfile; echo $initstr >> $elogfile
|
||||
exec sway >> $logfile 2>> $elogfile
|
||||
else
|
||||
exec sway
|
||||
end
|
||||
|
|
83
readme.md
83
readme.md
|
@ -1,72 +1,77 @@
|
|||
# lytedev's dotfiles
|
||||
|
||||
My various configuration files. Don't use them directly, just take what you
|
||||
like.
|
||||
My various configuration files. I can't recommend using them directly, just
|
||||
take what you like.
|
||||
|
||||
[🖥️ Upstream][upstream] • [🐙 GitHub Mirror][github]
|
||||
|
||||
![Battlestation][battlestation-photo]
|
||||
![Desktop Screenshot][desktop-screenshot]
|
||||
|
||||
# Dependencies
|
||||
# Basic Setup
|
||||
|
||||
- `fish`
|
||||
- `bat`
|
||||
- `fd`
|
||||
- `sd`
|
||||
- `fzf`
|
||||
- `tmux`
|
||||
- `rsync`
|
||||
- `exa`
|
||||
- `nnn`
|
||||
- `nvim`
|
||||
curl -LsSf https://lyte.dev/df.sh | sh
|
||||
|
||||
# Setup
|
||||
## I don't like `curl ... | sh`
|
||||
|
||||
Clone the repo:
|
||||
|
||||
git clone https://git.lyte.dev/lytedev/dotfiles.git "$HOME/.config/lytedev-dotfiles"
|
||||
|
||||
Inspect and run the common (no macOS- or Linux-specific configuration) setup
|
||||
`fish` script:
|
||||
|
||||
$EDITOR "$HOME/.config/lytedev-dotfiles/common/bin/dotfiles-setup"
|
||||
"$HOME/.config/lytedev-dotfiles/common/bin/dotfiles-setup"
|
||||
|
||||
## Advanced Setup
|
||||
|
||||
You will want to symlink relevant environment layers into the `$ENV_PATH` in
|
||||
order to have your OS-specific applications be configured and common
|
||||
applications configured for the host OS.
|
||||
|
||||
There's a handy `fzf`-based script that makes this super easy:
|
||||
|
||||
dotfiles-link-environments # note that you can select multiple with TAB
|
||||
|
||||
You can also list the possible environments:
|
||||
|
||||
cat $DOTFILES_PATH/common/envs
|
||||
|
||||
And then link them yourself (note the replacing of slashes with dashes):
|
||||
|
||||
ln -s (pwd)/os/linux $ENV_PATH/os-linux
|
||||
ln -s (pwd)/os/linux/arch $ENV_PATH/os-linux-arch
|
||||
ln -s (pwd)/host/laptop $ENV_PATH/host-laptop
|
||||
ln -s (pwd)/host/laptop/third $ENV_PATH/os-laptop-third
|
||||
|
||||
And run setup again once you've finished linking all related environments:
|
||||
|
||||
```
|
||||
set dfp ~/.config/lytedev-dotfiles
|
||||
git clone https://git.lyte.dev/lytedev/dotfiles.git $dfp && cd $dfp
|
||||
./common/bin/dotfiles-setup
|
||||
# symlink host/os-specific directories
|
||||
ezln ./os/linux $ENV_PATH/linux
|
||||
# setup again once env has all the layers you want
|
||||
dotfiles-setup
|
||||
```
|
||||
|
||||
# Basic Usage
|
||||
|
||||
# To Do
|
||||
|
||||
- Wifi + Home DNS
|
||||
- Rotate/switch gpg keys and password-store, setup properly on phone
|
||||
|
||||
- Maybe something age/sops-based?
|
||||
|
||||
- Home DNS/Wireguard VPN?
|
||||
- Layered gitconfig?
|
||||
- Get out of Google!
|
||||
- `calcurse` for Calendar management?
|
||||
- `aerc` or `neomutt` for email?
|
||||
- My home-grown backup network for Drive?
|
||||
- Photos?
|
||||
- Hibernation and proper power management for laptop?
|
||||
- **Learn to use `journalctl`**
|
||||
- Fix sway workspaces on desktop?
|
||||
- Neovim LSP
|
||||
- Move to NixOS (WIP) or Guix? Declarative is the future!
|
||||
- Better/more secure remote management configuration in dotfiles? [1][1]
|
||||
- Setup network file share?
|
||||
- Home VPN
|
||||
- Move to NixOS or Guix? Declarative may be the future...?
|
||||
- Better/more secure remote management configuration?
|
||||
- Why can't I hold all these SSH keys/configs/target hosts?
|
||||
- Setup network file share that's easily accessible from Windows and macOS hosts?
|
||||
- Samba?
|
||||
- Add vim in the terminal as the handler for many MIME types (xdg-open and such)
|
||||
for the rare time I'm in a file manager or for opening easily from
|
||||
the browser.
|
||||
- This goes for navigating "into" a file in `nnn`
|
||||
- Unify all the common variables... somehow? (and use templates and `envsubst`?)
|
||||
- [Vimux](https://github.com/benmills/vimux)?
|
||||
- Investigate systemd services that may help with various tasks (homed, etc.)
|
||||
- Be more macOS friendly, since work may require that
|
||||
|
||||
[upstream]: https://git.faceless.lytedev.io/lytedev/dotfiles
|
||||
[github]: https://github.com/lytedev/dotfiles
|
||||
[desktop-screenshot]: https://files.lyte.dev/unix/desktop-screenshot.png
|
||||
[battlestation-photo]: https://files.lyte.dev/unix/battlestation.jpg
|
||||
[1]: https://smallstep.com/blog/ssh-tricks-and-tips/
|
||||
|
|
Reference in a new issue