This commit is contained in:
Daniel Flanagan 2021-11-03 12:01:43 -05:00
parent c6b19fcbb4
commit 6b374f6278
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
21 changed files with 354 additions and 338 deletions

9
common/bash/rc Normal file
View 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
View 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

View 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"

View file

@ -7,8 +7,8 @@ set dfp (realpath (dirname (status -f))/../..)
set lock_file $HOME/.using-lytedev-dotfiles.lock set lock_file $HOME/.using-lytedev-dotfiles.lock
if not test -f $lock_file if not test -f $lock_file
echo This will delete existing files. Make sure you know what you\'re doing. 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 'Are you sure you want to continue? [y/N]'
read response read response
set response (string lower $response) set response (string lower $response)
if string match $response y if string match $response y
@ -38,6 +38,7 @@ end
pushd $dfp pushd $dfp
l common/tmux/conf $h/.tmux.conf l common/tmux/conf $h/.tmux.conf
l common/fish $c/fish l common/fish $c/fish
l common/bash/rc $h/.bashrc
l common/neovim $c/nvim l common/neovim $c/nvim
l common/wezterm $c/wezterm l common/wezterm $c/wezterm
l common/colors/vim $c/nvim/colors/base16-donokai.vim 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 end
# execute the user's shell # 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!" echo "Dotfiles Installed! Don't forget to setup environments!"
exec $ush exec $ush

View file

@ -1,2 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env sh
krita "$(ltl "$NICE_HOME/img/scrots/")" 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 &

View file

@ -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

View file

@ -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

View file

@ -1,6 +0,0 @@
#!/usr/bin/env fish
# Silent count
count $argv > /dev/null

View file

@ -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
View 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_normal normal # default color
set -U fish_color_command white # base command being run (>ls< -la) set -U fish_color_command white # base command being run (>ls< -la)
set -U fish_color_param white # command's parameters 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_valid_path yellow # if an argument is a valid path (only -u?)
set -U fish_color_comment 666 brblack # comments like this one! 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_completion white # main color for pager
set -U fish_pager_color_description magenta # color for meta description set -U fish_pager_color_description magenta # color for meta description
set -U fish_pager_color_prefix blue # the string being completed set -U fish_pager_color_prefix blue # the string being completed

View file

@ -1,11 +1,4 @@
#!/usr/bin/env fish source (dirname (status --current-filename))/paths.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
for s in $ENV_PATH/*/config.d.fish for s in $ENV_PATH/*/config.d.fish
source $s (dirname $s) source $s (dirname $s)
@ -13,32 +6,10 @@ end
status --is-interactive || exit 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 source $FISH_PATH/$f.fish
end 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 if has_command brew && test -f (brew --prefix asdf)/lib/asdf.fish
set -Ux ASDF_DIR (brew --prefix asdf) set -Ux ASDF_DIR (brew --prefix asdf)
source (brew --prefix asdf)/lib/asdf.fish 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 source /opt/asdf-vm/asdf.fish
end end
# assume the user uses "$HOME" to just store their mess of dotfiles and other test $PWD = $HOME && begin; cd $NICE_HOME || cd; end
# 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'

164
common/fish/functions.fish Normal file
View 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
View file

@ -1,11 +1,7 @@
#!/usr/bin/env fish
function fish_user_key_bindings 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 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 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" 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 \cn down-or-search
bind -M insert \ce end-of-line bind -M insert \ce end-of-line
bind -M insert \ca beginning-of-line bind -M insert \ca beginning-of-line
bind -M insert \cw forward-word
bind -M insert \cv edit_command_buffer bind -M insert \cv edit_command_buffer
bind -M default \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 end

