summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-09-12 19:06:10 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-09-12 19:06:10 +0900
commitedc9609f963aef18e9d3f8b4290f6a0f05f080e2 (patch)
tree105e0ba5439dca08deccae4d0ed31fbb645d7494
parentf5193092d18b04ad4c1937e2b2b120c596aca5d6 (diff)
updates
-rw-r--r--mac/.config/TheSiahxyz/ftplugin/markdown.lua51
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/core/autocmds.lua34
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/core/keymaps.lua2
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua12
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua1
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua12
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ssh.lua148
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua3
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ufo.lua138
-rw-r--r--mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/zenmode.lua38
10 files changed, 343 insertions, 96 deletions
diff --git a/mac/.config/TheSiahxyz/ftplugin/markdown.lua b/mac/.config/TheSiahxyz/ftplugin/markdown.lua
index e27cd21..49cf4ee 100644
--- a/mac/.config/TheSiahxyz/ftplugin/markdown.lua
+++ b/mac/.config/TheSiahxyz/ftplugin/markdown.lua
@@ -1,8 +1,8 @@
-- Function to check if the current file is in the Obsidian repository
local function is_in_obsidian_repo()
local current_file_path = vim.fn.expand("%:p:h")
- local user = os.getenv("USER") -- Get the current user's name from the environment variable
- local obsidian_path = "/home/" .. user .. "/Private/repos/Obsidian/"
+ local home = os.getenv("HOME")
+ local obsidian_path = home .. "/Private/repos/Obsidian/"
return string.find(current_file_path, obsidian_path) ~= nil
end
@@ -231,32 +231,45 @@ vim.api.nvim_create_autocmd("FileType", {
-- FileType autocmd for markdown files
vim.api.nvim_create_autocmd("FileType", {
- pattern = { "markdown", "mdx", "mdown", "mkd", "mkdn", "mdwn" },
+ pattern = {
+ "markdown",
+ "markdown.mdx",
+ "vimwiki",
+ "quarto",
+ "mdx",
+ "mdown",
+ "mkd",
+ "mkdn",
+ "mdwn",
+ },
callback = function()
- -- Local settings
- vim.bo.textwidth = is_in_obsidian_repo() and 80 or 175
- vim.opt_local.autoindent = true
- vim.opt_local.conceallevel = 0
+ local ok, in_obsidian = pcall(function()
+ return is_in_obsidian_repo()
+ end)
+ local tw = (ok and in_obsidian) and 175 or 80
+
+ -- 로컬 옵션
+ vim.bo.textwidth = tw
+ vim.bo.formatoptions = vim.bo.formatoptions .. "a" -- 자동 줄바꿈 활성화
+ vim.opt_local.wrap = true
+ vim.opt_local.linebreak = true
+ vim.opt_local.breakindent = true
vim.opt_local.expandtab = true
- vim.opt_local.softtabstop = 4
vim.opt_local.shiftwidth = 4
+ vim.opt_local.softtabstop = 4
+ vim.opt_local.showbreak = "…"
vim.opt_local.spell = true
vim.opt_local.spelllang = { "en", "ko", "cjk" }
- vim.opt_local.spellsuggest = { "best", "9" }
+ vim.opt_local.spellsuggest = "best,9"
- local arrows = { [">>"] = "→", ["<<"] = "←", ["^^"] = "↑", ["VV"] = "↓" }
- for key, val in pairs(arrows) do
- vim.cmd(string.format("iabbrev %s %s", key, val))
- end
+ -- 버퍼 로컬 약어로 등록 (전역 오염 방지)
+ vim.cmd([[iabbrev <buffer> >> →]])
+ vim.cmd([[iabbrev <buffer> << ←]])
+ vim.cmd([[iabbrev <buffer> ^^ ↑]])
+ vim.cmd([[iabbrev <buffer> VV ↓]])
end,
})
--- this setting makes markdown auto-set the 80 text width limit when typing
--- vim.cmd('set fo+=a')
-if is_in_obsidian_repo() then
- vim.bo.textwidth = 175 -- No limit for Obsidian repository
-end
-
-- Makrdown.nvim settings
local markdown_settings = {
auto_insert_bullets = 0,
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/autocmds.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/autocmds.lua
index 3bd702a..c8f58f3 100644
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/autocmds.lua
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/autocmds.lua
@@ -130,23 +130,23 @@ autocmd({ "BufWritePre" }, {
})
-- Automatically delete all trailing whitespace and newlines at end of file on save
-local file_save = augroup("file_save")
-autocmd("BufWritePre", {
- group = file_save,
- pattern = "*",
- callback = function()
- local cursor_pos = vim.api.nvim_win_get_cursor(0)
- vim.cmd([[ %s/\s\+$//e ]]) -- Remove trailing spaces
- vim.cmd([[ %s/\n\+\%$//e ]]) -- Remove trailing newlines
- local line_count = vim.api.nvim_buf_line_count(0)
- local line = math.min(cursor_pos[1], line_count)
- local col = cursor_pos[2]
- -- Optional: clamp column if line got shorter
- local line_text = vim.api.nvim_buf_get_lines(0, line - 1, line, false)[1] or ""
- col = math.min(col, #line_text)
- vim.api.nvim_win_set_cursor(0, { line, col })
- end,
-})
+-- local file_save = augroup("file_save")
+-- autocmd("BufWritePre", {
+-- group = file_save,
+-- pattern = "*",
+-- callback = function()
+-- local cursor_pos = vim.api.nvim_win_get_cursor(0)
+-- vim.cmd([[ %s/\s\+$//e ]]) -- Remove trailing spaces
+-- vim.cmd([[ %s/\n\+\%$//e ]]) -- Remove trailing newlines
+-- local line_count = vim.api.nvim_buf_line_count(0)
+-- local line = math.min(cursor_pos[1], line_count)
+-- local col = cursor_pos[2]
+-- -- Optional: clamp column if line got shorter
+-- local line_text = vim.api.nvim_buf_get_lines(0, line - 1, line, false)[1] or ""
+-- col = math.min(col, #line_text)
+-- vim.api.nvim_win_set_cursor(0, { line, col })
+-- end,
+-- })
-- Add a trailing newline for C files
autocmd("BufWritePre", {
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/keymaps.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/keymaps.lua
index 5b461ab..16a0062 100644
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/keymaps.lua
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/keymaps.lua
@@ -572,7 +572,7 @@ if file then
end
-- Spell
-vim.keymap.set("n", "zp", function()
+vim.keymap.set("n", "zl", function()
vim.opt.spelllang = { "en", "ko", "cjk" }
vim.cmd("echo 'Spell language set to English, Korean, and CJK'")
end, { desc = "Spelling language English, Korean, and CJK" })
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua
index 6aafad3..b7b5812 100644
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua
@@ -324,20 +324,20 @@ return {
require("conform").setup({
formatters_by_ft = {
bash = { "shfmt" },
- css = { "prettier" },
+ -- css = { "prettier" },
graphql = { "prettier" },
html = { "prettier" },
- javascript = { "prettier" },
- javascriptreact = { "prettier" },
- json = { "prettier" },
+ -- javascript = { "prettier" },
+ -- javascriptreact = { "prettier" },
+ -- json = { "prettier" },
liquid = { "prettier" },
lua = { "stylua" },
markdown = { "prettier" },
python = { "ruff", "isort", "black" },
sh = { "shfmt" },
svelte = { "prettier" },
- typescript = { "prettier" },
- typescriptreact = { "prettier" },
+ -- typescript = { "prettier" },
+ -- typescriptreact = { "prettier" },
vimwiki = { "prettier" },
yaml = { "prettier" },
zsh = { "beautysh" },
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua
index a042fc8..de16ca6 100644
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua
@@ -189,6 +189,7 @@ return {
return name:lower():match("%.ipynb$") ~= nil
end,
})
+
vim.treesitter.language.register("markdown", "vimwiki")
local opts = { noremap = true, silent = true }
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua
index d9ea466..a5762d5 100644
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua
@@ -1079,14 +1079,14 @@ return {
-- Move visual selection in Visual mode. Defaults are Alt (Meta) + hjkl.
left = "<M-m>",
right = "<M-/>",
- down = "<M-,>",
- up = "<M-.>",
+ -- down = "<M-,>",
+ -- up = "<M-.>",
-- Move current line in Normal mode
line_left = "<M-m>",
line_right = "<M-/>",
- line_down = "<M-,>",
- line_up = "<M-.>",
+ -- line_down = "<M-,>",
+ -- line_up = "<M-.>",
},
-- Options which control moving behavior
@@ -1147,13 +1147,13 @@ return {
require("mini.trailspace").setup()
vim.keymap.set(
"n",
- "<leader>zt",
+ "<leader>zW",
":lua MiniTrailspace.trim()<cr>",
{ noremap = true, silent = true, desc = "Trim trailing whitespace" }
)
vim.keymap.set(
"n",
- "<leader>zl",
+ "<leader>zL",
":lua MiniTrailspace.trim_last_lines()<cr>",
{ noremap = true, silent = true, desc = "Trim trailing empty lines" }
)
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ssh.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ssh.lua
index 597d453..b42a588 100644
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ssh.lua
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ssh.lua
@@ -1,60 +1,118 @@
return {
"amitds1997/remote-nvim.nvim",
- version = "*", -- Pin to GitHub releases
+ version = "*",
dependencies = {
- "nvim-lua/plenary.nvim", -- For standard functions
- "MunifTanjim/nui.nvim", -- To build the plugin UI
- "nvim-telescope/telescope.nvim", -- For picking b/w different remote methods
+ "nvim-lua/plenary.nvim",
+ "MunifTanjim/nui.nvim",
+ "nvim-telescope/telescope.nvim",
},
config = true,
init = function()
- local wk = require("which-key")
- wk.add({
- { "<localleader>r", group = "SSH Remote" },
- })
+ local ok, wk = pcall(require, "which-key")
+ if ok then
+ wk.add({ { "<localleader>r", group = "SSH Remote" } })
+ end
end,
keys = {
- {
- "<localleader>rs",
- "<cmd>RemoteStart<CR>",
- desc = "Start/Connect",
- mode = "n",
- silent = true,
- },
- {
- "<localleader>rx",
- "<cmd>RemoteStop<CR>",
- desc = "Stop/Close",
- mode = "n",
- silent = true,
- },
- {
- "<localleader>ri",
- "<cmd>RemoteInfo<CR>",
- desc = "Info/Progress Viewer",
- mode = "n",
- silent = true,
- },
- {
- "<localleader>rc",
- "<cmd>RemoteCleanup<CR>",
- desc = "Cleanup workspace/setup",
- mode = "n",
- silent = true,
- },
+ { "<localleader>rs", "<cmd>RemoteStart<CR>", desc = "Start/Connect", mode = "n", silent = true },
+ { "<localleader>rx", "<cmd>RemoteStop<CR>", desc = "Stop/Close", mode = "n", silent = true },
+ { "<localleader>ri", "<cmd>RemoteInfo<CR>", desc = "Info/Progress Viewer", mode = "n", silent = true },
+ { "<localleader>rc", "<cmd>RemoteCleanup<CR>", desc = "Cleanup workspace", mode = "n", silent = true },
+
+ -- Delete saved config: show a list, allow multi-select, then run :RemoteConfigDel <name>
{
"<localleader>rd",
- "<cmd>RemoteConfigDel<CR>",
- desc = "Delete saved config",
- mode = "n",
- silent = true,
- },
- {
- "<localleader>rl",
- "<cmd>RemoteLog<CR>",
- desc = "Open log",
+ function()
+ local function get_names()
+ -- use command-line completion if the command supports it
+ local list = vim.fn.getcompletion("RemoteConfigDel ", "cmdline") or {}
+ return list
+ end
+
+ local names = get_names()
+ if #names == 0 then
+ return vim.notify(
+ "No saved remote configs found (completion empty)",
+ vim.log.levels.INFO,
+ { title = "Remote" }
+ )
+ end
+
+ -- Prefer Telescope if present
+ local ok_picker, pickers = pcall(require, "telescope.pickers")
+ if ok_picker then
+ local finders = require("telescope.finders")
+ local conf = require("telescope.config").values
+ local actions = require("telescope.actions")
+ local state = require("telescope.actions.state")
+
+ pickers
+ .new({}, {
+ prompt_title = "Delete Remote Config(s)",
+ finder = finders.new_table(names),
+ sorter = conf.generic_sorter({}),
+ attach_mappings = function(_, map)
+ local function run_delete(prompt_bufnr, picked)
+ local function del(name)
+ vim.api.nvim_cmd({ cmd = "RemoteConfigDel", args = { name } }, {})
+ end
+ if picked and #picked > 0 then
+ for _, entry in ipairs(picked) do
+ del(entry.value or entry[1] or entry.text)
+ end
+ else
+ local entry = state.get_selected_entry()
+ if entry then
+ del(entry.value or entry[1] or entry.text)
+ end
+ end
+ actions.close(prompt_bufnr)
+ end
+
+ actions.select_default:replace(function(bufnr)
+ local picker = state.get_current_picker(bufnr)
+ local multi = picker:get_multi_selection()
+ run_delete(bufnr, multi)
+ end)
+
+ -- quality of life: <C-d> also deletes without closing (optional)
+ map("i", "<C-d>", function(bufnr)
+ local picker = state.get_current_picker(bufnr)
+ local multi = picker:get_multi_selection()
+ local function del(name)
+ vim.api.nvim_cmd({ cmd = "RemoteConfigDel", args = { name } }, {})
+ end
+ if multi and #multi > 0 then
+ for _, e in ipairs(multi) do
+ del(e.value or e[1] or e.text)
+ end
+ else
+ local e = state.get_selected_entry()
+ if e then
+ del(e.value or e[1] or e.text)
+ end
+ end
+ -- keep picker open
+ end)
+
+ return true
+ end,
+ })
+ :find()
+ else
+ -- Fallback: vim.ui.select (single delete)
+ vim.ui.select(names, { prompt = "Select remote config to delete" }, function(choice)
+ if choice and choice ~= "" then
+ vim.api.nvim_cmd({ cmd = "RemoteConfigDel", args = { choice } }, {})
+ end
+ end)
+ end
+ end,
+ desc = "Delete saved config (pick from list)",
mode = "n",
silent = true,
},
+
+ { "<localleader>rl", "<cmd>RemoteLog<CR>", desc = "Open log", mode = "n", silent = true },
},
}
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua
index 98fd30a..ddb31de 100644
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua
@@ -264,6 +264,7 @@ return {
wk.add({
mode = { "n", "v" },
{ "<leader>f", group = "Find" },
+ { "<leader>F", group = "Find (root)" },
{ "<leader>fl", group = "Live grep" },
})
end,
@@ -761,7 +762,7 @@ return {
:find()
end, { desc = "Find files with open markers" })
- vim.keymap.set("n", "<leader>fF", function()
+ vim.keymap.set("n", "<leader>FF", function()
require("telescope.builtin").find_files({
cwd = vim.fn.expand("~"),
find_command = {
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ufo.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ufo.lua
new file mode 100644
index 0000000..ca7cf03
--- /dev/null
+++ b/mac/.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/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/zenmode.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/zenmode.lua
index beb48f5..52b6656 100644
--- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/zenmode.lua
+++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/zenmode.lua
@@ -2,19 +2,55 @@ return {
"folke/zen-mode.nvim",
opts = {},
config = function()
+ _G.ZenWinbar = function()
+ local bt = vim.bo.buftype
+ if bt ~= "" then
+ return "" -- scratch, terminal, help, quickfix 등은 숨김
+ end
+ local name = vim.api.nvim_buf_get_name(0)
+ if name == nil or name == "" then
+ return "" -- 이름 없는 새 버퍼도 숨김
+ end
+ return vim.fn.fnamemodify(name, ":t") -- 파일명만
+ end
+ local function apply_winbar_for_current()
+ vim.wo.winbar = "%{%v:lua.ZenWinbar()%}"
+ end
+ local function apply_winbar_for_all()
+ for _, win in ipairs(vim.api.nvim_list_wins()) do
+ vim.api.nvim_set_option_value("winbar", "%{%v:lua.ZenWinbar()%}", { win = win })
+ end
+ end
+ local function clear_winbar_for_all()
+ for _, win in ipairs(vim.api.nvim_list_wins()) do
+ vim.api.nvim_set_option_value("winbar", nil, { win = win })
+ end
+ end
+ local aug = vim.api.nvim_create_augroup("ZenWinbar", { clear = true })
+
vim.keymap.set("n", "<leader>zz", function()
require("zen-mode").toggle({
+ window = {
+ width = 90,
+ },
-- callback where you can add custom code when the Zen window opens
on_open = function()
vim.wo.wrap = true
vim.wo.number = true
vim.wo.rnu = true
+ apply_winbar_for_all()
+ vim.api.nvim_create_autocmd({ "BufWinEnter", "WinEnter" }, {
+ group = aug,
+ callback = apply_winbar_for_current,
+ })
end,
-- callback where you can add custom code when the Zen window closes
on_close = function()
vim.wo.wrap = false
vim.wo.number = true
vim.wo.rnu = true
+ vim.api.nvim_clear_autocmds({ group = aug })
+ clear_winbar_for_all()
ColorMyPencils()
end,
})
@@ -41,6 +77,6 @@ return {
ColorMyPencils()
end,
})
- end, { desc = "Toggle zenmode (custom)" })
+ end, { desc = "Toggle zenmode (goyo)" })
end,
}