mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-09 22:12:56 +00:00
move fish functions into nix
This commit is contained in:
parent
47d09a98e2
commit
f5508c747c
@ -1,152 +0,0 @@
|
||||
#!/usr/local/bin/fish
|
||||
|
||||
function abbrs --description 'All abbreviations'
|
||||
|
||||
# Directory aliases
|
||||
abbr -a l ls
|
||||
abbr -a lh 'ls -lh'
|
||||
abbr -a ll 'ls -alhF'
|
||||
abbr -a lf 'ls -lh | fzf'
|
||||
abbr -a c cd
|
||||
abbr -a -- - 'cd -'
|
||||
abbr -a proj 'cd $PROJ'
|
||||
abbr -a mkd 'mkdir -pv'
|
||||
|
||||
# Tmux
|
||||
abbr -a ta 'tmux attach-session'
|
||||
abbr -a tan 'tmux attach-session -t noah'
|
||||
abbr -a tnn 'tmux new-session -s noah'
|
||||
|
||||
# Git
|
||||
abbr -a g git
|
||||
abbr -a gs 'git status'
|
||||
abbr -a gd 'git diff'
|
||||
abbr -a gds 'git diff --staged'
|
||||
abbr -a gdp 'git diff HEAD^'
|
||||
abbr -a ga 'git add'
|
||||
abbr -a gaa 'git add -A'
|
||||
abbr -a gac 'git commit -am'
|
||||
abbr -a gc 'git commit -m'
|
||||
abbr -a gca 'git commit --amend --no-edit'
|
||||
abbr -a gcae 'git commit --amend'
|
||||
abbr -a gu 'git pull'
|
||||
abbr -a gp 'git push'
|
||||
abbr -a gpp git-push-upstream
|
||||
abbr -a gl 'git log --graph --decorate --oneline -20'
|
||||
abbr -a gll 'git log --graph --decorate --oneline'
|
||||
abbr -a gco 'git checkout'
|
||||
abbr -a gcom 'git checkout master'
|
||||
abbr -a gcob 'git checkout -b'
|
||||
abbr -a gb 'git branch'
|
||||
abbr -a gbd 'git branch -d'
|
||||
abbr -a gbD 'git branch -D'
|
||||
abbr -a gr 'git reset'
|
||||
abbr -a grh 'git reset --hard'
|
||||
abbr -a gm 'git merge'
|
||||
abbr -a gcp 'git cherry-pick'
|
||||
abbr -a cdg 'cd (git rev-parse --show-toplevel)'
|
||||
|
||||
# GitHub
|
||||
abbr -a ghr 'gh repo view -w'
|
||||
abbr -a gha 'gh run list | head -1 | awk \'{ print $(NF-2) }\' | xargs gh run view'
|
||||
abbr -a grw 'noti gh run watch'
|
||||
abbr -a grf 'gh run view --log-failed'
|
||||
abbr -a grl 'gh run view --log'
|
||||
abbr -a ghpr 'gh pr create && sleep 3 && noti gh run watch'
|
||||
abbr -a ghm 'gh pr merge -s -d && git pull'
|
||||
|
||||
# Vim
|
||||
if command -v nvim >/dev/null
|
||||
alias --save vim='nvim'
|
||||
abbr -a vimrc 'vim $HOME/.config/nvim/init.lua'
|
||||
else
|
||||
alias --save vim='vim'
|
||||
abbr -a vimrc 'vim $HOME/.vimrc'
|
||||
end
|
||||
abbr -a v vim
|
||||
abbr -a vl 'vim -c "normal! `0"'
|
||||
abbr -a vll 'vim -c "Telescope oldfiles"'
|
||||
abbr -a vh 'vim -c "Telescope oldfiles"'
|
||||
|
||||
# Notes
|
||||
abbr -a qn quicknote
|
||||
abbr -a sn syncnotes
|
||||
abbr -a to today
|
||||
abbr -a work 'vim $NOTES_PATH/work.md'
|
||||
|
||||
# RSS
|
||||
abbr -a nb newsboat
|
||||
|
||||
# Improved CLI Tools
|
||||
abbr -a cat bat # Swap cat with bat
|
||||
abbr -a h 'http -Fh --all' # Curl site for headers
|
||||
abbr -a j just
|
||||
abbr -a scim sc-im
|
||||
|
||||
# Fun CLI Tools
|
||||
abbr weather 'curl wttr.in/$WEATHER_CITY'
|
||||
abbr moon 'curl wttr.in/Moon'
|
||||
|
||||
# Dotfile and config shortcuts
|
||||
abbr -a s sudo
|
||||
abbr -a boot '$DOTS/scripts/bootstrap'
|
||||
abbr -a sshc 'vim ~/.ssh/config'
|
||||
abbr -a hosts 'sudo nvim /etc/hosts'
|
||||
abbr -a frc 'vim $HOME/.config/fish/config.fish'
|
||||
abbr -a falias 'vim $HOME/.config/fish/functions/abbrs.fish'
|
||||
|
||||
# Cheat Sheets
|
||||
abbr -a ssl 'openssl req -new -newkey rsa:2048 -nodes' \
|
||||
'-keyout server.key -out server.csr'
|
||||
abbr -a fingerprint 'ssh-keyscan myhost.com | ssh-keygen -lf -'
|
||||
abbr -a publickey 'ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub'
|
||||
abbr -a forloop 'for i in (seq 1 100)'
|
||||
abbr -a gatekeeper 'sudo spctl --master-disable'
|
||||
abbr -a flushdns 'sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder'
|
||||
|
||||
# Docker
|
||||
abbr -a dc '$DOTS/bin/docker_cleanup'
|
||||
abbr -a dr 'docker run --rm -it'
|
||||
abbr -a db 'docker build . -t'
|
||||
abbr -a ds 'docker ps -a'
|
||||
abbr -a de 'docker exec -it'
|
||||
abbr -a dpy 'docker run --rm -it -v $PWD:/project python:alpine python'
|
||||
abbr -a alp 'docker run --rm -it -v $PWD:/project alpine sh'
|
||||
|
||||
# Terraform
|
||||
abbr -a te terraform
|
||||
abbr -a tap 'terraform apply'
|
||||
|
||||
# Kubernetes
|
||||
abbr -a k kubectl
|
||||
abbr -a pods 'kubectl get pods -A'
|
||||
abbr -a nodes 'kubectl get nodes'
|
||||
abbr -a deploys 'kubectl get deployments -A'
|
||||
abbr -a dash kube-dashboard
|
||||
abbr -a ks k9s
|
||||
|
||||
# Cloud
|
||||
abbr -a awsc 'vim ~/.aws/credentials'
|
||||
|
||||
# Python
|
||||
abbr -a py python
|
||||
abbr -a po poetry
|
||||
abbr -a pr 'poetry run python'
|
||||
abbr -a pl 'poetry run pylint *'
|
||||
abbr -a black 'poetry run black --target-version py38 .'
|
||||
abbr -a bl 'poetry run black --target-version py38 .'
|
||||
|
||||
# Rust
|
||||
abbr -a ca cargo
|
||||
|
||||
# macOS
|
||||
abbr -a casks 'vim $DOTS/homebrew/Caskfile'
|
||||
abbr -a t trash
|
||||
|
||||
# Linux
|
||||
if [ (uname) = Linux ]
|
||||
linux
|
||||
end
|
||||
|
||||
|
||||
end
|
@ -1,10 +0,0 @@
|
||||
function brews --description "Open Homebrew bundles file"
|
||||
set -lx brewdir $DOTS/homebrew
|
||||
set -l brewfile (basename $brewdir/*.Brewfile \
|
||||
| fzf \
|
||||
--height 70% \
|
||||
--preview-window right:70% \
|
||||
--preview 'bat --color=always $brewdir/{}' \
|
||||
)
|
||||
and vim $brewdir/$brewfile
|
||||
end
|
@ -1,9 +0,0 @@
|
||||
function brewsearch --description "Install brew plugins"
|
||||
set -l inst (brew formulae | eval "fzf $FZF_DEFAULT_OPTS -m --header='[press ctrl-i for info, enter to install]' --bind 'ctrl-i:preview(brew info {})'")
|
||||
|
||||
if not test (count $inst) = 0
|
||||
for prog in $inst
|
||||
brew install "$prog"
|
||||
end
|
||||
end
|
||||
end
|
@ -1,10 +1,6 @@
|
||||
#!/usr/local/bin/fish
|
||||
|
||||
function commandline-git-commits
|
||||
set commit (git-commits)
|
||||
if [ $commit ]
|
||||
commandline -i "$commit"
|
||||
else
|
||||
commandline -i "HEAD"
|
||||
end
|
||||
set commit (git-commits)
|
||||
if [ $commit ]
|
||||
commandline -i "$commit"
|
||||
else
|
||||
commandline -i HEAD
|
||||
end
|
||||
|
@ -1,3 +0,0 @@
|
||||
function copy --description 'Copy file contents into clipboard'
|
||||
cat $argv | pbcopy
|
||||
end
|
@ -1,6 +1,4 @@
|
||||
function edit --description "Open a file in Vim"
|
||||
set vimfile (fzf)
|
||||
and set vimfile (echo $vimfile | tr -d '\r')
|
||||
and commandline -r "vim $vimfile"
|
||||
and commandline -f execute
|
||||
end
|
||||
set vimfile (fzf)
|
||||
and set vimfile (echo $vimfile | tr -d '\r')
|
||||
and commandline -r "vim $vimfile"
|
||||
and commandline -f execute
|
||||
|
@ -1,3 +0,0 @@
|
||||
function envs --description 'Set from a bash environment variables file'
|
||||
set -gx (cat $argv | tr "=" " " | string split ' ')
|
||||
end
|
@ -1,12 +1,10 @@
|
||||
function fcd --description 'Jump to directory' -a 'directory'
|
||||
if test -z $directory
|
||||
set directory "$HOME"
|
||||
end
|
||||
if ! test -d $directory
|
||||
echo "Directory not found: $directory"
|
||||
return 1
|
||||
end
|
||||
set jump (fd -t d . $directory | fzf)
|
||||
and cd $jump $argv;
|
||||
and commandline -f execute;
|
||||
if test -z $directory
|
||||
set directory "$HOME"
|
||||
end
|
||||
if ! test -d $directory
|
||||
echo "Directory not found: $directory"
|
||||
return 1
|
||||
end
|
||||
set jump (fd -t d . $directory | fzf)
|
||||
and cd $jump $argv
|
||||
and commandline -f execute
|
||||
|
@ -1,17 +1,13 @@
|
||||
#!/usr/local/bin/fish
|
||||
|
||||
function fish_user_key_bindings
|
||||
bind -M insert \co 'edit'
|
||||
bind -M default \co 'edit'
|
||||
bind -M insert \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute'
|
||||
bind -M default \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute'
|
||||
bind -M insert \ce 'recent'
|
||||
bind -M default \ce 'recent'
|
||||
bind -M insert \cg 'commandline-git-commits'
|
||||
bind -M insert \cf 'fcd'
|
||||
bind -M default \cf 'fcd'
|
||||
bind -M insert \cp 'prj'
|
||||
bind -M default \cp 'prj'
|
||||
bind -M insert \x1F accept-autosuggestion
|
||||
bind -M default \x1F accept-autosuggestion
|
||||
end
|
||||
bind -M insert \co edit
|
||||
bind -M default \co edit
|
||||
bind -M insert \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute'
|
||||
bind -M default \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute'
|
||||
bind -M insert \ce recent
|
||||
bind -M default \ce recent
|
||||
bind -M insert \cg commandline-git-commits
|
||||
bind -M insert \cf fcd
|
||||
bind -M default \cf fcd
|
||||
bind -M insert \cp projects
|
||||
bind -M default \cp projects
|
||||
bind -M insert \x1F accept-autosuggestion
|
||||
bind -M default \x1F accept-autosuggestion
|
||||
|
@ -1 +0,0 @@
|
||||
/usr/local/opt/fzf/shell/key-bindings.fish
|
@ -1,8 +0,0 @@
|
||||
# This function creates an output file of just the printf values for
|
||||
# modifying the shell colors. This output file is used to load the
|
||||
# current colors into my shell much faster than running the function on
|
||||
# prompt.
|
||||
|
||||
function generate_fish_colors --description "Create fish colors file"
|
||||
theme_gruvbox dark > $DOTS/fish.configlink/fish_colors
|
||||
end
|
@ -1,16 +1,14 @@
|
||||
function git-add-fuzzy
|
||||
set gitfile (git status -s \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
-m \
|
||||
--preview-window right:70% \
|
||||
--layout reverse \
|
||||
--preview 'set -l IFS; set gd (git diff --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2)); if test "$gd"; echo "$gd"; else; bat --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2); end')
|
||||
and for gf in $gitfile
|
||||
set gf (echo $gf \
|
||||
| awk '{$1=$1};1' \
|
||||
| cut -d' ' -f2 \
|
||||
)
|
||||
and git add $gf
|
||||
end
|
||||
set gitfile (git status -s \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
-m \
|
||||
--preview-window right:70% \
|
||||
--layout reverse \
|
||||
--preview 'set -l IFS; set gd (git diff --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2)); if test "$gd"; echo "$gd"; else; bat --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2); end')
|
||||
and for gf in $gitfile
|
||||
set gf (echo $gf \
|
||||
| awk '{$1=$1};1' \
|
||||
| cut -d' ' -f2 \
|
||||
)
|
||||
and git add $gf
|
||||
end
|
||||
|
@ -1,4 +0,0 @@
|
||||
function git-checkout-fuzzy
|
||||
set branch (git-fuzzy-branch "checkout branch...")
|
||||
and git checkout $branch
|
||||
end
|
@ -1,10 +1,8 @@
|
||||
function git-commits
|
||||
set commitline (git log \
|
||||
--pretty="format:%C(auto)%ar %h%d %s" \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
--preview 'git show --color=always (echo {} | cut -d" " -f4)' \
|
||||
)
|
||||
and set commit (echo $commitline | cut -d" " -f4)
|
||||
and echo $commit
|
||||
end
|
||||
set commitline (git log \
|
||||
--pretty="format:%C(auto)%ar %h%d %s" \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
--preview 'git show --color=always (echo {} | cut -d" " -f4)' \
|
||||
)
|
||||
and set commit (echo $commitline | cut -d" " -f4)
|
||||
and echo $commit
|
||||
|
@ -1,4 +0,0 @@
|
||||
function git-delete-fuzzy
|
||||
set branch (git-fuzzy-branch "delete branch...")
|
||||
and git branch -d $branch
|
||||
end
|
@ -1,4 +0,0 @@
|
||||
function git-force-delete-fuzzy
|
||||
set branch (git-fuzzy-branch "force delete branch...")
|
||||
and git branch -D $branch
|
||||
end
|
@ -1,12 +1,10 @@
|
||||
function git-fuzzy-branch -a header
|
||||
set -l current (git rev-parse --abbrev-ref HEAD | tr -d '\n')
|
||||
set -l branch (git branch \
|
||||
--format "%(refname:short)" \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
--header="On $current, $header" \
|
||||
--preview-window right:70% \
|
||||
--preview 'git log {} --color=always --pretty="format:%C(auto)%ar %h%d %s"' \
|
||||
)
|
||||
and echo $branch
|
||||
end
|
||||
set -l current (git rev-parse --abbrev-ref HEAD | tr -d '\n')
|
||||
set -l branch (git branch \
|
||||
--format "%(refname:short)" \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
--header="On $current, $header" \
|
||||
--preview-window right:70% \
|
||||
--preview 'git log {} --color=always --pretty="format:%C(auto)%ar %h%d %s"' \
|
||||
)
|
||||
and echo $branch
|
||||
|
@ -1,16 +1,14 @@
|
||||
function git-history
|
||||
if not count $argv > /dev/null
|
||||
echo "Must provide filename."
|
||||
return 1
|
||||
end
|
||||
set commitline ( git log \
|
||||
--follow \
|
||||
--pretty="format:%C(auto)%ar %h%d %s" \
|
||||
-- ./$argv \
|
||||
| fzf \
|
||||
--height 100% \
|
||||
--preview "git diff --color=always (echo {} | cut -d' ' -f4)^1..(echo {} | cut -d' ' -f4) -- ./$argv" \
|
||||
)
|
||||
and set commit (echo $commitline | cut -d" " -f4)
|
||||
and echo $commit
|
||||
if not count $argv >/dev/null
|
||||
echo "Must provide filename."
|
||||
return 1
|
||||
end
|
||||
set commitline ( git log \
|
||||
--follow \
|
||||
--pretty="format:%C(auto)%ar %h%d %s" \
|
||||
-- ./$argv \
|
||||
| fzf \
|
||||
--height 100% \
|
||||
--preview "git diff --color=always (echo {} | cut -d' ' -f4)^1..(echo {} | cut -d' ' -f4) -- ./$argv" \
|
||||
)
|
||||
and set commit (echo $commitline | cut -d" " -f4)
|
||||
and echo $commit
|
||||
|
@ -1,4 +0,0 @@
|
||||
function git-merge-fuzzy
|
||||
set branch (git-fuzzy-branch "merge from...")
|
||||
and git merge $branch
|
||||
end
|
@ -1,6 +1,4 @@
|
||||
function git-push-upstream --description "Create upstream branch"
|
||||
set -l branch (git branch 2>/dev/null | grep '^\*' | colrm 1 2)
|
||||
set -l command "git push --set-upstream origin $branch"
|
||||
commandline -r $command
|
||||
commandline -f execute
|
||||
end
|
||||
set -l branch (git branch 2>/dev/null | grep '^\*' | colrm 1 2)
|
||||
set -l command "git push --set-upstream origin $branch"
|
||||
commandline -r $command
|
||||
commandline -f execute
|
||||
|
@ -1,8 +1,6 @@
|
||||
function git-show-fuzzy
|
||||
set commitline (git log \
|
||||
--pretty="format:%C(auto)%ar %h%d %s" \
|
||||
| fzf \
|
||||
)
|
||||
and set commit (echo $commitline | cut -d" " -f4 )
|
||||
and git show $commit
|
||||
end
|
||||
set commitline (git log \
|
||||
--pretty="format:%C(auto)%ar %h%d %s" \
|
||||
| fzf \
|
||||
)
|
||||
and set commit (echo $commitline | cut -d" " -f4 )
|
||||
and git show $commit
|
||||
|
@ -1,39 +1,37 @@
|
||||
function git
|
||||
if contains f $argv
|
||||
switch $argv[1]
|
||||
case "checkout"
|
||||
git-checkout-fuzzy
|
||||
case "add"
|
||||
git-add-fuzzy
|
||||
case "show"
|
||||
git-show-fuzzy
|
||||
case "merge"
|
||||
git-merge-fuzzy
|
||||
case "branch"
|
||||
if test "$argv[2]" = "-d"
|
||||
git-delete-fuzzy
|
||||
else if test "$argv[2]" = "-D"
|
||||
git-force-delete-fuzzy
|
||||
else
|
||||
echo "Not a fuzzy option."
|
||||
return 1
|
||||
end
|
||||
case "reset"
|
||||
set commit (git-commits)
|
||||
and if test "$argv[2]" = "--hard"
|
||||
git reset --hard $commit
|
||||
else
|
||||
git reset $commit
|
||||
end
|
||||
case "*"
|
||||
echo "No fuzzy option."
|
||||
if contains f $argv
|
||||
switch $argv[1]
|
||||
case checkout
|
||||
git-checkout-fuzzy
|
||||
case add
|
||||
git-add-fuzzy
|
||||
case show
|
||||
git-show-fuzzy
|
||||
case merge
|
||||
git-merge-fuzzy
|
||||
case branch
|
||||
if test "$argv[2]" = -d
|
||||
git-delete-fuzzy
|
||||
else if test "$argv[2]" = -D
|
||||
git-force-delete-fuzzy
|
||||
else
|
||||
echo "Not a fuzzy option."
|
||||
return 1
|
||||
end
|
||||
case reset
|
||||
set commit (git-commits)
|
||||
and if test "$argv[2]" = --hard
|
||||
git reset --hard $commit
|
||||
else
|
||||
git reset $commit
|
||||
end
|
||||
case "*"
|
||||
echo "No fuzzy option."
|
||||
return 1
|
||||
end
|
||||
else
|
||||
if count $argv >/dev/null
|
||||
command git $argv
|
||||
else
|
||||
if count $argv > /dev/null
|
||||
command git $argv
|
||||
else
|
||||
command git status -sb
|
||||
end
|
||||
command git status -sb
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,5 @@
|
||||
function ip
|
||||
if count $argv > /dev/null
|
||||
curl ipinfo.io/$argv
|
||||
else
|
||||
curl checkip.amazonaws.com
|
||||
end
|
||||
if count $argv >/dev/null
|
||||
curl ipinfo.io/$argv
|
||||
else
|
||||
curl checkip.amazonaws.com
|
||||
end
|
||||
|
@ -1,10 +0,0 @@
|
||||
function journal --description "Create today's journal"
|
||||
note-dates
|
||||
if [ -f $TODAY_NOTE_FILE ]
|
||||
echo "Already exists."
|
||||
else
|
||||
note-header
|
||||
printf $JOURNAL_HEADER > $TODAY_NOTE_FILE
|
||||
echo "New journal added."
|
||||
end
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
function json --description "Tidy up JSON with jq"
|
||||
pbpaste | jq '.' | pbcopy
|
||||
end
|
@ -1,4 +0,0 @@
|
||||
function linux --description "Load only on Linux"
|
||||
alias pbcopy='xclip -selection clipboard -in'
|
||||
alias pbpaste='xclip -selection clipboard -out'
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
function ls --description "Use exa to list files"
|
||||
exa $argv
|
||||
end
|
@ -1,11 +0,0 @@
|
||||
function meeting --description "Describe a meeting" -a "name"
|
||||
note-dates
|
||||
set today_date (date -j +"%Y-%m-%d")
|
||||
set time (date +"%I:%M%p" | tr '[:upper:]' '[:lower:]')
|
||||
set meeting_name (echo $name | tr ' ' '-' | tr '[:upper:]' '[:lower:]')
|
||||
set meeting_note $today_date-$meeting_name
|
||||
set meeting_file meetings/$meeting_note.md
|
||||
printf "[$TODAY_NOTE](../journal/$TODAY_NOTE.md) | #meeting\n\n# $name\n\n---\n\n" > $NOTES_PATH/$meeting_file
|
||||
printf "\n\n---\n\n$time - [$name](../$meeting_file)\n\n---\n\n" >> $TODAY_NOTE_FILE
|
||||
vim $NOTES_PATH/$meeting_file
|
||||
end
|
@ -1,7 +0,0 @@
|
||||
function note-dates
|
||||
set -g TODAY_NOTE (date +"%Y-%m-%d_%a")
|
||||
set -g YESTERDAY_NOTE (date -jv "-1d" +"%Y-%m-%d_%a")
|
||||
set -g TOMORROW_NOTE (date -jv "+1d" +"%Y-%m-%d_%a")
|
||||
set -g LONG_DATE (date +"%A, %B %e, %Y" | sed 's/ */ /g')
|
||||
set -g TODAY_NOTE_FILE $NOTES_PATH/journal/$TODAY_NOTE.md
|
||||
end
|
@ -1,4 +0,0 @@
|
||||
function note-header
|
||||
set -g CURRENT_WEATHER (curl -s "https://wttr.in/?format=1")
|
||||
set -g JOURNAL_HEADER "[Yesterday]($YESTERDAY_NOTE.md) | [Home](../home.md) | [Today](obsidian://advanced-uri?daily=true) | [Tomorrow]($TOMORROW_NOTE.md)\n\n$LONG_DATE\n$CURRENT_WEATHER\n#journal\n\n---\n\n"
|
||||
end
|
@ -1,10 +1,8 @@
|
||||
function note --description "Edit or create a note" -a "filename"
|
||||
if test -n "$filename"
|
||||
vim $NOTES_PATH/$filename.md
|
||||
else
|
||||
set file (ls $NOTES_PATH | fzf)
|
||||
if [ $status -eq 0 ]
|
||||
vim $NOTES_PATH/$file
|
||||
end
|
||||
if test -n "$filename"
|
||||
vim $NOTES_PATH/$filename.md
|
||||
else
|
||||
set file (ls $NOTES_PATH | fzf)
|
||||
if [ $status -eq 0 ]
|
||||
vim $NOTES_PATH/$file
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +0,0 @@
|
||||
function ping --description "Improved ping" -a "target"
|
||||
prettyping --nolegend $target
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
function prj --description "cd to a project"
|
||||
set projdir (ls $PROJ | fzf)
|
||||
and cd $PROJ/$projdir
|
||||
and commandline -f execute
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
function psf --description "Search for open process" -a "process"
|
||||
ps aux | rg -v "$USER.*rg $argv" | rg $argv
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
function qr
|
||||
qrencode $argv[1] -o /tmp/qr.png | open /tmp/qr.png
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
function quicknote --description "Write a quick note" -a "note"
|
||||
note-dates
|
||||
set time (date +"%I:%M%p" | tr '[:upper:]' '[:lower:]')
|
||||
printf "\n\n---\n\n#### $time\n$note\n" >> $TODAY_NOTE_FILE
|
||||
end
|
@ -1,6 +1,4 @@
|
||||
function recent --description "Open a recent file in Vim"
|
||||
set vimfile (fd -t f --exec stat -f "%m%t%N" | sort -nr | cut -f2 | fzf)
|
||||
and set vimfile (echo $vimfile | tr -d '\r')
|
||||
and commandline -r "vim $vimfile"
|
||||
and commandline -f execute
|
||||
end
|
||||
set vimfile (fd -t f --exec stat -f "%m%t%N" | sort -nr | cut -f2 | fzf)
|
||||
and set vimfile (echo $vimfile | tr -d '\r')
|
||||
and commandline -r "vim $vimfile"
|
||||
and commandline -f execute
|
||||
|
@ -1,3 +0,0 @@
|
||||
function reload --description "Reload fish configuration"
|
||||
source $DOTS/fish.configlink/config.fish
|
||||
end
|
@ -1,42 +0,0 @@
|
||||
#!/usr/local/bin/fish
|
||||
|
||||
function repos --description 'Clone GitHub repositories' -a 'organization'
|
||||
set directory (gh-repos $organization)
|
||||
and cd $directory
|
||||
end
|
||||
#switch $organization
|
||||
# case t2; set organization "take-two"
|
||||
# case d2c; set organization "take-two-t2gp"
|
||||
# case t2gp; set organization "take-two-t2gp"
|
||||
# case pd; set organization "private-division"
|
||||
# case dots; set organization "playdots"
|
||||
# case '*'; set organization "nmasur"
|
||||
#end
|
||||
|
||||
#set selected (gh repo list "$organization" \
|
||||
# --limit 50 \
|
||||
# --no-archived \
|
||||
# --json=name,description,isPrivate,updatedAt,primaryLanguage \
|
||||
# | jq -r '.[] | .name + "," + if .description == "" then "-" else .description end + "," + .updatedAt + "," + .primaryLanguage.name' \
|
||||
# | begin
|
||||
# echo "REPO,DESCRIPTION,UPDATED,LANGUAGE"
|
||||
# cat -
|
||||
# end | column -s , -t
|
||||
# | fzf \
|
||||
# --header-lines=1 \
|
||||
# --layout=reverse
|
||||
#--bind "ctrl-o:execute:gh repo view -w $organization/{1}" \
|
||||
#--preview "GH_FORCE_TTY=49% gh repo view $organization/{1} | glow -" \
|
||||
#--preview-window up
|
||||
#)
|
||||
#if test -n (echo $selected | tr -d '\r')
|
||||
# set directory "$HOME/dev/work"
|
||||
# if test $organization = "nmasur"
|
||||
# set directory "$HOME/dev/personal"
|
||||
# end
|
||||
# set repo (echo $selected | awk '{print $1}')
|
||||
# set repo_full "$organization/$repo"
|
||||
# gh repo clone "$repo_full" "$directory/$repo"
|
||||
# cd "$directory/$repo"
|
||||
#end
|
||||
#end
|
@ -1,9 +1,7 @@
|
||||
function syncnotes --description "Full git commit on notes"
|
||||
set current_dir $PWD
|
||||
cd $NOTES_PATH
|
||||
git pull
|
||||
git add -A
|
||||
git commit -m "autosync"
|
||||
git push
|
||||
cd $current_dir
|
||||
end
|
||||
set current_dir $PWD
|
||||
cd $NOTES_PATH
|
||||
git pull
|
||||
git add -A
|
||||
git commit -m autosync
|
||||
git push
|
||||
cd $current_dir
|
||||
|
@ -1,141 +0,0 @@
|
||||
#!/usr/bin/fish
|
||||
function theme_gruvbox --description 'Apply gruvbox theme'
|
||||
set -l mode 'light'
|
||||
if test (count $argv) -gt 0
|
||||
set mode $argv[1]
|
||||
end
|
||||
|
||||
set -g contrast 'medium'
|
||||
if test (count $argv) -gt 1
|
||||
set contrast $argv[2]
|
||||
end
|
||||
|
||||
switch $contrast
|
||||
case 'soft'
|
||||
case 'medium'
|
||||
case 'hard'
|
||||
case '*'
|
||||
set_color $fish_color_error
|
||||
echo 'Unknown contrast $contrast, choose soft, medium or hard'
|
||||
set_color $fish_color_normal
|
||||
return 1
|
||||
end
|
||||
|
||||
switch $mode
|
||||
case 'light'
|
||||
__theme_gruvbox_base
|
||||
__theme_gruvbox_light
|
||||
case 'dark'
|
||||
__theme_gruvbox_base
|
||||
__theme_gruvbox_dark
|
||||
case '*'
|
||||
set_color $fish_color_error
|
||||
echo 'Unknown mode $mode, choose light or dark'
|
||||
set_color $fish_color_normal
|
||||
return 1
|
||||
end
|
||||
__theme_gruvbox_palette
|
||||
return 0
|
||||
end
|
||||
|
||||
function __theme_gruvbox_base
|
||||
__printf_color 1 'cc/24/1d'
|
||||
__printf_color 2 '98/97/1a'
|
||||
__printf_color 3 'd7/99/21'
|
||||
__printf_color 4 '45/85/88'
|
||||
__printf_color 5 'b1/62/86'
|
||||
__printf_color 6 '68/9d/6a'
|
||||
end
|
||||
|
||||
function __theme_gruvbox_light
|
||||
set -l bg 'fb/f1/c7'
|
||||
switch $contrast
|
||||
case "soft"
|
||||
set bg 'f2/e5/bc'
|
||||
case "hard"
|
||||
set bg 'f9/f5/d7'
|
||||
end
|
||||
command printf "\033]11;rgb:$bg\007"
|
||||
|
||||
set -l fg '3c/38/36'
|
||||
command printf "\033]10;rgb:$fg\007"
|
||||
|
||||
__printf_color 0 $bg
|
||||
__printf_color 7 '7c/6f/64'
|
||||
__printf_color 8 '92/83/74'
|
||||
__printf_color 9 '9d/00/06'
|
||||
__printf_color 10 '79/74/0e'
|
||||
__printf_color 11 'b5/76/14'
|
||||
__printf_color 12 '07/66/78'
|
||||
__printf_color 13 '8f/3f/71'
|
||||
__printf_color 14 '42/7b/58'
|
||||
__printf_color 15 $fg
|
||||
end
|
||||
|
||||
function __theme_gruvbox_dark
|
||||
set -l bg '28/28/28'
|
||||
switch $contrast
|
||||
case "soft"
|
||||
set bg '32/30/2f'
|
||||
case "hard"
|
||||
set bg '1d/20/21'
|
||||
end
|
||||
command printf "\033]11;rgb:$bg\007"
|
||||
|
||||
set -l fg 'eb/db/b2'
|
||||
command printf "\033]10;rgb:$fg\007"
|
||||
|
||||
__printf_color 0 $bg
|
||||
__printf_color 7 'a8/99/84'
|
||||
__printf_color 8 '92/83/74'
|
||||
__printf_color 9 'fb/59/34'
|
||||
__printf_color 10 'b8/bb/26'
|
||||
__printf_color 11 'fa/bd/2f'
|
||||
__printf_color 12 '83/a5/98'
|
||||
__printf_color 13 'd3/86/9b'
|
||||
__printf_color 14 '8e/c0/7c'
|
||||
__printf_color 15 $fg
|
||||
end
|
||||
|
||||
function __theme_gruvbox_palette
|
||||
__printf_color 236 '32/30/2f'
|
||||
__printf_color 234 '1d/20/21'
|
||||
|
||||
__printf_color 235 '28/28/28'
|
||||
__printf_color 237 '3c/38/36'
|
||||
__printf_color 239 '50/49/45'
|
||||
__printf_color 241 '66/5c/54'
|
||||
__printf_color 243 '7c/6f/64'
|
||||
|
||||
__printf_color 244 '92/83/74'
|
||||
__printf_color 245 '92/83/74'
|
||||
|
||||
__printf_color 228 'f2/e5/bc'
|
||||
__printf_color 230 'f9/f5/d7'
|
||||
|
||||
__printf_color 229 'fb/f1/c7'
|
||||
__printf_color 223 'eb/db/b2'
|
||||
__printf_color 250 'd5/c4/a1'
|
||||
__printf_color 248 'bd/ae/93'
|
||||
__printf_color 246 'a8/99/84'
|
||||
|
||||
__printf_color 167 'fb/49/34'
|
||||
__printf_color 142 'b8/bb/26'
|
||||
__printf_color 214 'fa/bd/2f'
|
||||
__printf_color 109 '83/a5/98'
|
||||
__printf_color 175 'd3/86/9b'
|
||||
__printf_color 108 '8e/c0/7c'
|
||||
__printf_color 208 'fe/80/19'
|
||||
|
||||
__printf_color 88 '9d/00/06'
|
||||
__printf_color 100 '79/74/0e'
|
||||
__printf_color 136 'b5/76/14'
|
||||
__printf_color 24 '07/66/78'
|
||||
__printf_color 96 '8f/3f/71'
|
||||
__printf_color 66 '42/7b/58'
|
||||
__printf_color 130 'af/3a/03'
|
||||
end
|
||||
|
||||
function __printf_color
|
||||
command printf "\033]4;$argv[1];rgb:$argv[2]\007"
|
||||
end
|
@ -1,11 +0,0 @@
|
||||
#!/usr/local/bin/fish
|
||||
|
||||
function tickers --description "Stock and money tickers"
|
||||
abbr -a tk 'tickrs -s'
|
||||
abbr -a vt 'tickrs -s vt'
|
||||
abbr -a vti 'tickrs -s vti'
|
||||
abbr -a vxus 'tickrs -s vxus'
|
||||
abbr -a btc 'rates btc usd'
|
||||
abbr -a ada 'rates ada usd'
|
||||
abbr -a eth 'rates eth usd'
|
||||
end
|
@ -1,11 +0,0 @@
|
||||
function today --description "Open today's journal"
|
||||
note-dates
|
||||
if [ -f $TODAY_NOTE_FILE ]
|
||||
vim $TODAY_NOTE_FILE
|
||||
else
|
||||
note-header
|
||||
printf $JOURNAL_HEADER > $TODAY_NOTE_FILE
|
||||
echo "New journal added."
|
||||
vim $TODAY_NOTE_FILE
|
||||
end
|
||||
end
|
25
fish.configlink/functions/uncommitted.fish
Executable file → Normal file
25
fish.configlink/functions/uncommitted.fish
Executable file → Normal file
@ -1,16 +1,11 @@
|
||||
#!/usr/local/bin/fish
|
||||
|
||||
function uncommitted --description "Find uncommitted git repos"
|
||||
set current_dir (pwd)
|
||||
cd $HOME/dev
|
||||
find . -type d -name '.git' | \
|
||||
while read dir
|
||||
cd $dir/../
|
||||
and if test -n (echo (git status -s))
|
||||
pwd
|
||||
git status -s
|
||||
end
|
||||
cd -
|
||||
end
|
||||
cd $current_dir
|
||||
set current_dir (pwd)
|
||||
cd $HOME/dev
|
||||
find . -type d -name '.git' | while read dir
|
||||
cd $dir/../
|
||||
and if test -n (echo (git status -s))
|
||||
pwd
|
||||
git status -s
|
||||
end
|
||||
cd -
|
||||
end
|
||||
cd $current_dir
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/local/fish
|
||||
|
||||
function unsetaws --description "Clear AWS credentials environment variables"
|
||||
set -e AWS_ACCESS_KEY_ID
|
||||
set -e AWS_SECRET_ACCESS_KEY
|
||||
end
|
@ -1,29 +0,0 @@
|
||||
# by @farcaller from https://github.com/fish-shell/fish-shell/issues/825#issuecomment-440286038
|
||||
|
||||
function up-or-search -d "Depending on cursor position and current mode, either search backward or move up one line"
|
||||
# If we are already in search mode, continue
|
||||
if commandline --search-mode
|
||||
commandline -f history-search-backward
|
||||
return
|
||||
end
|
||||
|
||||
# If we are navigating the pager, then up always navigates
|
||||
if commandline --paging-mode
|
||||
commandline -f up-line
|
||||
return
|
||||
end
|
||||
|
||||
# We are not already in search mode.
|
||||
# If we are on the top line, start search mode,
|
||||
# otherwise move up
|
||||
set lineno (commandline -L)
|
||||
|
||||
switch $lineno
|
||||
case 1
|
||||
commandline -f history-search-backward
|
||||
history merge # <-- ADDED THIS
|
||||
|
||||
case '*'
|
||||
commandline -f up-line
|
||||
end
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
function worldmap --description "Terminal atlas"
|
||||
telnet mapscii.me
|
||||
end
|
@ -227,6 +227,7 @@
|
||||
window = {
|
||||
border = 1;
|
||||
hideEdgeBorders = "both";
|
||||
titlebar = false;
|
||||
};
|
||||
workspaceAutoBackAndForth = false;
|
||||
workspaceOutputAssign = [ ];
|
||||
|
@ -25,5 +25,10 @@
|
||||
xclip # Clipboard
|
||||
];
|
||||
|
||||
home-manager.users.${user}.programs.fish.shellAliases = {
|
||||
pbcopy = "xclip -selection clipboard -in";
|
||||
pbpaste = "xclip -selection clipboard -out";
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,13 @@
|
||||
|
||||
programs.git.extraConfig.core.editor = "nvim";
|
||||
home.sessionVariables = { EDITOR = "nvim"; };
|
||||
programs.fish = {
|
||||
shellAliases = { vim = "nvim"; };
|
||||
shellAbbrs = {
|
||||
vll = "vim -c 'Telescope oldfiles'";
|
||||
vimrc = "vim ${builtins.toString ../../.}/nvim.configlink/init.lua";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
@ -3,15 +3,69 @@
|
||||
users.users.${user}.shell = pkgs.fish;
|
||||
|
||||
home-manager.users.${user} = {
|
||||
home.packages = with pkgs; [ fzf exa fd bat ripgrep ];
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
functions = { };
|
||||
functions = {
|
||||
commandline-git-commits = {
|
||||
description = "Insert commit into commandline";
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/commandline-git-commits.fish;
|
||||
};
|
||||
copy = {
|
||||
description = "Copy file contents into clipboard";
|
||||
body = "cat $argv | pbcopy"; # Need to fix for non-macOS
|
||||
};
|
||||
edit = {
|
||||
description = "Open a file in Vim";
|
||||
body = builtins.readFile ../../fish.configlink/functions/edit.fish;
|
||||
};
|
||||
envs = {
|
||||
description = "Evaluate a bash-like environment variables file";
|
||||
body = ''set -gx (cat $argv | tr "=" " " | string split ' ')'';
|
||||
};
|
||||
fcd = {
|
||||
description = "Jump to directory";
|
||||
argumentNames = "directory";
|
||||
body = builtins.readFile ../../fish.configlink/functions/fcd.fish;
|
||||
};
|
||||
fish_user_key_bindings = {
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/fish_user_key_bindings.fish;
|
||||
};
|
||||
ip = {
|
||||
body = builtins.readFile ../../fish.configlink/functions/ip.fish;
|
||||
};
|
||||
json = {
|
||||
description = "Tidy up JSON using jq";
|
||||
body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS
|
||||
};
|
||||
note = {
|
||||
description = "Edit or create a note";
|
||||
argumentNames = "filename";
|
||||
body = builtins.readFile ../../fish.configlink/functions/note.fish;
|
||||
};
|
||||
projects = {
|
||||
description = "Jump to a project";
|
||||
body = ''
|
||||
set projdir (ls $PROJ | fzf)
|
||||
and cd $PROJ/$projdir
|
||||
and commandline -f execute
|
||||
'';
|
||||
};
|
||||
recent = {
|
||||
description = "Open a recent file in Vim";
|
||||
body = builtins.readFile ../../fish.configlink/functions/recent.fish;
|
||||
};
|
||||
syncnotes = {
|
||||
description = "Full git commit on notes";
|
||||
body =
|
||||
builtins.readFile ../../fish.configlink/functions/syncnotes.fish;
|
||||
};
|
||||
};
|
||||
interactiveShellInit = "";
|
||||
loginShellInit = "";
|
||||
shellAliases = {
|
||||
vim = "nvim";
|
||||
sudo = "doas";
|
||||
};
|
||||
shellAliases = { ls = "exa"; };
|
||||
shellAbbrs = {
|
||||
|
||||
# Directory aliases
|
||||
@ -40,17 +94,11 @@
|
||||
# Vim
|
||||
v = "vim";
|
||||
vl = "vim -c 'normal! `0'";
|
||||
vll = "vim -c 'Telescope oldfiles'";
|
||||
vimrc = "vim ${builtins.toString ../../.}/nvim.configlink/init.lua";
|
||||
|
||||
# Notes
|
||||
qn = "quicknote";
|
||||
sn = "syncnotes";
|
||||
to = "today";
|
||||
work = "vim $NOTES_PATH/work.md";
|
||||
|
||||
# CLI Tools
|
||||
cat = "bat"; # Swap cat with bat
|
||||
h = "http -Fh --all"; # Curl site for headers
|
||||
m = "make"; # For makefiles
|
||||
|
||||
@ -90,7 +138,6 @@
|
||||
ca = "cargo";
|
||||
|
||||
};
|
||||
shellAliases = { };
|
||||
shellInit = "";
|
||||
};
|
||||
|
||||
@ -113,7 +160,6 @@
|
||||
|
||||
xdg.configFile = {
|
||||
"starship.toml".source = ../../starship/starship.toml.configlink;
|
||||
"fish/functions".source = ../../fish.configlink/functions;
|
||||
};
|
||||
|
||||
programs.direnv = {
|
||||
|
@ -1,4 +1,8 @@
|
||||
{ pkgs, user, fullName, ... }: {
|
||||
{ config, pkgs, lib, user, fullName, ... }:
|
||||
|
||||
let home-packages = config.home-manager.users.${user}.home.packages;
|
||||
|
||||
in {
|
||||
|
||||
home-manager.users.${user} = {
|
||||
programs.git = {
|
||||
@ -25,7 +29,7 @@
|
||||
gcae = "git commit --amend";
|
||||
gu = "git pull";
|
||||
gp = "git push";
|
||||
gpp = "git_set_upstream";
|
||||
gpp = "git-push-upstream";
|
||||
gl = "git log --graph --decorate --oneline -20";
|
||||
gll = "git log --graph --decorate --oneline";
|
||||
gco = "git checkout";
|
||||
@ -40,6 +44,68 @@
|
||||
gcp = "git cherry-pick";
|
||||
cdg = "cd (git rev-parse --show-toplevel)";
|
||||
};
|
||||
|
||||
programs.fish.functions = lib.mkIf (builtins.elem pkgs.fzf home-packages
|
||||
&& builtins.elem pkgs.bat home-packages) {
|
||||
git = {
|
||||
body = builtins.readFile ../../fish.configlink/functions/git.fish;
|
||||
};
|
||||
git-add-fuzzy = {
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-add-fuzzy.fish;
|
||||
};
|
||||
git-fuzzy-branch = {
|
||||
argumentNames = "header";
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-fuzzy-branch.fish;
|
||||
};
|
||||
git-checkout-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "checkout branch...")
|
||||
and git checkout $branch
|
||||
'';
|
||||
};
|
||||
git-delete-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "delete branch...")
|
||||
and git branch -d $branch
|
||||
'';
|
||||
};
|
||||
git-force-delete-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "force delete branch...")
|
||||
and git branch -D $branch
|
||||
'';
|
||||
};
|
||||
git-merge-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "merge from...")
|
||||
and git merge $branch
|
||||
'';
|
||||
};
|
||||
git-show-fuzzy = {
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-show-fuzzy.fish;
|
||||
};
|
||||
git-commits = {
|
||||
body =
|
||||
builtins.readFile ../../fish.configlink/functions/git-commits.fish;
|
||||
};
|
||||
git-history = {
|
||||
body =
|
||||
builtins.readFile ../../fish.configlink/functions/git-history.fish;
|
||||
};
|
||||
git-push-upstream = {
|
||||
description = "Create upstream branch";
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-push-upstream.fish;
|
||||
};
|
||||
uncommitted = {
|
||||
description = "Find uncommitted git repos";
|
||||
body =
|
||||
builtins.readFile ../../fish.configlink/functions/uncommitted.fish;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -9,13 +9,25 @@
|
||||
settings.git_protocol = "https";
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
ghr = "gh repo view -w";
|
||||
gha =
|
||||
"gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view";
|
||||
grw = "gh run watch";
|
||||
grf = "gh run view --log-failed";
|
||||
grl = "gh run view --log";
|
||||
programs.fish = {
|
||||
shellAbbrs = {
|
||||
ghr = "gh repo view -w";
|
||||
gha =
|
||||
"gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view";
|
||||
grw = "gh run watch";
|
||||
grf = "gh run view --log-failed";
|
||||
grl = "gh run view --log";
|
||||
};
|
||||
functions = {
|
||||
repos = {
|
||||
description = "Clone GitHub repositories";
|
||||
argumentNames = "organization";
|
||||
body = ''
|
||||
set directory (gh-repos $organization)
|
||||
and cd $directory
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -13,32 +13,45 @@ let
|
||||
|
||||
in {
|
||||
|
||||
home-manager.users.${user}.home = {
|
||||
home-manager.users.${user} = {
|
||||
|
||||
packages = with pkgs; [
|
||||
home.packages = with pkgs; [
|
||||
unzip
|
||||
rsync
|
||||
fzf
|
||||
ripgrep
|
||||
bat
|
||||
fd
|
||||
exa
|
||||
sd
|
||||
zoxide
|
||||
jq
|
||||
tealdeer
|
||||
gh
|
||||
direnv
|
||||
tree
|
||||
htop
|
||||
glow
|
||||
prettyping
|
||||
qrencode
|
||||
];
|
||||
|
||||
file = {
|
||||
home.file = {
|
||||
".rgignore".text = ignorePatterns;
|
||||
".fdignore".text = ignorePatterns;
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
cat = "bat"; # Swap cat with bat
|
||||
};
|
||||
|
||||
programs.fish.functions = {
|
||||
ping = {
|
||||
description = "Improved ping";
|
||||
argumentNames = "target";
|
||||
body = "prettyping --nolegend $target";
|
||||
};
|
||||
qr = {
|
||||
body =
|
||||
"qrencode $argv[1] -o /tmp/qr.png | open /tmp/qr.png"; # Fix for non-macOS
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Replace sudo with doas
|
||||
|
||||
{ ... }: {
|
||||
{ user, ... }: {
|
||||
|
||||
security = {
|
||||
|
||||
@ -23,4 +23,6 @@
|
||||
}];
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.${user}.programs.fish.shellAliases = { sudo = "doas"; };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user