89
common/fish/paths.fish Executable file → Normal file
View 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 \ set paths_candidates \
$HOME/.go \
$GOPATH/bin \
$DOTFILES_PATH/common/bin \ $DOTFILES_PATH/common/bin \
$HOME/.bin \ $HOME/.bin \
$HOME/.cargo/bin \ $HOME/.local/bin \
$HOME/.deno/bin \ $HOME/.deno/bin \
$HOME/.nimble/bin \
$HOME/.yarn/bin \ $HOME/.yarn/bin \
$HOME/.nimble/bin \
$HOME/.cargo/bin \
$HOME/.go \
$GOPATH/bin \
$HOME/.netlify/helper/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 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 end
test -d $HOME/.local/bin && set -gxa fish_user_paths $HOME/.local/bin command --search --quiet python && \
test -d $HOME/.bin && set -gxa fish_user_paths $HOME/.local/bin 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 command --search --quiet ruby && \
has_command ruby && set -gxa fish_user_paths (ruby -e 'print Gem.user_dir')/bin set --append --export --global fish_user_paths (ruby -e 'print Gem.user_dir')/bin
if set -q NICE_HOME set --export --universal NOTES_PATH $NICE_HOME/doc/notes
else set --export --universal SCROTS_PATH $NICE_HOME/img/scrots
set -Ux NICE_HOME $HOME set --export --universal USER_LOGS_PATH $NICE_HOME/doc/logs
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 -Ux NOTES_PATH $NICE_HOME/doc/notes set --export --universal XDG_DESKTOP_DIR $HOME/desktop
set -Ux SCROTS_PATH $NICE_HOME/img/scrots set --export --universal XDG_PUBLICSHARE_DIR $HOME/public
set -Ux USER_LOGS_PATH $NICE_HOME/doc/logs set --export --universal XDG_TEMPLATES_DIR $HOME/templates
set -Ux XDG_DESKTOP_DIR $HOME/desktop set --export --universal XDG_DOCUMENTS_DIR $NICE_HOME/doc
set -Ux XDG_PUBLICSHARE_DIR $HOME/public set --export --universal XDG_DOWNLOAD_DIR $NICE_HOME/dl
set -Ux XDG_TEMPLATES_DIR $HOME/templates 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 --export --universal TMUX_PLUGIN_MANAGER_PATH $XDG_CONFIG_HOME/tmux/plugins/
set -Ux XDG_DOWNLOAD_DIR $NICE_HOME/dl set --export --universal NOTES_PATH $XDG_DOCUMENTS_DIR/notes
set -Ux XDG_MUSIC_DIR $NICE_HOME/music set --export --universal USER_LOGS_PATH $XDG_DOCUMENTS_DIR/logs
set -Ux XDG_PICTURES_DIR $NICE_HOME/img set --export --universal SCROTS_PATH $XDG_PICTURES_DIR/scrots
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
if test -n "$NIX_PATH" if test -n "$NIX_PATH"
set NIX_PATH : set NIX_PATH :
end 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
View 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 function preprocess_pwd
test (pwd) = / && echo "/" && return 1 test (pwd) = / && echo "/" && return 1
test (pwd) = $NICE_HOME && echo "~" && return 0 test (pwd) = $NICE_HOME && echo "~" && return 0
# with ellipsis # TODO: fix for macOS
# 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
echo (pwd) | cut -c2- | \ 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]}}}' 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 end

24
common/fish/vars.fish Normal file
View 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'

View file

@ -1,9 +1,9 @@
# Beware! This file is rewritten by htop when settings are changed in the interface. # Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly. # 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 config_reader_min_version=2
fields=0 48 17 18 38 39 40 2 46 47 49 1 fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46 sort_key=47
sort_direction=-1 sort_direction=-1
tree_sort_key=0 tree_sort_key=0
tree_sort_direction=1 tree_sort_direction=1

View file

@ -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
View 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'

View file

