summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-09-13 21:11:23 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-09-13 21:11:23 +0900
commit486c7a1f93cae77a0bf9bc384b093f0bd6b663ff (patch)
tree57664fa3029afb8d7894f3f712aafda07a73f1d7
parentbdc608acabe856db2134642816cc806b34894863 (diff)
modified plugins/docker.lua, modified yazi/keymap-default.toml, modified shell/bm-dirs, modified yazi/keymap-default.toml, created plugins/ufo.lua
-rw-r--r--ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/docker.lua75
-rw-r--r--ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ufo.lua138
-rw-r--r--ar/.config/yazi/keymap-default.toml12
-rw-r--r--mac/.config/shell/bm-dirs7
-rw-r--r--mac/.config/yazi/keymap-default.toml12
5 files changed, 205 insertions, 39 deletions
diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/docker.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/docker.lua
index 7bc26d5..3244fc9 100644
--- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/docker.lua
+++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/docker.lua
@@ -2,33 +2,62 @@ return {
"https://codeberg.org/esensar/nvim-dev-container",
dependencies = "nvim-treesitter/nvim-treesitter",
config = function()
+ vim.api.nvim_create_autocmd("User", {
+ pattern = "DevcontainerBuildProgress",
+ callback = function()
+ vim.cmd("redrawstatus")
+ end,
+ })
require("devcontainer").setup({
config_search_start = function()
- -- By default this function uses vim.loop.cwd()
- -- This is used to find a starting point for .devcontainer.json file search
- -- Since by default, it is searched for recursively
- -- That behavior can also be disabled
+ if vim.g.devcontainer_selected_config == nil or vim.g.devcontainer_selected_config == "" then
+ local candidates = vim.split(
+ vim.fn.glob(vim.loop.cwd() .. "/.devcontainer/**/devcontainer.json"),
+ "\n",
+ { trimempty = true }
+ )
+ if #candidates < 2 then
+ vim.g.devcontainer_selected_config = vim.loop.cwd()
+ else
+ local choices = { "Select devcontainer config file to use:" }
+ for idx, candidate in ipairs(candidates) do
+ table.insert(choices, idx .. ". - " .. candidate)
+ end
+ local choice_idx = vim.fn.inputlist(choices)
+ if choice_idx > #candidates then
+ choice_idx = 1
+ end
+ vim.g.devcontainer_selected_config =
+ string.gsub(candidates[choice_idx], "/devcontainer.json", "")
+ end
+ end
+ return vim.g.devcontainer_selected_config
end,
workspace_folder_provider = function()
-- By default this function uses first workspace folder for integrated lsp if available and vim.loop.cwd() as a fallback
-- This is used to replace `${localWorkspaceFolder}` in devcontainer.json
-- Also used for creating default .devcontainer.json file
- end,
- terminal_handler = function(command)
- -- By default this function creates a terminal in a new tab using :terminal command
- -- It also removes statusline when that tab is active, to prevent double statusline
- -- It can be overridden to provide custom terminal handling
- end,
- nvim_installation_commands_provider = function(path_binaries, version_string)
- -- Returns table - list of commands to run when adding neovim to container
- -- Each command can either be a string or a table (list of command parts)
- -- Takes binaries available in path on current container and version_string passed to the command or current version of neovim
- end,
- devcontainer_json_template = function()
- -- Returns table - list of lines to set when creating new devcontainer.json files
- -- As a template
- -- Used only when using functions from commands module or created commands
- end,
+ local bufdir = vim.fn.expand("%:p:h")
+ if bufdir ~= nil and bufdir ~= "" then
+ return bufdir
+ end
+ return vim.loop.cwd() or vim.fn.getcwd() or "."
+ end,
+ -- terminal_handler = function(command)
+ -- -- By default this function creates a terminal in a new tab using :terminal command
+ -- -- It also removes statusline when that tab is active, to prevent double statusline
+ -- -- It can be overridden to provide custom terminal handling
+ -- end,
+ -- nvim_installation_commands_provider = function(path_binaries, version_string)
+ -- -- Returns table - list of commands to run when adding neovim to container
+ -- -- Each command can either be a string or a table (list of command parts)
+ -- -- Takes binaries available in path on current container and version_string passed to the command or current version of neovim
+ -- end,
+ -- devcontainer_json_template = function()
+ -- -- Returns table - list of lines to set when creating new devcontainer.json files
+ -- -- As a template
+ -- -- Used only when using functions from commands module or created commands
+ -- end,
-- Can be set to false to prevent generating default commands
-- Default commands are listed below
generate_commands = true,
@@ -58,7 +87,7 @@ return {
attach_mounts = {
neovim_config = {
-- enables mounting local config to /root/.config/nvim in container
- enabled = false,
+ enabled = true,
-- makes mount readonly in container
options = { "readonly" },
},
@@ -83,13 +112,13 @@ return {
-- This takes a string (usually either "podman" or "docker") representing container runtime - "devcontainer-cli" is also partially supported
-- That is the command that will be invoked for container operations
-- If it is nil, plugin will use whatever is available (trying "podman" first)
- container_runtime = nil,
+ container_runtime = "docker",
-- Similar to container runtime, but will be used if main runtime does not support an action - useful for "devcontainer-cli"
backup_runtime = nil,
-- This takes a string (usually either "podman-compose" or "docker-compose") representing compose command - "devcontainer-cli" is also partially supported
-- That is the command that will be invoked for compose operations
-- If it is nil, plugin will use whatever is available (trying "podman-compose" first)
- compose_command = nil,
+ compose_command = "docker-compose",
-- Similar to compose command, but will be used if main command does not support an action - useful for "devcontainer-cli"
backup_compose_command = nil,
})
diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ufo.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ufo.lua
new file mode 100644
index 0000000..ca7cf03
--- /dev/null
+++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ufo.lua
@@ -0,0 +1,138 @@
+return {
+ "kevinhwang91/nvim-ufo",
+ dependencies = { "kevinhwang91/promise-async" },
+ cmd = {
+ "UfoEnable",
+ "UfoDisable",
+ "UfoInspect",
+ "UfoAttach",
+ "UfoDetach",
+ "UfoEnableFold",
+ "UfoDisableFold",
+ },
+ config = function()
+ vim.o.foldcolumn = "1"
+ vim.o.foldlevel = 99
+ vim.o.foldlevelstart = 99
+ vim.o.foldenable = true
+
+ local caps = vim.lsp.protocol.make_client_capabilities()
+ caps.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true }
+ local ok_cmp, cmp = pcall(require, "cmp_nvim_lsp")
+ if ok_cmp then
+ caps = cmp.default_capabilities(caps)
+ end
+ local lsp_util = require("lspconfig.util")
+ lsp_util.default_config = lsp_util.default_config or {}
+ lsp_util.default_config.capabilities =
+ vim.tbl_deep_extend("force", lsp_util.default_config.capabilities or {}, caps)
+
+ local ftMap = {
+ vim = "indent",
+ python = { "indent" },
+ git = "",
+ markdown = { "treesitter", "indent" },
+ }
+
+ local function chain_selector(bufnr)
+ local ufo = require("ufo")
+ local Promise = require("promise")
+ local function fallback(err, provider)
+ if type(err) == "string" and err:match("UfoFallbackException") then
+ return ufo.getFolds(bufnr, provider)
+ else
+ return Promise.reject(err)
+ end
+ end
+ return require("ufo")
+ .getFolds(bufnr, "lsp")
+ :catch(function(err)
+ return fallback(err, "treesitter")
+ end)
+ :catch(function(err)
+ return fallback(err, "indent")
+ end)
+ end
+
+ local function fold_virt_text_handler(virtText, lnum, endLnum, width, truncate)
+ local newVirtText = {}
+ local suffix = (" 󰁂 %d "):format(endLnum - lnum)
+ local sufWidth = vim.fn.strdisplaywidth(suffix)
+ local targetWidth = width - sufWidth
+ local curWidth = 0
+ for _, chunk in ipairs(virtText) do
+ local text, hl = chunk[1], chunk[2]
+ local chunkWidth = vim.fn.strdisplaywidth(text)
+ if targetWidth > curWidth + chunkWidth then
+ table.insert(newVirtText, { text, hl })
+ else
+ local truncated = truncate(text, targetWidth - curWidth)
+ table.insert(newVirtText, { truncated, hl })
+ chunkWidth = vim.fn.strdisplaywidth(truncated)
+ if curWidth + chunkWidth < targetWidth then
+ suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
+ end
+ break
+ end
+ curWidth = curWidth + chunkWidth
+ end
+ table.insert(newVirtText, { suffix, "MoreMsg" })
+ return newVirtText
+ end
+
+ local function peek_or_hover()
+ local ufo = require("ufo")
+ local winid = ufo.peekFoldedLinesUnderCursor()
+ if winid then
+ local bufnr = vim.api.nvim_win_get_buf(winid)
+ for _, k in ipairs({ "a", "i", "o", "A", "I", "O", "gd", "gr" }) do
+ vim.keymap.set("n", k, "<CR>" .. k, { noremap = false, buffer = bufnr })
+ end
+ else
+ if vim.lsp.buf.hover then
+ vim.lsp.buf.hover()
+ end
+ end
+ end
+
+ local function go_prev_and_peek()
+ require("ufo").goPreviousClosedFold()
+ require("ufo").peekFoldedLinesUnderCursor()
+ end
+
+ local function go_next_and_peek()
+ require("ufo").goNextClosedFold()
+ require("ufo").peekFoldedLinesUnderCursor()
+ end
+
+ local function apply_folds_then_close_all(providerName)
+ require("async")(function()
+ local bufnr = vim.api.nvim_get_current_buf()
+ require("ufo").attach(bufnr)
+ local ranges = await(require("ufo").getFolds(bufnr, providerName))
+ if not vim.tbl_isempty(ranges) then
+ if require("ufo").applyFolds(bufnr, ranges) then
+ require("ufo").closeAllFolds()
+ end
+ end
+ end)
+ end
+
+ require("ufo").setup({
+ provider_selector = function(bufnr, filetype, buftype)
+ return ftMap[filetype] or chain_selector
+ end,
+ fold_virt_text_handler = fold_virt_text_handler,
+ enable_get_fold_virt_text = true,
+ })
+
+ vim.keymap.set("n", "zM", require("ufo").closeAllFolds, { desc = "Close all folds" })
+ vim.keymap.set("n", "zR", require("ufo").openAllFolds, { desc = "Open all folds" })
+ vim.keymap.set("n", "zp", peek_or_hover, { desc = "Peek folded / LSP hover" })
+ vim.keymap.set("n", "[z", go_prev_and_peek, { desc = "Prev fold & peek" })
+ vim.keymap.set("n", "]z", go_next_and_peek, { desc = "Next fold & peek" })
+ vim.keymap.set("n", "<leader>za", function()
+ apply_folds_then_close_all("lsp")
+ end, { desc = "Apply LSP folds & close all" })
+ end,
+}
diff --git a/ar/.config/yazi/keymap-default.toml b/ar/.config/yazi/keymap-default.toml
index ae8601b..ea5c7fd 100644
--- a/ar/.config/yazi/keymap-default.toml
+++ b/ar/.config/yazi/keymap-default.toml
@@ -81,8 +81,8 @@ keymap = [
{ on = ";", run = "shell --interactive", desc = "Run a shell command" },
{ on = ":", run = "shell --block --interactive", desc = "Run a shell command (block until finishes)" },
{ on = ".", run = "hidden toggle", desc = "Toggle the visibility of hidden files" },
- { on = "s", run = "search --via=fd", desc = "Search files by name via fd" },
- { on = "S", run = "search --via=rg", desc = "Search files by content via ripgrep" },
+ { on = [ "s", "f" ],run = "search --via=fd", desc = "Search files by name via fd" },
+ { on = [ "S", "f" ],run = "search --via=rg", desc = "Search files by content via ripgrep" },
{ on = "<C-s>", run = "escape --search", desc = "Cancel the ongoing search" },
{ on = "z", run = "plugin fzf", desc = "Jump to a file/directory via fzf" },
{ on = "Z", run = "plugin zoxide", desc = "Jump to a directory via zoxide" },
@@ -133,7 +133,7 @@ keymap = [
{ on = [ "g", "l" ], run = "follow", desc = "Follow hovered symlink" },
# Tabs
- { on = "t", run = "tab_create --current", desc = "Create a new tab with CWD" },
+ { on = "<C-t>", run = "tab_create --current", desc = "Create a new tab with CWD" },
{ on = "1", run = "tab_switch 0", desc = "Switch to first tab" },
{ on = "2", run = "tab_switch 1", desc = "Switch to second tab" },
@@ -152,7 +152,7 @@ keymap = [
{ on = "}", run = "tab_swap 1", desc = "Swap current tab with next tab" },
# Tasks
- { on = "w", run = "tasks:show", desc = "Show task manager" },
+ { on = [ "t", "a" ], run = "tasks:show", desc = "Show task manager" },
# Help
{ on = "~", run = "help", desc = "Open help" },
@@ -215,7 +215,7 @@ run = "plugin smart-paste"
desc = "Paste into the hovered directory or CWD"
[[mgr.prepend_keymap]]
-on = "<C-t>"
+on = [ "s", "d" ]
run = "plugin sudo-demo"
[[mgr.prepend_keymap]]
@@ -250,7 +250,7 @@ keymap = [
{ on = "<Esc>", run = "close", desc = "Close task manager" },
{ on = "<C-[>", run = "close", desc = "Close task manager" },
{ on = "<C-c>", run = "close", desc = "Close task manager" },
- { on = "w", run = "close", desc = "Close task manager" },
+ { on = [ "t", "a" ], run = "close", desc = "Close task manager" },
{ on = "k", run = "arrow prev", desc = "Previous task" },
{ on = "j", run = "arrow next", desc = "Next task" },
diff --git a/mac/.config/shell/bm-dirs b/mac/.config/shell/bm-dirs
index 8e27ad7..7a6d481 100644
--- a/mac/.config/shell/bm-dirs
+++ b/mac/.config/shell/bm-dirs
@@ -51,7 +51,8 @@ Cme /media/$USER
Cmt /mnt
Cmw /usr/local/share/mutt-wizard
Crr /run/runit/service
-Csc /mnt/second
+Csc /etc/samba
+Csd /mnt/second
Csg /media/$USER/storage/G
Csm /media/$USER/samba
Css /media/$USER/ssd
@@ -59,11 +60,9 @@ Cst /media/$USER/storage
Cvt /media/$USER/Ventoy
Cvv /mnt/second/videos
Cwv /media/$USER/win10/Videos
-dot ${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}
-Esm /etc/samba
-Esv /etc/runit/sv
gdc ${XDG_DOCUMENTS_DIR:-${HOME}/Documents}
gdk ${XDG_DESKTOP_DIR:-${HOME}/Desktop}
+gdt ${XDG_DOTFILES_DIR:-${HOME}/.dotfiles}
gdn ${XDG_DOWNLOAD_DIR:-${HOME}/Downloads}
gfx $HOME/.mozilla/firefox/$USER.default
gmu ${XDG_MUSIC_DIR:-${HOME}/Music}
diff --git a/mac/.config/yazi/keymap-default.toml b/mac/.config/yazi/keymap-default.toml
index ae8601b..ea5c7fd 100644
--- a/mac/.config/yazi/keymap-default.toml
+++ b/mac/.config/yazi/keymap-default.toml
@@ -81,8 +81,8 @@ keymap = [
{ on = ";", run = "shell --interactive", desc = "Run a shell command" },
{ on = ":", run = "shell --block --interactive", desc = "Run a shell command (block until finishes)" },
{ on = ".", run = "hidden toggle", desc = "Toggle the visibility of hidden files" },
- { on = "s", run = "search --via=fd", desc = "Search files by name via fd" },
- { on = "S", run = "search --via=rg", desc = "Search files by content via ripgrep" },
+ { on = [ "s", "f" ],run = "search --via=fd", desc = "Search files by name via fd" },
+ { on = [ "S", "f" ],run = "search --via=rg", desc = "Search files by content via ripgrep" },
{ on = "<C-s>", run = "escape --search", desc = "Cancel the ongoing search" },
{ on = "z", run = "plugin fzf", desc = "Jump to a file/directory via fzf" },
{ on = "Z", run = "plugin zoxide", desc = "Jump to a directory via zoxide" },
@@ -133,7 +133,7 @@ keymap = [
{ on = [ "g", "l" ], run = "follow", desc = "Follow hovered symlink" },
# Tabs
- { on = "t", run = "tab_create --current", desc = "Create a new tab with CWD" },
+ { on = "<C-t>", run = "tab_create --current", desc = "Create a new tab with CWD" },
{ on = "1", run = "tab_switch 0", desc = "Switch to first tab" },
{ on = "2", run = "tab_switch 1", desc = "Switch to second tab" },
@@ -152,7 +152,7 @@ keymap = [
{ on = "}", run = "tab_swap 1", desc = "Swap current tab with next tab" },
# Tasks
- { on = "w", run = "tasks:show", desc = "Show task manager" },
+ { on = [ "t", "a" ], run = "tasks:show", desc = "Show task manager" },
# Help
{ on = "~", run = "help", desc = "Open help" },
@@ -215,7 +215,7 @@ run = "plugin smart-paste"
desc = "Paste into the hovered directory or CWD"
[[mgr.prepend_keymap]]
-on = "<C-t>"
+on = [ "s", "d" ]
run = "plugin sudo-demo"
[[mgr.prepend_keymap]]
@@ -250,7 +250,7 @@ keymap = [
{ on = "<Esc>", run = "close", desc = "Close task manager" },
{ on = "<C-[>", run = "close", desc = "Close task manager" },
{ on = "<C-c>", run = "close", desc = "Close task manager" },
- { on = "w", run = "close", desc = "Close task manager" },
+ { on = [ "t", "a" ], run = "close", desc = "Close task manager" },
{ on = "k", run = "arrow prev", desc = "Previous task" },
{ on = "j", run = "arrow next", desc = "Next task" },