summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-11-19 23:50:08 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-11-19 23:50:08 +0900
commit234fa09e9c36677102ec6b10b713d432ee16be53 (patch)
treea69f3fe399651256e5e7721732da659c898bfa68
parent77107c3d6bba970add4a756dc9fd430637c5c235 (diff)
modified plugins/markdown.lua, modified bin/fzffiles, modified plugins/markdown.lua, modified bin/fzffiles
-rw-r--r--ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua10
-rwxr-xr-xar/.local/bin/fzffiles62
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua10
-rwxr-xr-xmac/.local/bin/fzffiles62
4 files changed, 116 insertions, 28 deletions
diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua
index de16ca6..a47db5a 100644
--- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua
+++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua
@@ -220,20 +220,20 @@ return {
end,
},
{
- -- Install markdown preview, use npx if available.
+ -- Install markdown preview, use npm if available.
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function(plugin)
- if vim.fn.executable("npx") then
- vim.cmd("!cd " .. plugin.dir .. " && cd app && npx install")
+ if vim.fn.executable("npm") then
+ vim.cmd("!cd " .. plugin.dir .. " && cd app && npm install")
else
vim.cmd([[Lazy load markdown-preview.nvim]])
vim.fn["mkdp#util#install"]()
end
end,
init = function()
- if vim.fn.executable("npx") then
+ if vim.fn.executable("npm") then
vim.g.mkdp_filetypes = { "markdown" }
end
local wk = require("which-key")
@@ -258,7 +258,7 @@ return {
},
cmd = { "LivePreview start", "LivePreview close", "LivePreview pick", "LivePreview help" },
init = function()
- if vim.fn.executable("npx") then
+ if vim.fn.executable("npm") then
vim.g.mkdp_filetypes = { "markdown" }
end
local wk = require("which-key")
diff --git a/ar/.local/bin/fzffiles b/ar/.local/bin/fzffiles
index d3255af..b98eee9 100755
--- a/ar/.local/bin/fzffiles
+++ b/ar/.local/bin/fzffiles
@@ -10,13 +10,44 @@ IFS='
# Get the list of selected files with key bindings for specific paths
files=$(fzf-tmux \
--header "^a pwd ^b public ^d .dotfiles ^f configs ^g git ^h home ^k desktop ^r scripts ^s suckless ^u staged files ^v private ^/ help" \
- --preview "target=\$(readlink -f {}) &&
+ --preview "selection={};
+ clean=\"\$selection\";
+ for icon in 📄 ✏️ ✅ ❌ 🔀 ❓; do
+ case \"\$clean\" in
+ \"\$icon \"*)
+ clean=\${clean#\"\$icon \"}
+ break
+ ;;
+ esac
+ done;
+ [ -z \"\$clean\" ] && { echo 'No selection'; exit 0; }
+ target=\$(readlink -f \"\$clean\" 2>/dev/null || printf '%s' \"\$clean\");
+ if [ -z \"\$target\" ]; then
+ echo 'Could not resolve path';
+ exit 0;
+ fi
+ if [ -f \"\$target\" ]; then
+ dir=\$(dirname \"\$target\");
+ if git_root=\$(git -C \"\$dir\" rev-parse --show-toplevel 2>/dev/null); then
+ rel=\${target#\"\$git_root\"/};
+ diff_output=\$(git -C \"\$git_root\" diff --color -- \"\$rel\");
+ if [ -n \"\$diff_output\" ]; then
+ printf '%s\n' \"\$diff_output\"
+ exit 0
+ fi
+ diff_output=\$(git -C \"\$git_root\" diff --color --cached -- \"\$rel\");
+ if [ -n \"\$diff_output\" ]; then
+ printf '%s\n' \"\$diff_output\"
+ exit 0
+ fi
+ fi
+ fi
if [ -d \"\$target\" ]; then
exa --color=always --long --all --header --icons --git \"\$target\"
elif [ -f \"\$target\" ]; then
bat --color=always --style=header,grid --line-range=:500 \"\$target\"
else
- file -h {}
+ file -h \"\$target\"
fi" \
--reverse \
--query="$1" \
@@ -38,14 +69,14 @@ files=$(fzf-tmux \
file=substr(\$0,4);
gsub(/^ +/, \"\", file);
if (file == \"\") next;
- if (staged == \"?\" && unstaged == \"?\") icon=\"🆕\";
- else if (staged == \"!\" && unstaged == \"!\") icon=\"🚫\";
- else if (staged != \" \" && staged != \"?\" && unstaged != \" \" && unstaged != \"?\") icon=\"🟪\";
- else if (staged != \" \" && staged != \"?\") icon=\"🟩\";
- else if (unstaged != \" \") icon=\"🟥\";
+ if (staged == \"?\" && unstaged == \"?\") icon=\"📄\";
+ else if (staged == \"!\" && unstaged == \"!\") icon=\"❌\";
+ else if (staged != \" \" && staged != \"?\" && unstaged != \" \" && unstaged != \"?\") icon=\"🔀\";
+ else if (staged != \" \" && staged != \"?\") icon=\"✅\";
+ else if (unstaged != \" \") icon=\"✏️\";
else icon=\"❓\";
print icon \" \" root \"/\" file
- }'; else echo 'This is not a git repository.'; fi)" \
+ }'; else echo 'This is not a git repository.'; fi)" \
--bind "ctrl-v:change-prompt( 🔒 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME/Private)" \
--bind 'ctrl-/:change-prompt( ❓ )+reload(echo "^a all
^b public
@@ -62,7 +93,20 @@ files=$(fzf-tmux \
# Check if any files were selected, and exit if not
[ -z "$files" ] && exit 0
-files=$(printf '%s\n' "$files" | sed 's/^[🟩🟥🟪🆕🚫❓] //')
+cleaned_files=$(printf '%s\n' "$files" | while IFS= read -r line; do
+ stripped="$line"
+ for icon in 📄 ✏️ ✅ ❌ 🔀 ❓; do
+ case "$stripped" in
+ "$icon "*)
+ stripped=${stripped#"$icon "}
+ break
+ ;;
+ esac
+ done
+ printf '%s\n' "$stripped"
+done)
+
+files="$cleaned_files"
if [ -d "$files" ]; then
absolute_files=$(realpath $files)
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua
index 0b01741..81beebb 100644
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua
@@ -207,20 +207,20 @@ return {
end,
},
{
- -- Install markdown preview, use npx if available.
+ -- Install markdown preview, use npm if available.
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function(plugin)
- if vim.fn.executable("npx") then
- vim.cmd("!cd " .. plugin.dir .. " && cd app && npx install")
+ if vim.fn.executable("npm") then
+ vim.cmd("!cd " .. plugin.dir .. " && cd app && npm install")
else
vim.cmd([[Lazy load markdown-preview.nvim]])
vim.fn["mkdp#util#install"]()
end
end,
init = function()
- if vim.fn.executable("npx") then
+ if vim.fn.executable("npm") then
vim.g.mkdp_filetypes = { "markdown" }
end
local wk = require("which-key")
@@ -245,7 +245,7 @@ return {
},
cmd = { "LivePreview start", "LivePreview close", "LivePreview pick", "LivePreview help" },
init = function()
- if vim.fn.executable("npx") then
+ if vim.fn.executable("npm") then
vim.g.mkdp_filetypes = { "markdown" }
end
local wk = require("which-key")
diff --git a/mac/.local/bin/fzffiles b/mac/.local/bin/fzffiles
index d3255af..e695c55 100755
--- a/mac/.local/bin/fzffiles
+++ b/mac/.local/bin/fzffiles
@@ -10,13 +10,44 @@ IFS='
# Get the list of selected files with key bindings for specific paths
files=$(fzf-tmux \
--header "^a pwd ^b public ^d .dotfiles ^f configs ^g git ^h home ^k desktop ^r scripts ^s suckless ^u staged files ^v private ^/ help" \
- --preview "target=\$(readlink -f {}) &&
+ --preview "selection={};
+ clean=\"\$selection\";
+ for icon in 📄 ✏️ ✅ ❌ 🔀 ❓; do
+ case \"\$clean\" in
+ \"\$icon \"*)
+ clean=\${clean#\"\$icon \"}
+ break
+ ;;
+ esac
+ done;
+ [ -z \"\$clean\" ] && { echo 'No selection'; exit 0; }
+ target=\$(readlink -f \"\$clean\" 2>/dev/null || printf '%s' \"\$clean\");
+ if [ -z \"\$target\" ]; then
+ echo 'Could not resolve path';
+ exit 0;
+ fi
+ if [ -f \"\$target\" ]; then
+ dir=\$(dirname \"\$target\");
+ if git_root=\$(git -C \"\$dir\" rev-parse --show-toplevel 2>/dev/null); then
+ rel=\${target#\"\$git_root\"/};
+ diff_output=\$(git -C \"\$git_root\" diff --color -- \"\$rel\");
+ if [ -n \"\$diff_output\" ]; then
+ printf '%s\n' \"\$diff_output\"
+ exit 0
+ fi
+ diff_output=\$(git -C \"\$git_root\" diff --color --cached -- \"\$rel\");
+ if [ -n \"\$diff_output\" ]; then
+ printf '%s\n' \"\$diff_output\"
+ exit 0
+ fi
+ fi
+ fi
if [ -d \"\$target\" ]; then
exa --color=always --long --all --header --icons --git \"\$target\"
elif [ -f \"\$target\" ]; then
bat --color=always --style=header,grid --line-range=:500 \"\$target\"
else
- file -h {}
+ file -h \"\$target\"
fi" \
--reverse \
--query="$1" \
@@ -38,14 +69,14 @@ files=$(fzf-tmux \
file=substr(\$0,4);
gsub(/^ +/, \"\", file);
if (file == \"\") next;
- if (staged == \"?\" && unstaged == \"?\") icon=\"🆕\";
- else if (staged == \"!\" && unstaged == \"!\") icon=\"🚫\";
- else if (staged != \" \" && staged != \"?\" && unstaged != \" \" && unstaged != \"?\") icon=\"🟪\";
- else if (staged != \" \" && staged != \"?\") icon=\"🟩\";
- else if (unstaged != \" \") icon=\"🟥\";
+ if (staged == \"?\" && unstaged == \"?\") icon=\"📄\";
+ else if (staged == \"!\" && unstaged == \"!\") icon=\"❌\";
+ else if (staged != \" \" && staged != \"?\" && unstaged != \" \" && unstaged != \"?\") icon=\"🔀\";
+ else if (staged != \" \" && staged != \"?\") icon=\"✅\";
+ else if (unstaged != \" \") icon=\"✏️\";
else icon=\"❓\";
print icon \" \" root \"/\" file
- }'; else echo 'This is not a git repository.'; fi)" \
+ }'; else echo 'This is not a git repository.'; fi)" \
--bind "ctrl-v:change-prompt( 🔒 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME/Private)" \
--bind 'ctrl-/:change-prompt( ❓ )+reload(echo "^a all
^b public
@@ -62,7 +93,20 @@ files=$(fzf-tmux \
# Check if any files were selected, and exit if not
[ -z "$files" ] && exit 0
-files=$(printf '%s\n' "$files" | sed 's/^[🟩🟥🟪🆕🚫❓] //')
+cleaned_files=$(printf '%s\n' "$files" | while IFS= read -r line; do
+ stripped="$line"
+ for icon in 📄 ✏️ ✅ ❌ 🔀 ❓; do
+ case "$stripped" in
+ "$icon "*)
+ stripped=${stripped#"$icon "}
+ break
+ ;;
+ esac
+ done
+ printf '%s\n' "$stripped"
+done)
+
+files="$cleaned_files"
if [ -d "$files" ]; then
absolute_files=$(realpath $files)