diff options
author | EuAndreh <eu@euandre.org> | 2022-05-15 18:21:06 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2022-05-15 18:21:09 -0300 |
commit | bf6b4e686dd387ee9ef0bcc2a8fb893a1007edaf (patch) | |
tree | 0b6e0acbc42a80e1cbc761c1fe6cfc9171627e89 | |
parent | etc/bash/rc(cosmetic): Move comment on extra files into if statement (diff) | |
download | dotfiles-bf6b4e686dd387ee9ef0bcc2a8fb893a1007edaf.tar.gz dotfiles-bf6b4e686dd387ee9ef0bcc2a8fb893a1007edaf.tar.xz |
etc/bash/rc: Move $V_FILES into v() function, use heredocs instead of strings
Having the $V_FILES variable inside the v() function allows it to be a
little bit more dynamic: files manually added to the list while editing
the file aren't included as new values without `reload`ing the rc file,
but new files created in the ~/Documents/txt/ directory are.
-rw-r--r-- | etc/bash/rc | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/etc/bash/rc b/etc/bash/rc index aaeec1e..0dbca5a 100644 --- a/etc/bash/rc +++ b/etc/bash/rc @@ -173,22 +173,23 @@ f() { fi } -V_FILES="$(echo " -~/Documents/txt/TODOs.md -~/Documents/txt/scratch.txt -$XDG_CONFIG_HOME/bash/rc -$XDG_CONFIG_HOME/guix/home.scm -$XDG_CONFIG_HOME/guix/system.scm -$(find ~/Documents/txt/*.md -not -name TODOs.md | - sed "s|^$HOME|~|" | - LANG=POSIX.UTF-8 sort) -~/dev/libre/package-repository/dependencies.dot -~/dev/others/dinheiros/dinheiros.ledger -~/dev/libre/dotfiles/sh/fake-symlinks.sh -$XDG_CONFIG_HOME/guix/channels.scm -" | tr ' ' '\n' | grep . | sed 's|^/home/andreh|~|')" - v() { + V_FILES="$( + cat <<-EOF | sed "s|$HOME|~|" + ~/Documents/txt/TODOs.md + ~/Documents/txt/scratch.txt + $XDG_CONFIG_HOME/bash/rc + $XDG_CONFIG_HOME/guix/home.scm + $XDG_CONFIG_HOME/guix/system.scm + $(find ~/Documents/txt/*.md -not -name TODOs.md | + sed "s|^$HOME|~|" | + LANG=POSIX.UTF-8 sort) + ~/dev/libre/package-repository/dependencies.dot + ~/dev/others/dinheiros/dinheiros.ledger + ~/dev/libre/dotfiles/sh/fake-symlinks.sh + $XDG_CONFIG_HOME/guix/channels.scm + EOF + )" f="$(echo "$V_FILES" | fzf --select-1 --exit-0 --query "$1")" if [ -n "$f" ]; then history -s v "$@" |