diff options
Diffstat (limited to 'config/nvim/lua')
| -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 |
7 files changed, 165 insertions, 28 deletions
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 |