@ -1,29 +1,37 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set -q XDG_CONFIG_HOME || begin set --query XDG_CONFIG_HOME || begin
echo XDG_CONFIG_HOME not set echo XDG_CONFIG_HOME not set
exit 1 exit 1
end end
set -q DOTFILES_PATH || begin set --query DOTFILES_PATH || begin
echo DOTFILES_PATH not set echo DOTFILES_PATH not set
exit 1 exit 1
end end
# set -Ux QT_QPA_PLATFORM xcb # set --export --universal QT_QPA_PLATFORM xcb
# set -Ux QT_QPA_PLATFORM_PLUGIN_PATH /usr/lib/qt/plugins # set --export --universal QT_QPA_PLATFORM_PLUGIN_PATH /usr/lib/qt/plugins
set -Ux CLUTTER_BACKEND wayland
set -Ux SDL_VIDEODRIVER wayland set --export --universal CLUTTER_BACKEND wayland
set -Ux MOZ_ENABLE_WAYLAND 1 set --export --universal SDL_VIDEODRIVER wayland
set -Ux XDG_CURRENT_DESKTOP sway 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 for s in $ENV_PATH/*/sway-init.d.fish
source $s (dirname $s) source $s (dirname $s)
end 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 elogfile ~/.sway.error.log
set logfile ~/.sway.log set logfile ~/.sway.log
echo $initstr >> $logfile; echo $initstr >> $elogfile echo $initstr >> $logfile; echo $initstr >> $elogfile
exec sway >> $logfile 2>> $elogfile exec sway >> $logfile 2>> $elogfile
else
exec sway
end

View file

@ -1,72 +1,77 @@
# lytedev's dotfiles # lytedev's dotfiles
My various configuration files. Don't use them directly, just take what you My various configuration files. I can't recommend using them directly, just
like. take what you like.
[🖥️ Upstream][upstream] • [🐙 GitHub Mirror][github] [🖥️ Upstream][upstream] • [🐙 GitHub Mirror][github]
![Battlestation][battlestation-photo] ![Battlestation][battlestation-photo]
![Desktop Screenshot][desktop-screenshot] ![Desktop Screenshot][desktop-screenshot]
# Dependencies # Basic Setup
- `fish` curl -LsSf https://lyte.dev/df.sh | sh
- `bat`
- `fd`
- `sd`
- `fzf`
- `tmux`
- `rsync`
- `exa`
- `nnn`
- `nvim`
# 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 dotfiles-setup
```
# Basic Usage
# To Do # To Do
- Wifi + Home DNS - Home DNS/Wireguard VPN?
- Rotate/switch gpg keys and password-store, setup properly on phone
- Maybe something age/sops-based?
- Layered gitconfig? - Layered gitconfig?
- Get out of Google! - Get out of Google!
- `calcurse` for Calendar management? - `calcurse` for Calendar management?
- `aerc` or `neomutt` for email? - `aerc` or `neomutt` for email?
- My home-grown backup network for Drive? - My home-grown backup network for Drive?
- Photos? - Photos?
- Hibernation and proper power management for laptop?
- **Learn to use `journalctl`** - **Learn to use `journalctl`**
- Fix sway workspaces on desktop?
- Neovim LSP - Neovim LSP
- Move to NixOS (WIP) or Guix? Declarative is the future! - Move to NixOS or Guix? Declarative may be the future...?
- Better/more secure remote management configuration in dotfiles? [1][1] - Better/more secure remote management configuration?
- Setup network file share? - Why can't I hold all these SSH keys/configs/target hosts?
- Home VPN - 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) - 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 for the rare time I'm in a file manager or for opening easily from
the browser. the browser.
- This goes for navigating "into" a file in `nnn` - 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.) - 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 [upstream]: https://git.faceless.lytedev.io/lytedev/dotfiles
[github]: https://github.com/lytedev/dotfiles [github]: https://github.com/lytedev/dotfiles
[desktop-screenshot]: https://files.lyte.dev/unix/desktop-screenshot.png [desktop-screenshot]: https://files.lyte.dev/unix/desktop-screenshot.png
[battlestation-photo]: https://files.lyte.dev/unix/battlestation.jpg [battlestation-photo]: https://files.lyte.dev/unix/battlestation.jpg
[1]: https://smallstep.com/blog/ssh-tricks-and-tips/