summaryrefslogtreecommitdiff
path: root/mac/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'mac/.local/bin')
-rwxr-xr-xmac/.local/bin/bmshortcuts20
-rwxr-xr-xmac/.local/bin/fzffiles2
-rwxr-xr-xmac/.local/bin/hugow54
-rwxr-xr-xmac/.local/bin/lastfiles (renamed from mac/.local/bin/lastnvim)0
4 files changed, 41 insertions, 35 deletions
diff --git a/mac/.local/bin/bmshortcuts b/mac/.local/bin/bmshortcuts
index 2a8d3fa..af4ad58 100755
--- a/mac/.local/bin/bmshortcuts
+++ b/mac/.local/bin/bmshortcuts
@@ -10,7 +10,13 @@ zsh_named_dirs="${XDG_CONFIG_HOME:-${HOME}/.config}/shell/zshnameddirrc"
command -v lf && lf_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/lf/shortcutrc" || lf_shortcuts="/dev/null"
command -v vim && vim_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/vim/shortcuts.vim" || vim_shortcuts="/dev/null"
command -v nvim && nvim_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/nvim/shortcuts.lua" || nvim_shortcuts="/dev/null"
-command -v yazi && yazi_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/yazi/keymap.toml" || yazi_shortcuts="/dev/null"
+if command -v yazi; then
+ yazi_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/yazi/keymap.toml"
+ yazi_shortcuts_tmp="$yazi_shortcuts.tmp"
+else
+ yazi_shortcuts="/dev/null"
+ yazi_shortcuts_tmp="/dev/null"
+fi
command -v ranger && ranger_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/ranger/shortcuts.conf" || ranger_shortcuts="/dev/null"
command -v qutebrowser && qute_shortcuts="$HOME/.qutebrowser/shortcuts.py" || qute_shortcuts="/dev/null"
command -v fish && fish_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/fish/shortcuts.fish" || fish_shortcuts="/dev/null"
@@ -22,7 +28,7 @@ printf "# vim: filetype=sh\\n" >"$fish_shortcuts"
printf "# vim: filetype=sh\\nalias " >"$shell_shortcuts"
printf "# vim: filetype=sh\\n" >"$shell_env_shortcuts"
printf "\" vim: filetype=vim\\n" >"$vifm_shortcuts"
-cp "$HOME/.config/yazi/keymap-default.toml" "$yazi_shortcuts"
+[ -f "$HOME/.config/yazi/keymap-default.toml" ] && cp "$HOME/.config/yazi/keymap-default.toml" "$yazi_shortcuts"
# Format the `directories` file in the correct syntax and sent it to all three configs.
eval "echo \"$(cat "$bmdirs")\"" |
@@ -43,7 +49,7 @@ eval "echo \"$(cat "$bmdirs")\"" |
printf(\"vim.keymap.set('n', '<localleader><localleader>%s', function() require('mini.files').open('%s') end, { noremap = true, silent = true, desc = '%s' })\n\", \$1, \$2, desc_path) >> \"$nvim_shortcuts\" ;
desc_path = \$2; gsub(\"^/home/$USER/\",\"~/\",desc_path);
key_array = \"\"; for(i=1; i<=length(\$1); i++) { if(i==1) key_array = \"\\\"\" substr(\$1,i,1) \"\\\"\"; else key_array = key_array \", \\\"\" substr(\$1,i,1) \"\\\"\" }
- printf(\"\\t{ on = [ %s ], run = \\\"cd %s\\\", desc = \\\"Go to %s\\\" },\\n\",key_array,\$2,desc_path) >> \"$yazi_shortcuts.tmp\"}"
+ printf(\"\\t{ on = [ %s ], run = \\\"cd %s\\\", desc = \\\"Go to %s\\\" },\\n\",key_array,\$2,desc_path) >> \"$yazi_shortcuts_tmp\"}"
# Format the `files` file in the correct syntax and sent it to both configs.
eval "echo \"$(cat "$bmfiles")\"" |
@@ -66,10 +72,10 @@ eval "echo \"$(cat "$bmfiles")\"" |
printf(\"vim.keymap.set('n', '<localleader><localleader>%s', '<cmd>e %s<cr>', { noremap = true, silent = true, desc = '%s' })\n\", \$1, \$2, desc_path) >> \"$nvim_shortcuts\" ;
desc_path = \$2; gsub(\"^/home/$USER/\",\"~/\",desc_path);
key_array = \"\"; for(i=1; i<=length(\$1); i++) { if(i==1) key_array = \"\\\"\" substr(\$1,i,1) \"\\\"\"; else key_array = key_array \", \\\"\" substr(\$1,i,1) \"\\\"\" }
- printf(\"\\t{ on = [ %s ], run = [ 'reveal %s', 'open' ], desc = \\\"Open %s\\\" },\\n\", key_array, \$2, desc_path) >> \"$yazi_shortcuts.tmp\" }"
+ printf(\"\\t{ on = [ %s ], run = [ 'reveal %s', 'open' ], desc = \\\"Open %s\\\" },\\n\", key_array, \$2, desc_path) >> \"$yazi_shortcuts_tmp\" }"
# Merge bookmarks into keymap-default.toml
-if [ -f "$yazi_shortcuts.tmp" ]; then
+if [ -f "$yazi_shortcuts_tmp" ]; then
# Find the line with the closing bracket in the [mgr] section
line_num=$(grep -n "^]" "$yazi_shortcuts" | head -1 | cut -d: -f1)
@@ -77,11 +83,11 @@ if [ -f "$yazi_shortcuts.tmp" ]; then
head -n $((line_num - 1)) "$yazi_shortcuts" >"$yazi_shortcuts.new"
echo "" >>"$yazi_shortcuts.new"
echo " # Custom bookmarks" >>"$yazi_shortcuts.new"
- cat "$yazi_shortcuts.tmp" >>"$yazi_shortcuts.new"
+ cat "$yazi_shortcuts_tmp" >>"$yazi_shortcuts.new"
echo "]" >>"$yazi_shortcuts.new"
tail -n +$((line_num + 1)) "$yazi_shortcuts" >>"$yazi_shortcuts.new"
# Replace the original file
mv "$yazi_shortcuts.new" "$yazi_shortcuts"
- rm -f "$yazi_shortcuts.tmp"
+ rm -f "$yazi_shortcuts_tmp"
fi
diff --git a/mac/.local/bin/fzffiles b/mac/.local/bin/fzffiles
index 44634a2..97047e9 100755
--- a/mac/.local/bin/fzffiles
+++ b/mac/.local/bin/fzffiles
@@ -53,7 +53,7 @@ files=$(fzf-tmux \
--bind "ctrl-g:change-prompt(  )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME/Private/repos $HOME/Public/repos)" \
--bind "ctrl-h:change-prompt( 🏠 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME)" \
--bind "ctrl-k:change-prompt( 🖥️ )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . ${XDG_DESKTOP_DIR:-${HOME}/Desktop})" \
- --bind "ctrl-r:change-prompt( 👟 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache -E zsh . ${XDG_BIN_HOME:-${HOME}/.local/bin})" \
+ --bind "ctrl-r:change-prompt( 👟 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache -E zsh . ${XDG_SCRIPTS_HOME:-${HOME}/.local/bin})" \
--bind "ctrl-s:change-prompt( 🛠 )+reload(find ${XDG_SOURCES_HOME:-${HOME}/.local/src}/suckless -maxdepth 2 -type f -not -path '*/.git/*')" \
--bind "ctrl-u:change-prompt( 📝 )+reload(if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then top=\$(git rev-parse --show-toplevel 2>/dev/null); git -C \"\$top\" status --porcelain | awk -v root=\"\$top\" '{
staged=substr(\$0,1,1);
diff --git a/mac/.local/bin/hugow b/mac/.local/bin/hugow
index 0460174..e9113a0 100755
--- a/mac/.local/bin/hugow
+++ b/mac/.local/bin/hugow
@@ -18,33 +18,33 @@ fi
tmp="$(mktemp "$out.XXXXXXXX.tmp")"
-awk -v defaults="$defaults" '
-BEGIN {
- n = split(defaults, a, /[[:space:]]+/)
- insert = ""
- for (i = 1; i <= n; i++) {
- if (a[i] == "") continue
- name = a[i] ".mp4"
- insert = insert \
-" <li>\n" \
-" <a href=\"/recordings/" name "\" data-name=\"" name "\" class=\"vid\">" name "</a>\n" \
-" </li>\n"
- }
- injected = 0
-}
-{
- print
- if (!injected && $0 ~ /<ul[^>]*id=["'\''"]list["'\''"][^>]*>/) {
- printf("%s", insert)
- injected = 1
- }
-}
-END { if (!injected) exit 2 }
-' "$out" >"$tmp"
-
-mv "$tmp" "$out"
-echo "Injected defaults into: $out"
-
+# awk -v defaults="$defaults" '
+# BEGIN {
+# n = split(defaults, a, /[[:space:]]+/)
+# insert = ""
+# for (i = 1; i <= n; i++) {
+# if (a[i] == "") continue
+# name = a[i] ".mp4"
+# insert = insert \
+# " <li>\n" \
+# " <a href=\"/recordings/" name "\" data-name=\"" name "\" class=\"vid\">" name "</a>\n" \
+# " </li>\n"
+# }
+# injected = 0
+# }
+# {
+# print
+# if (!injected && $0 ~ /<ul[^>]*id=["'\''"]list["'\''"][^>]*>/) {
+# printf("%s", insert)
+# injected = 1
+# }
+# }
+# END { if (!injected) exit 2 }
+# ' "$out" >"$tmp"
+#
+# mv "$tmp" "$out"
+# echo "Injected defaults into: $out"
+#
ssh "$server" "mkdir -p '$dest'"
if [ -n "${THESIAH_SSH_OPTS:-}" ]; then
diff --git a/mac/.local/bin/lastnvim b/mac/.local/bin/lastfiles
index b1ab6c9..b1ab6c9 100755
--- a/mac/.local/bin/lastnvim
+++ b/mac/.local/bin/lastfiles