diff options
| author | 2026-02-17 23:28:56 +0300 | |
|---|---|---|
| committer | 2026-02-17 23:28:56 +0300 | |
| commit | 2cd497a205c3f24b920045e939f396218e4d2aeb (patch) | |
| tree | cb4a06992b19d00d41cf566d88d4af91cf116c1a | |
| parent | Починил zshrc (diff) | |
| download | dotfiles-2cd497a205c3f24b920045e939f396218e4d2aeb.tar.gz dotfiles-2cd497a205c3f24b920045e939f396218e4d2aeb.tar.bz2 dotfiles-2cd497a205c3f24b920045e939f396218e4d2aeb.tar.xz dotfiles-2cd497a205c3f24b920045e939f396218e4d2aeb.zip | |
added ZK plugin
| -rw-r--r-- | config/nvim/lazy-lock.json | 18 | ||||
| -rw-r--r-- | config/nvim/lua/autocommands.lua | 9 | ||||
| -rw-r--r-- | config/nvim/lua/plugins.lua | 2 | ||||
| -rw-r--r-- | config/nvim/lua/plugins/lsp_saga.lua | 24 | ||||
| -rw-r--r-- | config/nvim/lua/plugins/lsp_signature.lua | 15 | ||||
| -rw-r--r-- | config/nvim/lua/plugins/telescope.lua | 7 | ||||
| -rw-r--r-- | config/nvim/lua/plugins/zk.lua | 26 | ||||
| -rw-r--r-- | config/nvim/lua/theme/colors256.lua | 110 |
8 files changed, 174 insertions, 37 deletions
diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index 669f925..79cf4a0 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -7,28 +7,27 @@ "conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, - "gitsigns.nvim": { "branch": "main", "commit": "31217271a7314c343606acb4072a94a039a19fb5" }, + "gitsigns.nvim": { "branch": "main", "commit": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519" }, "go.nvim": { "branch": "master", "commit": "421694ad11759ad22d5200cff6a8c69d223ade29" }, "goerr-nvim": { "branch": "main", "commit": "d30ba1cab652e78dbf6a644eb4823be57e9af203" }, "goimpl.nvim": { "branch": "main", "commit": "a0c2d8cd1e37f0ae8c19dc954ced3c6ccdceed53" }, "guihua.lua": { "branch": "master", "commit": "ef44ba40f12e56c1c9fa45967f2b4d142e4b97a0" }, - "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, - "lsp_signature.nvim": { "branch": "master", "commit": "0efb088dce050d38a3608ee69f80f2a62cf9849c" }, "lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" }, "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, "multicursor.nvim": { "branch": "1.0", "commit": "630dd29dd696bc977cb81d7dd2fa6bb280f60fc4" }, - "neogit": { "branch": "master", "commit": "75ca811db3ca3e43137596d25d26e57331540ee0" }, + "neogit": { "branch": "master", "commit": "9104991a424f5e0891cbe1cb44f91ae22cef28a0" }, "nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" }, "nvim-dap": { "branch": "master", "commit": "db321947bb289a2d4d76a32e76e4d2bd6103d7df" }, "nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" }, "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, - "nvim-lspconfig": { "branch": "master", "commit": "f4e9d367d4e067d7a5fabc9fd3f1349b291eb718" }, + "nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-tree.lua": { "branch": "master", "commit": "c0b18e4879f7b29a17a240ad49f733af7a7fb348" }, - "nvim-treesitter": { "branch": "main", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-tree.lua": { "branch": "master", "commit": "1df1960d0e3a26643a4100f64fa03b991b9f4b85" }, + "nvim-treesitter": { "branch": "main", "commit": "4d9466677a5ceadef104eaa0fe08d60d91c4e9a7" }, "nvim-treesitter-context": { "branch": "master", "commit": "64dd4cf3f6fd0ab17622c5ce15c91fc539c3f24a" }, - "nvim-treesitter-textobjects": { "branch": "main", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" }, + "nvim-treesitter-textobjects": { "branch": "main", "commit": "a0e182ae21fda68c59d1f36c9ed45600aef50311" }, "nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" }, "nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, @@ -36,5 +35,6 @@ "smartcolumn.nvim": { "branch": "main", "commit": "b9cdbdf42f7ac5a659204cd5926017c7ff724a19" }, "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, - "telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" } + "telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" }, + "zk-nvim": { "branch": "main", "commit": "51c8f858420112dda495a6f4ddbd3943ae433e39" } } diff --git a/config/nvim/lua/autocommands.lua b/config/nvim/lua/autocommands.lua index fee69a4..9811dbe 100644 --- a/config/nvim/lua/autocommands.lua +++ b/config/nvim/lua/autocommands.lua @@ -98,12 +98,9 @@ vim.api.nvim_create_autocmd("FileType", { pcall(vim.treesitter.start, buf, ft) end end - end, -}) -vim.api.nvim_create_autocmd("User", { - pattern = "TSUpdate", - callback = function() - vim.cmd([[TSEnable highlight]]) + vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()" + vim.wo[0][0].foldmethod = "expr" + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end, }) vim.api.nvim_create_autocmd({ "BufWritePost" }, { diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 6ed6e72..fc51fb7 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -9,7 +9,6 @@ require("lazy").setup({ require("plugins.apidocs"), require("plugins.resize"), require("plugins.lsp_saga"), - require("plugins.lsp_signature"), require("plugins.autosave"), require("plugins.cmp"), require("plugins.treesitter"), @@ -23,6 +22,7 @@ require("lazy").setup({ require("plugins.columns"), require("plugins.gitsigns"), require("plugins.claudecode"), + require("plugins.zk"), }, { performance = { rtp = { diff --git a/config/nvim/lua/plugins/lsp_saga.lua b/config/nvim/lua/plugins/lsp_saga.lua index ab8177f..546c073 100644 --- a/config/nvim/lua/plugins/lsp_saga.lua +++ b/config/nvim/lua/plugins/lsp_saga.lua @@ -1,8 +1,32 @@ return { "nvimdev/lspsaga.nvim", + dependencies = { + "nvim-treesitter/nvim-treesitter", -- optional + "nvim-tree/nvim-web-devicons", -- optional + }, opts = { lightbulb = { enable = false, }, + diagnostic = { + show_layout = "float", + auto_preview = true, + keys = { + exec_action = "o", + quit = "q", + }, + }, + }, + keys = { + { + "<leader>e", + "<cmd>Lspsaga show_buf_diagnostics<cr>", + desc = "Show buffer diagnostic", + }, + { + "<leader>we", + "<cmd>Lspsaga show_workspace_diagnostics<cr>", + desc = "Show workspace diagnostic", + }, }, } diff --git a/config/nvim/lua/plugins/lsp_signature.lua b/config/nvim/lua/plugins/lsp_signature.lua deleted file mode 100644 index b9add0b..0000000 --- a/config/nvim/lua/plugins/lsp_signature.lua +++ /dev/null @@ -1,15 +0,0 @@ -return { - "ray-x/lsp_signature.nvim", - event = "VeryLazy", - opts = { - doc_lines = 1, - max_height = 3, - hint_prefix = "", - hint_prefix = { - above = "↙ ", - current = "← ", - below = "↖ ", - }, - floating_window = true, - }, -} diff --git a/config/nvim/lua/plugins/telescope.lua b/config/nvim/lua/plugins/telescope.lua index 228160f..e26a618 100644 --- a/config/nvim/lua/plugins/telescope.lua +++ b/config/nvim/lua/plugins/telescope.lua @@ -45,11 +45,6 @@ return { desc = "Commands history", }, { - "<leader>e", - "<cmd>Telescope diagnostics<CR>", - desc = "Diagnostics", - }, - { "gi", "<cmd>Telescope lsp_implementations<CR>", desc = "LSP implementations", @@ -87,4 +82,4 @@ return { }) require("telescope").load_extension("fzf") end, -}
\ No newline at end of file +} diff --git a/config/nvim/lua/plugins/zk.lua b/config/nvim/lua/plugins/zk.lua new file mode 100644 index 0000000..1b21a74 --- /dev/null +++ b/config/nvim/lua/plugins/zk.lua @@ -0,0 +1,26 @@ +return { + "zk-org/zk-nvim", + config = function() + require("zk").setup({ + -- Can be "telescope", "fzf", "fzf_lua", "minipick", "snacks_picker", + -- or select" (`vim.ui.select`). + picker = "telescope", + + lsp = { + -- `config` is passed to `vim.lsp.start(config)` + config = { + name = "zk", + cmd = { "zk", "lsp" }, + filetypes = { "markdown" }, + -- on_attach = ... + -- etc, see `:h vim.lsp.start()` + }, + + -- automatically attach buffers in a zk notebook that match the given filetypes + auto_attach = { + enabled = true, + }, + }, + }) + end, +} diff --git a/config/nvim/lua/theme/colors256.lua b/config/nvim/lua/theme/colors256.lua new file mode 100644 index 0000000..350a2a1 --- /dev/null +++ b/config/nvim/lua/theme/colors256.lua @@ -0,0 +1,110 @@ +-- Hex to 256 color conversion utilities + +local M = {} + +-- Convert hex color to RGB values +local function hex_to_rgb(hex) + hex = hex:gsub("#", "") + return { + r = tonumber(hex:sub(1, 2), 16), + g = tonumber(hex:sub(3, 4), 16), + b = tonumber(hex:sub(5, 6), 16), + } +end + +-- Convert RGB to nearest 256 color index +local function rgb_to_256(r, g, b) + -- Build full 256 color palette and find nearest + local palette = {} + + -- Gray ramp (232-255) + for i = 0, 23 do + local gray = 8 + i * 10 + palette[#palette + 1] = { r = gray, g = gray, b = gray, idx = 232 + i } + end + + -- 6x6x6 color cube (16-231) + local values = {0, 95, 135, 175, 215, 255} + for ri = 0, 5 do + for gi = 0, 5 do + for bi = 0, 5 do + local idx = 16 + ri * 36 + gi * 6 + bi + palette[#palette + 1] = { + r = values[ri + 1], + g = values[gi + 1], + b = values[bi + 1], + idx = idx + } + end + end + end + + -- Find nearest color (minimum Manhattan distance) + local min_dist = 100000 + local nearest_idx = 15 + + for _, color in ipairs(palette) do + local dist = math.abs(r - color.r) + math.abs(g - color.g) + math.abs(b - color.b) + if dist < min_dist then + min_dist = dist + nearest_idx = color.idx + end + end + + return nearest_idx +end + +-- Convert hex color string to 256 color index +function M.hex_to_256(hex) + if not hex or hex == "" or hex == "NONE" then + return nil + end + + if type(hex) == "number" then + return hex -- Already a cterm color + end + + local rgb = hex_to_rgb(hex) + return rgb_to_256(rgb.r, rgb.g, rgb.b) +end + +-- Create highlight table with cterm colors from fg and bg hex colors +function M.convert_theme_theme(theme) + local cterm_theme = {} + for group, hl in pairs(theme) do + local cterm = {} + if hl.fg then + cterm.fg = M.hex_to_256(hl.fg) + end + -- Include background colors + if hl.bg then + cterm.bg = M.hex_to_256(hl.bg) + end + if hl.sp then + cterm.sp = M.hex_to_256(hl.sp) + end + if hl.bold then + cterm.bold = true + end + if hl.underline then + cterm.underline = true + end + if hl.undercurl then + cterm.undercurl = true + end + if hl.italic then + cterm.italic = true + end + if hl.reverse then + cterm.reverse = true + end + if hl.standout then + cterm.standout = true + end + + cterm_theme[group] = cterm + end + return cterm_theme +end + +return M |
