From cc7917b601fef327829b75a71483a7907820fb6f Mon Sep 17 00:00:00 2001 From: morfize <233522679+morfize@users.noreply.github.com> Date: Thu, 25 Dec 2025 17:04:49 +0900 Subject: [PATCH] feat: updated to the latest nvim-lua/kickstart.nvim --- after/ftplugin/haskell.lua | 17 + after/ftplugin/markdown.lua | 35 ++ after/ftplugin/rust.lua | 13 + init.lua | 35 +- lua/custom/plugins/amp.lua | 6 + lua/custom/plugins/avante.lua | 323 ++++++++++++++++++ lua/custom/plugins/better-escape.lua | 7 + lua/custom/plugins/bg.lua | 5 + lua/custom/plugins/bufferline.lua | 9 + lua/custom/plugins/catpuccin.lua | 58 ++++ lua/custom/plugins/ccc.lua | 7 + lua/custom/plugins/claudecode.lua | 67 ++++ lua/custom/plugins/copilot.lua | 96 ++++++ lua/custom/plugins/d2-vim.lua | 22 ++ lua/custom/plugins/github-nvim-theme.lua | 54 +++ lua/custom/plugins/haskell-tools.lua | 6 + lua/custom/plugins/im-select.lua | 40 +++ lua/custom/plugins/init.lua | 96 ++++++ lua/custom/plugins/lean.lua | 24 ++ lua/custom/plugins/mcp-hub.lua | 92 +++++ lua/custom/plugins/multicursor.lua | 159 +++++++++ lua/custom/plugins/nerdy.lua | 13 + lua/custom/plugins/nightfox.lua | 53 +++ lua/custom/plugins/nvim-autopairs.lua | 28 ++ lua/custom/plugins/peek.lua | 31 ++ lua/custom/plugins/render-markdown.lua | 53 +++ lua/custom/plugins/rose-pine.lua | 92 +++++ lua/custom/plugins/rustaceanvim.lua | 5 + lua/custom/plugins/snacks.lua | 57 ++++ lua/custom/plugins/tiny-inline-diagnostic.lua | 138 ++++++++ lua/custom/plugins/toggleterm.lua | 6 + lua/custom/plugins/tree-sitter-d2.lua | 7 + lua/custom/plugins/typst-preview.lua | 7 + lua/custom/plugins/typst.lua | 8 + lua/custom/plugins/zk-nvim.lua | 30 ++ 35 files changed, 1678 insertions(+), 21 deletions(-) create mode 100644 after/ftplugin/haskell.lua create mode 100644 after/ftplugin/markdown.lua create mode 100644 after/ftplugin/rust.lua create mode 100644 lua/custom/plugins/amp.lua create mode 100644 lua/custom/plugins/avante.lua create mode 100644 lua/custom/plugins/better-escape.lua create mode 100644 lua/custom/plugins/bg.lua create mode 100644 lua/custom/plugins/bufferline.lua create mode 100644 lua/custom/plugins/catpuccin.lua create mode 100644 lua/custom/plugins/ccc.lua create mode 100644 lua/custom/plugins/claudecode.lua create mode 100644 lua/custom/plugins/copilot.lua create mode 100644 lua/custom/plugins/d2-vim.lua create mode 100644 lua/custom/plugins/github-nvim-theme.lua create mode 100644 lua/custom/plugins/haskell-tools.lua create mode 100644 lua/custom/plugins/im-select.lua create mode 100644 lua/custom/plugins/lean.lua create mode 100644 lua/custom/plugins/mcp-hub.lua create mode 100644 lua/custom/plugins/multicursor.lua create mode 100644 lua/custom/plugins/nerdy.lua create mode 100644 lua/custom/plugins/nightfox.lua create mode 100644 lua/custom/plugins/nvim-autopairs.lua create mode 100644 lua/custom/plugins/peek.lua create mode 100644 lua/custom/plugins/render-markdown.lua create mode 100644 lua/custom/plugins/rose-pine.lua create mode 100644 lua/custom/plugins/rustaceanvim.lua create mode 100644 lua/custom/plugins/snacks.lua create mode 100644 lua/custom/plugins/tiny-inline-diagnostic.lua create mode 100644 lua/custom/plugins/toggleterm.lua create mode 100644 lua/custom/plugins/tree-sitter-d2.lua create mode 100644 lua/custom/plugins/typst-preview.lua create mode 100644 lua/custom/plugins/typst.lua create mode 100644 lua/custom/plugins/zk-nvim.lua diff --git a/after/ftplugin/haskell.lua b/after/ftplugin/haskell.lua new file mode 100644 index 00000000..8cce36fd --- /dev/null +++ b/after/ftplugin/haskell.lua @@ -0,0 +1,17 @@ +-- local ht = require 'haskell-tools' +-- local bufnr = vim.api.nvim_get_current_buf() +-- local base_opts = { noremap = true, silent = true, buffer = bufnr } +-- +-- vim.keymap.set('n', 'cl', vim.lsp.codelens.run, vim.tbl_extend('force', base_opts, { desc = 'Run all code lenses (e.g. eval, add signature)' })) +-- +-- vim.keymap.set('n', 'hs', ht.hoogle.hoogle_signature, vim.tbl_extend('force', base_opts, { desc = 'Hoogle search for type signature under cursor' })) +-- +-- vim.keymap.set('n', 'ea', ht.lsp.buf_eval_all, vim.tbl_extend('force', base_opts, { desc = 'Evaluate all code snippets in buffer' })) +-- +-- vim.keymap.set('n', 'rr', ht.repl.toggle, vim.tbl_extend('force', base_opts, { desc = 'Toggle GHCi repl for current package' })) +-- +-- vim.keymap.set('n', 'rf', function() +-- ht.repl.toggle(vim.api.nvim_buf_get_name(0)) +-- end, vim.tbl_extend('force', base_opts, { desc = 'Toggle GHCi repl for current buffer' })) +-- +-- vim.keymap.set('n', 'rq', ht.repl.quit, vim.tbl_extend('force', base_opts, { desc = 'Quit GHCi repl' })) diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua new file mode 100644 index 00000000..99d36c62 --- /dev/null +++ b/after/ftplugin/markdown.lua @@ -0,0 +1,35 @@ +-- Add the key mappings only for Markdown files in a zk notebook. +if require('zk.util').notebook_root(vim.fn.expand '%:p') ~= nil then + local function map(...) + vim.api.nvim_buf_set_keymap(0, ...) + end + local opts = { noremap = true, silent = false } + + -- Open the link under the caret. + map('n', '', 'lua vim.lsp.buf.definition()', opts) + + -- Create a new note after asking for its title. + -- This overrides the global `zn` mapping to create the note in the same directory as the current buffer. + map('n', 'zn', "ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }", opts) + -- Create a new note in the same directory as the current buffer, using the current selection for title. + map('v', 'znt', ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }", opts) + -- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title. + map('v', 'znc', ":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }", opts) + + -- Open notes linking to the current buffer. + map('n', 'zb', 'ZkBacklinks', opts) + -- Alternative for backlinks using pure LSP and showing the source context. + --map('n', 'zb', 'lua vim.lsp.buf.references()', opts) + -- Open notes linked by the current buffer. + map('n', 'zl', 'ZkLinks', opts) + + -- Preview a linked note. + map('n', 'K', 'lua vim.lsp.buf.hover()', opts) + -- Open the code actions for a visual selection. + map('v', 'za', ":'<,'>lua vim.lsp.buf.range_code_action()", opts) + + -- Insert a link to a note. + map('n', 'zi', 'ZkInsertLink', opts) + -- Insert a link to a note using the current selection for the link text. + map('v', 'zil', ":'<,'>ZkInsertLinkAtSelection", opts) +end diff --git a/after/ftplugin/rust.lua b/after/ftplugin/rust.lua new file mode 100644 index 00000000..f5818293 --- /dev/null +++ b/after/ftplugin/rust.lua @@ -0,0 +1,13 @@ +local bufnr = vim.api.nvim_get_current_buf() +vim.keymap.set('n', 'a', function() + vim.cmd.RustLsp 'codeAction' -- supports rust-analyzer's grouping + -- or vim.lsp.buf.codeAction() if you don't want grouping. +end, { silent = true, buffer = bufnr }) +vim.keymap.set( + 'n', + 'K', -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions + function() + vim.cmd.RustLsp { 'hover', 'actions' } + end, + { silent = true, buffer = bufnr } +) diff --git a/init.lua b/init.lua index b98ffc61..a649fe90 100644 --- a/init.lua +++ b/init.lua @@ -361,6 +361,7 @@ require('lazy').setup({ { -- Fuzzy Finder (files, lsp, etc) 'nvim-telescope/telescope.nvim', event = 'VimEnter', + tag = 'v0.2.0', dependencies = { 'nvim-lua/plenary.nvim', { -- If encountering errors, see telescope-fzf-native README for installation instructions @@ -941,21 +942,13 @@ require('lazy').setup({ { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, - }, - indent = { enable = true, disable = { 'ruby' } }, - }, + config = function() + local ts = require 'nvim-treesitter' + ts.setup {} + ts.install({ 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }):wait(30000) + end, + -- There are additional nvim-treesitter modules that you can use to interact -- with nvim-treesitter. You should go explore a few and see what interests you: -- @@ -973,18 +966,18 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/plugins/amp.lua b/lua/custom/plugins/amp.lua new file mode 100644 index 00000000..19f70b0b --- /dev/null +++ b/lua/custom/plugins/amp.lua @@ -0,0 +1,6 @@ +return { + 'sourcegraph/amp.nvim', + branch = 'main', + lazy = false, + opts = { auto_start = true, log_level = 'info' }, +} diff --git a/lua/custom/plugins/avante.lua b/lua/custom/plugins/avante.lua new file mode 100644 index 00000000..89959c2e --- /dev/null +++ b/lua/custom/plugins/avante.lua @@ -0,0 +1,323 @@ +return { + 'yetone/avante.nvim', + enabled = false, + event = 'VeryLazy', + lazy = false, + version = false, + opts = { + ---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string + ---@type Provider + provider = 'copilot', -- The provider used in Aider mode or in the planning phase of Cursor Planning Mode + ---@alias Mode "agentic" | "legacy" + ---@type Mode + mode = 'agentic', -- The default mode for interaction. "agentic" uses tools to automatically generate code, "legacy" uses the old planning method to generate code. + -- WARNING: Since auto-suggestions are a high-frequency operation and therefore expensive, + -- currently designating it as `copilot` provider is dangerous because: https://github.com/yetone/avante.nvim/issues/1048 + -- Of course, you can reduce the request frequency by increasing `suggestion.debounce`. + auto_suggestions_provider = 'copilot', + providers = { + claude = { + endpoint = 'https://api.anthropic.com', + model = 'claude-3-5-sonnet-20241022', + extra_request_body = { + temperature = 0.75, + max_tokens = 4096, + }, + }, + }, + ---Specify the special dual_boost mode + ---1. enabled: Whether to enable dual_boost mode. Default to false. + ---2. first_provider: The first provider to generate response. Default to "openai". + ---3. second_provider: The second provider to generate response. Default to "claude". + ---4. prompt: The prompt to generate response based on the two reference outputs. + ---5. timeout: Timeout in milliseconds. Default to 60000. + ---How it works: + --- When dual_boost is enabled, avante will generate two responses from the first_provider and second_provider respectively. Then use the response from the first_provider as provider1_output and the response from the second_provider as provider2_output. Finally, avante will generate a response based on the prompt and the two reference outputs, with the default Provider as normal. + ---Note: This is an experimental feature and may not work as expected. + dual_boost = { + enabled = false, + first_provider = 'openai', + second_provider = 'claude', + prompt = 'Based on the two reference outputs below, generate a response that incorporates elements from both but reflects your own judgment and unique perspective. Do not provide any explanation, just give the response directly. Reference Output 1: [{{provider1_output}}], Reference Output 2: [{{provider2_output}}]', + timeout = 60000, -- Timeout in milliseconds + }, + behaviour = { + auto_suggestions = false, -- Experimental stage + auto_set_highlight_group = true, + auto_set_keymaps = true, + auto_apply_diff_after_generation = false, + support_paste_from_clipboard = false, + minimize_diff = true, -- Whether to remove unchanged lines when applying a code block + enable_token_counting = true, -- Whether to enable token counting. Default to true. + auto_approve_tool_permissions = false, -- Default: show permission prompts for all tools + -- Examples: + -- auto_approve_tool_permissions = true, -- Auto-approve all tools (no prompts) + -- auto_approve_tool_permissions = {"bash", "replace_in_file"}, -- Auto-approve specific tools only + }, + prompt_logger = { -- logs prompts to disk (timestamped, for replay/debugging) + enabled = true, -- toggle logging entirely + log_dir = vim.fn.stdpath 'cache' .. '/avante_prompts', -- directory where logs are saved + fortune_cookie_on_success = false, -- shows a random fortune after each logged prompt (requires `fortune` installed) + next_prompt = { + normal = '', -- load the next (newer) prompt log in normal mode + insert = '', + }, + prev_prompt = { + normal = '', -- load the previous (older) prompt log in normal mode + insert = '', + }, + }, + mappings = { + --- @class AvanteConflictMappings + diff = { + ours = 'co', + theirs = 'ct', + all_theirs = 'ca', + both = 'cb', + cursor = 'cc', + next = ']x', + prev = '[x', + }, + suggestion = { + accept = '', + next = '', + prev = '', + dismiss = '', + }, + jump = { + next = ']]', + prev = '[[', + }, + submit = { + normal = '', + insert = '', + }, + cancel = { + normal = { '', '', 'q' }, + insert = { '' }, + }, + sidebar = { + apply_all = 'A', + apply_cursor = 'a', + retry_user_request = 'r', + edit_user_request = 'e', + switch_windows = '', + reverse_switch_windows = '', + remove_file = 'd', + add_file = '@', + close = { '', 'q' }, + close_from_input = nil, -- e.g., { normal = "", insert = "" } + }, + }, + selection = { + enabled = true, + hint_display = 'delayed', + }, + windows = { + ---@type "right" | "left" | "top" | "bottom" + position = 'right', -- the position of the sidebar + wrap = true, -- similar to vim.o.wrap + width = 30, -- default % based on available width + sidebar_header = { + enabled = true, -- true, false to enable/disable the header + align = 'center', -- left, center, right for title + rounded = true, + }, + spinner = { + editing = { + '⡀', + '⠄', + '⠂', + '⠁', + '⠈', + '⠐', + '⠠', + '⢀', + '⣀', + '⢄', + '⢂', + '⢁', + '⢈', + '⢐', + '⢠', + '⣠', + '⢤', + '⢢', + '⢡', + '⢨', + '⢰', + '⣰', + '⢴', + '⢲', + '⢱', + '⢸', + '⣸', + '⢼', + '⢺', + '⢹', + '⣹', + '⢽', + '⢻', + '⣻', + '⢿', + '⣿', + }, + generating = { '·', '✢', '✳', '∗', '✻', '✽' }, -- Spinner characters for the 'generating' state + thinking = { '🤯', '🙄' }, -- Spinner characters for the 'thinking' state + }, + input = { + prefix = '> ', + height = 8, -- Height of the input window in vertical layout + }, + edit = { + border = 'rounded', + start_insert = true, -- Start insert mode when opening the edit window + }, + ask = { + floating = false, -- Open the 'AvanteAsk' prompt in a floating window + start_insert = true, -- Start insert mode when opening the ask window + border = 'rounded', + ---@type "ours" | "theirs" + focus_on_apply = 'ours', -- which diff to focus after applying + }, + }, + highlights = { + ---@type AvanteConflictHighlights + diff = { + current = 'DiffText', + incoming = 'DiffAdd', + }, + }, + --- @class AvanteConflictUserConfig + diff = { + autojump = true, + ---@type string | fun(): any + list_opener = 'copen', + --- Override the 'timeoutlen' setting while hovering over a diff (see :help timeoutlen). + --- Helps to avoid entering operator-pending mode with diff mappings starting with `c`. + --- Disable by setting to -1. + override_timeoutlen = 500, + }, + suggestion = { + debounce = 600, + throttle = 600, + }, + }, + dependencies = { + 'nvim-treesitter/nvim-treesitter', + 'stevearc/dressing.nvim', + 'nvim-lua/plenary.nvim', + 'MunifTanjim/nui.nvim', + --- The below dependencies are optional, + 'echasnovski/mini.pick', -- for file_selector provider mini.pick + 'nvim-telescope/telescope.nvim', -- for file_selector provider telescope + 'hrsh7th/nvim-cmp', -- autocompletion for avante commands and mentions + 'ibhagwan/fzf-lua', -- for file_selector provider fzf + 'nvim-tree/nvim-web-devicons', -- or echasnovski/mini.icons + 'zbirenbaum/copilot.lua', -- for providers='copilot' + { + -- support for image pasting + 'HakonHarnes/img-clip.nvim', + event = 'VeryLazy', + opts = { + -- recommended settings + default = { + embed_image_as_base64 = false, + prompt_for_file_name = false, + drag_and_drop = { + insert_mode = true, + }, + -- required for Windows users + use_absolute_path = true, + }, + }, + }, + { + -- Make sure to set this up properly if you have lazy=true + 'MeanderingProgrammer/render-markdown.nvim', + opts = { + file_types = { 'markdown', 'Avante' }, + }, + ft = { 'markdown', 'Avante' }, + }, + }, +} + +-- from https://github.com/yetone/avante.nvim?tab=readme-ov-file +-- { +-- "yetone/avante.nvim", +-- -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` +-- -- ⚠️ must add this setting! ! ! +-- build = vim.fn.has("win32") ~= 0 +-- and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" +-- or "make", +-- event = "VeryLazy", +-- version = false, -- Never set this value to "*"! Never! +-- ---@module 'avante' +-- ---@type avante.Config +-- opts = { +-- -- add any opts here +-- -- this file can contain specific instructions for your project +-- instructions_file = "avante.md", +-- -- for example +-- provider = "claude", +-- providers = { +-- claude = { +-- endpoint = "https://api.anthropic.com", +-- model = "claude-sonnet-4-20250514", +-- timeout = 30000, -- Timeout in milliseconds +-- extra_request_body = { +-- temperature = 0.75, +-- max_tokens = 20480, +-- }, +-- }, +-- moonshot = { +-- endpoint = "https://api.moonshot.ai/v1", +-- model = "kimi-k2-0711-preview", +-- timeout = 30000, -- Timeout in milliseconds +-- extra_request_body = { +-- temperature = 0.75, +-- max_tokens = 32768, +-- }, +-- }, +-- }, +-- }, +-- dependencies = { +-- "nvim-lua/plenary.nvim", +-- "MunifTanjim/nui.nvim", +-- --- The below dependencies are optional, +-- "echasnovski/mini.pick", -- for file_selector provider mini.pick +-- "nvim-telescope/telescope.nvim", -- for file_selector provider telescope +-- "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions +-- "ibhagwan/fzf-lua", -- for file_selector provider fzf +-- "stevearc/dressing.nvim", -- for input provider dressing +-- "folke/snacks.nvim", -- for input provider snacks +-- "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons +-- "zbirenbaum/copilot.lua", -- for providers='copilot' +-- { +-- -- support for image pasting +-- "HakonHarnes/img-clip.nvim", +-- event = "VeryLazy", +-- opts = { +-- -- recommended settings +-- default = { +-- embed_image_as_base64 = false, +-- prompt_for_file_name = false, +-- drag_and_drop = { +-- insert_mode = true, +-- }, +-- -- required for Windows users +-- use_absolute_path = true, +-- }, +-- }, +-- }, +-- { +-- -- Make sure to set this up properly if you have lazy=true +-- 'MeanderingProgrammer/render-markdown.nvim', +-- opts = { +-- file_types = { "markdown", "Avante" }, +-- }, +-- ft = { "markdown", "Avante" }, +-- }, +-- }, +-- } diff --git a/lua/custom/plugins/better-escape.lua b/lua/custom/plugins/better-escape.lua new file mode 100644 index 00000000..1d588fbc --- /dev/null +++ b/lua/custom/plugins/better-escape.lua @@ -0,0 +1,7 @@ +-- lua with lazy.nvim +return { + 'max397574/better-escape.nvim', + config = function() + require('better_escape').setup() + end, +} diff --git a/lua/custom/plugins/bg.lua b/lua/custom/plugins/bg.lua new file mode 100644 index 00000000..3195cf43 --- /dev/null +++ b/lua/custom/plugins/bg.lua @@ -0,0 +1,5 @@ +return { + 'typicode/bg.nvim', + lazy = false, + priority = 1000, +} diff --git a/lua/custom/plugins/bufferline.lua b/lua/custom/plugins/bufferline.lua new file mode 100644 index 00000000..726bb63a --- /dev/null +++ b/lua/custom/plugins/bufferline.lua @@ -0,0 +1,9 @@ +return { + 'akinsho/bufferline.nvim', + lazy = false, + version = '*', + dependencies = 'nvim-tree/nvim-web-devicons', + config = function() + require('bufferline').setup {} + end, +} diff --git a/lua/custom/plugins/catpuccin.lua b/lua/custom/plugins/catpuccin.lua new file mode 100644 index 00000000..24afc752 --- /dev/null +++ b/lua/custom/plugins/catpuccin.lua @@ -0,0 +1,58 @@ +return { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + require('catppuccin').setup { + flavour = 'auto', -- latte, frappe, macchiato, mocha + background = { -- :h background + light = 'latte', + dark = 'mocha', + }, + transparent_background = false, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = false, -- dims the background color of inactive window + shade = 'dark', + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { 'italic' }, -- Change the style of comments + conditionals = { 'italic' }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + -- miscs = {}, -- Uncomment to turn off hard-coded styles + }, + color_overrides = {}, + custom_highlights = {}, + default_integrations = true, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = false, + mini = { + enabled = true, + indentscope_color = '', + }, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, + } + + -- setup must be called before loading + -- vim.cmd.colorscheme 'catppuccin' + end, +} diff --git a/lua/custom/plugins/ccc.lua b/lua/custom/plugins/ccc.lua new file mode 100644 index 00000000..91bca4a9 --- /dev/null +++ b/lua/custom/plugins/ccc.lua @@ -0,0 +1,7 @@ +return { + 'uga-rosa/ccc.nvim', + event = 'VeryLazy', + config = function() + require('ccc').setup {} + end, +} diff --git a/lua/custom/plugins/claudecode.lua b/lua/custom/plugins/claudecode.lua new file mode 100644 index 00000000..04440d7b --- /dev/null +++ b/lua/custom/plugins/claudecode.lua @@ -0,0 +1,67 @@ +return { + 'coder/claudecode.nvim', + dependencies = { 'folke/snacks.nvim' }, + config = true, + opts = { + -- Server Configuration + port_range = { min = 10000, max = 65535 }, + auto_start = true, + log_level = 'info', -- "trace", "debug", "info", "warn", "error" + terminal_cmd = nil, -- Custom terminal command (default: "claude") + -- For local installations: "~/.claude/local/claude" + -- For native binary: use output from 'which claude' + + -- Send/Focus Behavior + -- When true, successful sends will focus the Claude terminal if already connected + focus_after_send = false, + + -- Selection Tracking + track_selection = true, + visual_demotion_delay_ms = 50, + + -- Terminal Configuration + terminal = { + split_side = 'right', -- "left" or "right" + split_width_percentage = 0.30, + provider = 'auto', -- "auto", "snacks", "native", "external", "none", or custom provider table + auto_close = true, + snacks_win_opts = {}, -- Opts to pass to `Snacks.terminal.open()` - see Floating Window section below + + -- Provider-specific options + provider_opts = { + -- Command for external terminal provider. Can be: + -- 1. String with %s placeholder: "alacritty -e %s" (backward compatible) + -- 2. String with two %s placeholders: "alacritty --working-directory %s -e %s" (cwd, command) + -- 3. Function returning command: function(cmd, env) return "alacritty -e " .. cmd end + external_terminal_cmd = nil, + }, + }, + + -- Diff Integration + diff_opts = { + auto_close_on_accept = true, + vertical_split = true, + open_in_current_tab = true, + keep_terminal_focus = false, -- If true, moves focus back to terminal after diff opens + }, + }, + keys = { + { 'a', nil, desc = 'AI/Claude Code' }, + { 'ac', 'ClaudeCode', desc = 'Toggle Claude' }, + { 'af', 'ClaudeCodeFocus', desc = 'Focus Claude' }, + { 'ar', 'ClaudeCode --resume', desc = 'Resume Claude' }, + { 'aC', 'ClaudeCode --continue', desc = 'Continue Claude' }, + { 'am', 'ClaudeCodeSelectModel', desc = 'Select Claude model' }, + { 'ab', 'ClaudeCodeAdd %', desc = 'Add current buffer' }, + { 'as', 'ClaudeCodeSend', mode = 'v', desc = 'Send to Claude' }, + { + 'as', + 'ClaudeCodeTreeAdd', + desc = 'Add file', + ft = { 'NvimTree', 'neo-tree', 'oil', 'minifiles', 'netrw' }, + }, + -- Diff management + { 'aa', 'ClaudeCodeDiffAccept', desc = 'Accept diff' }, + { 'ad', 'ClaudeCodeDiffDeny', desc = 'Deny diff' }, + }, +} diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000..39d90bed --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,96 @@ +return { + 'zbirenbaum/copilot.lua', + enabled = true, + event = 'InsertEnter', + requires = { + 'copilotlsp/copilot-lsp.nvim', + }, + config = function() + require('copilot').setup { + panel = { + enabled = true, + auto_refresh = true, + keymap = { + jump_prev = '[[', + jump_next = ']]', + accept = '', + refresh = 'gr', + open = '', + }, + layout = { + position = 'right', -- | top | left | right | bottom | + ratio = 0.4, + }, + }, + suggestion = { + enabled = true, + auto_trigger = true, + hide_during_completion = true, + debounce = 100, + trigger_on_accept = false, + keymap = { + accept = '', + accept_word = false, + accept_line = false, + next = '', + prev = '', + dismiss = '', + }, + }, + filetypes = { + yaml = false, + markdown = false, + help = false, + gitcommit = true, + gitrebase = true, + hgcommit = false, + svn = false, + cvs = false, + ['.'] = false, + }, + nes = { + enabled = false, -- requires copilot-lsp as a dependency + auto_trigger = false, + keymap = { + accept_and_goto = false, + accept = false, + dismiss = false, + }, + }, + auth_provider_url = nil, -- URL to authentication provider, if not "https://github.com/" + logger = { + file = vim.fn.stdpath 'log' .. '/copilot-lua.log', + file_log_level = vim.log.levels.OFF, + print_log_level = vim.log.levels.WARN, + trace_lsp = 'off', -- "off" | "messages" | "verbose" + trace_lsp_progress = false, + log_lsp_messages = false, + }, + copilot_node_command = 'node', -- Node.js version must be > 20 + workspace_folders = {}, + copilot_model = '', + root_dir = function() + return vim.fs.dirname(vim.fs.find('.git', { upward = true })[1]) + end, + should_attach = function(_, _) + local logger = require 'copilot.logger' + if not vim.bo.buflisted then + logger.debug "not attaching, buffer is not 'buflisted'" + return false + end + + if vim.bo.buftype ~= '' then + logger.debug("not attaching, buffer 'buftype' is " .. vim.bo.buftype) + return false + end + + return true + end, + server = { + type = 'nodejs', -- "nodejs" | "binary" + custom_server_filepath = nil, + }, + server_opts_overrides = {}, + } + end, +} diff --git a/lua/custom/plugins/d2-vim.lua b/lua/custom/plugins/d2-vim.lua new file mode 100644 index 00000000..de55aa9c --- /dev/null +++ b/lua/custom/plugins/d2-vim.lua @@ -0,0 +1,22 @@ +return { + 'terrastruct/d2-vim', + enable = true, + event = { 'BufReadPre', 'BufNewFile' }, + ft = { 'd2', 'md', 'mdx', 'txt' }, + config = function() + vim.g.d2_ascii_autorender = 0 + vim.g.d2_ascii_command = 'd2' + vim.g.d2_ascii_preview_width = vim.o.columns / 2 + vim.g.d2_ascii_mode = 'extended' + vim.g.d2_fmt_autosave = 1 + vim.g.d2_fmt_command = 'd2 fmt' + vim.g.d2_fmt_fail_silently = 0 + vim.g.d2_validate_autosave = 0 + vim.g.d2_validate_command = 'd2 validate' + vim.g.d2_list_type = 'quickfix' + vim.g.d2_fail_silently = 0 + vim.g.d2_play_command = 'd2 play' + vim.g.d2_play_theme = 0 + vim.g.d2_play_sketch = 0 + end, +} diff --git a/lua/custom/plugins/github-nvim-theme.lua b/lua/custom/plugins/github-nvim-theme.lua new file mode 100644 index 00000000..2485f647 --- /dev/null +++ b/lua/custom/plugins/github-nvim-theme.lua @@ -0,0 +1,54 @@ +return { + 'projekt0n/github-nvim-theme', + name = 'github-theme', + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + require('github-theme').setup { + options = { + -- Compiled file's destination location + compile_path = vim.fn.stdpath 'cache' .. '/github-theme', + compile_file_suffix = '_compiled', -- Compiled file suffix + hide_end_of_buffer = true, -- Hide the '~' character at the end of the buffer for a cleaner look + hide_nc_statusline = true, -- Override the underline style for non-active statuslines + transparent = false, -- Disable setting bg (make neovim's background transparent) + terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` + dim_inactive = false, -- Non focused panes set to alternative background + module_default = true, -- Default enable value for modules + styles = { -- Style to be applied to different syntax groups + comments = 'NONE', -- Value is any valid attr-list value `:help attr-list` + functions = 'NONE', + keywords = 'NONE', + variables = 'NONE', + conditionals = 'NONE', + constants = 'NONE', + numbers = 'NONE', + operators = 'NONE', + strings = 'NONE', + types = 'NONE', + }, + inverse = { -- Inverse highlight for different types + match_paren = false, + visual = false, + search = false, + }, + darken = { -- Darken floating windows and sidebar-like windows + floats = true, + sidebars = { + enable = true, + list = {}, -- Apply dark background to specific windows + }, + }, + modules = { -- List of various plugins and additional options + -- ... + }, + }, + palettes = {}, + specs = {}, + groups = {}, + } + + -- -- setup must be called before loading + -- vim.cmd 'colorscheme github_dark' + end, +} diff --git a/lua/custom/plugins/haskell-tools.lua b/lua/custom/plugins/haskell-tools.lua new file mode 100644 index 00000000..71f23bc1 --- /dev/null +++ b/lua/custom/plugins/haskell-tools.lua @@ -0,0 +1,6 @@ +return { + 'mrcjkb/haskell-tools.nvim', + version = '^6', -- Recommended + lazy = false, -- This plugin is already lazy + enabled = true, +} diff --git a/lua/custom/plugins/im-select.lua b/lua/custom/plugins/im-select.lua new file mode 100644 index 00000000..77340a5d --- /dev/null +++ b/lua/custom/plugins/im-select.lua @@ -0,0 +1,40 @@ +return { + 'keaising/im-select.nvim', + lazy = false, + config = function() + require('im_select').setup { + -- IM will be set to `default_im_select` in `normal` mode + -- For Windows/WSL, default: "1033", aka: English US Keyboard + -- For macOS, default: "com.apple.keylayout.ABC", aka: US + -- For Linux, default: + -- "keyboard-us" for Fcitx5 + -- "1" for Fcitx + -- "xkb:us::eng" for ibus + -- You can use `im-select` or `fcitx5-remote -n` to get the IM's name + default_im_select = 'com.apple.keylayout.Australian', + + -- Can be binary's name, binary's full path, or a table, e.g. 'im-select', + -- '/usr/local/bin/im-select' for binary without extra arguments, + -- or { "AIMSwitcher.exe", "--imm" } for binary need extra arguments to work. + -- For Windows/WSL, default: "im-select.exe" + -- For macOS, default: "macism" + -- For Linux, default: "fcitx5-remote" or "fcitx-remote" or "ibus" + default_command = 'macism', + + -- Restore the default input method state when the following events are triggered + set_default_events = { 'VimEnter', 'FocusGained', 'InsertLeave', 'CmdlineLeave' }, + + -- Restore the previous used input method state when the following events + -- are triggered, if you don't want to restore previous used im in Insert mode, + -- e.g. deprecated `disable_auto_restore = 1`, just let it empty + -- as `set_previous_events = {}` + set_previous_events = { 'InsertEnter' }, + + -- Show notification about how to install executable binary when binary missed + keep_quiet_on_no_binary = false, + + -- Async run `default_command` to switch IM or not + async_switch_im = true, + } + end, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..489beffa 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,100 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information + +vim.cmd 'language en_GB.UTF-8' + +vim.opt.encoding = 'utf-8' +vim.opt.fileencoding = 'utf-8' +vim.opt.fileencodings = { 'utf-8' } + +vim.opt.termguicolors = true + +vim.opt.winblend = 0 +vim.opt.pumblend = 0 + +vim.g.background = 'dark' + +vim.opt.wrap = true + +vim.diagnostic.config { + update_in_insert = true, + underline = false, +} + +vim.cmd 'filetype plugin on' + +-- NOTE: keymaps +local map = vim.keymap.set +local opts = { noremap = true, silent = true } + +-- basic function +map('n', ';', ':', { desc = '' }) +-- buffer control +map('n', '', 'bnext', { desc = 'Next buffer' }) +map('n', 'x', 'bdelete', { desc = 'delete buffer' }) + +-- telescope +map('n', 'tc', 'Telescope colorscheme', { desc = '[T]elescope [C]olorscheme' }) + +-- toggleterm +map('n', 'H', 'ToggleTerm size=16 direction=horizontal', { desc = 'Open Terminal Horizontal' }) +-- map('t', 'H', 'ToggleTerm size=20 direction=horizontal', { desc = 'Open Terminal Horizontal' }) +map('n', 'V', 'ToggleTerm size=80 direction=vertical', { desc = 'Open Terminal Vertical' }) +-- map('t', 'V', 'ToggleTerm size=80 direction=vertical', { desc = 'Open Terminal Vertical' }) +map('n', '', 'ToggleTerm direction=float', { desc = 'Open Terminal floating' }) +map('t', '', 'ToggleTerm direction=float', { desc = 'Open Terminal floating' }) + +-- CopilotChat.nvim +map('n', 'cci', 'CopilotChat ', { desc = ':CopilotChat', unpack(opts) }) +map('n', 'cco', 'CopilotChatOpen', { desc = ':CopilotChatOpen', unpack(opts) }) +map('n', 'ccq', 'CopilotChatClose', { desc = ':CopilotChatClose', unpack(opts) }) +map('n', 'cct', 'CopilotChatToggle', { desc = ':CopilotChatToggle', unpack(opts) }) +map('n', 'ccs', 'CopilotChatStop', { desc = ':CopilotChatStop', unpack(opts) }) +map('n', 'ccr', 'CopilotChatReset', { desc = ':CopilotChatReset', unpack(opts) }) +map('n', 'ccS', 'CopilotChatSave ', { desc = 'Save Copilot Chat history', noremap = true, silent = false }) +map('n', 'ccL', 'CopilotChatLoad ', { desc = 'Load Copilot Chat history', noremap = true, silent = false }) +map('n', 'ccp', 'CopilotChatPrompts', { desc = 'Copilot Chat prompt templates', unpack(opts) }) +map('n', 'ccm', 'CopilotChatModels', { desc = 'Copilot Chat models', unpack(opts) }) +map('n', 'ccE', 'CopilotChat', { desc = 'Copilot Chat prompt template', noremap = true, silent = false }) + +-- macos like keybindings for text editing in insert mode +map('i', '', '^', opts) +map('i', '', '$', opts) +map('i', '', 'D', opts) +map('i', '', 'd0', opts) +map('i', '', '', opts) +map('i', '', '', opts) +map('i', '', '', opts) +map('i', '', '', opts) +map('i', '', '', opts) +map('i', '', '', opts) +-- NOTE: keymaps end + +-- NOTE: neovide +local function set_ime(args) + if args.event:match 'Enter$' then + vim.g.neovide_input_ime = true + else + vim.g.neovide_input_ime = false + end +end + +local ime_input = vim.api.nvim_create_augroup('ime_input', { clear = true }) + +vim.api.nvim_create_autocmd({ 'InsertEnter', 'InsertLeave' }, { + group = ime_input, + pattern = '*', + callback = set_ime, +}) + +vim.api.nvim_create_autocmd({ 'CmdlineEnter', 'CmdlineLeave' }, { + group = ime_input, + pattern = '[/\\?]', + callback = set_ime, +}) + +vim.g.neovide_cursor_animation_length = 0.1 +-- NOTE: neovide end + return {} diff --git a/lua/custom/plugins/lean.lua b/lua/custom/plugins/lean.lua new file mode 100644 index 00000000..ebbe3cb4 --- /dev/null +++ b/lua/custom/plugins/lean.lua @@ -0,0 +1,24 @@ +return { + 'Julian/lean.nvim', + event = { 'BufReadPre *.lean', 'BufNewFile *.lean' }, + + dependencies = { + 'neovim/nvim-lspconfig', + 'nvim-lua/plenary.nvim', + + -- optional dependencies: + + -- a completion engine + -- hrsh7th/nvim-cmp or Saghen/blink.cmp are popular choices + + 'nvim-telescope/telescope.nvim', -- for 2 Lean-specific pickers + 'andymass/vim-matchup', -- for enhanced % motion behavior + 'andrewradev/switch.vim', -- for switch support + 'tomtom/tcomment_vim', -- for commenting + }, + + ---@type lean.Config + opts = { -- see below for full configuration options + mappings = true, + }, +} diff --git a/lua/custom/plugins/mcp-hub.lua b/lua/custom/plugins/mcp-hub.lua new file mode 100644 index 00000000..c254a75f --- /dev/null +++ b/lua/custom/plugins/mcp-hub.lua @@ -0,0 +1,92 @@ +return { + 'ravitemer/mcphub.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + build = 'bundled_build.lua', + config = function() + require('mcphub').setup { + --- `mcp-hub` binary related options------------------- + config = vim.fn.expand '~/.config/mcphub/servers.json', -- Absolute path to MCP Servers config file (will create if not exists) + port = 37373, -- The port `mcp-hub` server listens to + shutdown_delay = 5 * 60 * 000, -- Delay in ms before shutting down the server when last instance closes (default: 5 minutes) + use_bundled_binary = true, -- Use local `mcp-hub` binary (set this to true when using build = "bundled_build.lua") + mcp_request_timeout = 60000, --Max time allowed for a MCP tool or resource to execute in milliseconds, set longer for long running tasks + global_env = {}, -- Global environment variables available to all MCP servers (can be a table or a function returning a table) + workspace = { + enabled = true, -- Enable project-local configuration files + look_for = { '.mcphub/servers.json', '.vscode/mcp.json', '.cursor/mcp.json' }, -- Files to look for when detecting project boundaries (VS Code format supported) + reload_on_dir_changed = true, -- Automatically switch hubs on DirChanged event + port_range = { min = 40000, max = 41000 }, -- Port range for generating unique workspace ports + get_port = nil, -- Optional function returning custom port number. Called when generating ports to allow custom port assignment logic + }, + + ---Chat-plugin related options----------------- + auto_approve = false, -- Auto approve mcp tool calls + auto_toggle_mcp_servers = true, -- Let LLMs start and stop MCP servers automatically + extensions = { + avante = { + make_slash_commands = true, -- make /slash commands from MCP server prompts + }, + copilotchat = { + enabled = true, + convert_tools_to_functions = true, -- Convert MCP tools to CopilotChat functions + convert_resources_to_functions = true, -- Convert MCP resources to CopilotChat functions + add_mcp_prefix = false, -- Add "mcp_" prefix to function names + }, + }, + + --- Plugin specific options------------------- + native_servers = {}, -- add your custom lua native servers here + builtin_tools = { + edit_file = { + parser = { + track_issues = true, + extract_inline_content = true, + }, + locator = { + fuzzy_threshold = 0.8, + enable_fuzzy_matching = true, + }, + ui = { + go_to_origin_on_complete = true, + keybindings = { + accept = '.', + reject = ',', + next = 'n', + prev = 'p', + accept_all = 'ga', + reject_all = 'gr', + }, + }, + }, + }, + ui = { + window = { + width = 0.8, -- 0-1 (ratio); "50%" (percentage); 50 (raw number) + height = 0.8, -- 0-1 (ratio); "50%" (percentage); 50 (raw number) + align = 'center', -- "center", "top-left", "top-right", "bottom-left", "bottom-right", "top", "bottom", "left", "right" + relative = 'editor', + zindex = 50, + border = 'rounded', -- "none", "single", "double", "rounded", "solid", "shadow" + }, + wo = { -- window-scoped options (vim.wo) + winhl = 'Normal:MCPHubNormal,FloatBorder:MCPHubBorder', + }, + }, + json_decode = nil, -- Custom JSON parser function (e.g., require('json5').parse for JSON5 support) + on_ready = function(hub) + -- Called when hub is ready + end, + on_error = function(err) + -- Called on errors + end, + log = { + level = vim.log.levels.WARN, + to_file = false, + file_path = nil, + prefix = 'MCPHub', + }, + } + end, +} diff --git a/lua/custom/plugins/multicursor.lua b/lua/custom/plugins/multicursor.lua new file mode 100644 index 00000000..2824a100 --- /dev/null +++ b/lua/custom/plugins/multicursor.lua @@ -0,0 +1,159 @@ +return { + 'jake-stewart/multicursor.nvim', + lazy = false, + branch = '1.0', + config = function() + local mc = require 'multicursor-nvim' + mc.setup() + + local set = vim.keymap.set + + -- Add or skip cursor above/below the main cursor. + set({ 'n', 'x' }, '', function() + mc.lineAddCursor(-1) + end) + set({ 'n', 'x' }, '', function() + mc.lineAddCursor(1) + end) + set({ 'n', 'x' }, '', function() + mc.lineSkipCursor(-1) + end) + set({ 'n', 'x' }, '', function() + mc.lineSkipCursor(1) + end) + + -- Add or skip adding a new cursor by matching word/selection + set({ 'n', 'x' }, 'n', function() + mc.matchAddCursor(1) + end) + set({ 'n', 'x' }, 's', function() + mc.matchSkipCursor(1) + end) + set({ 'n', 'x' }, 'N', function() + mc.matchAddCursor(-1) + end) + set({ 'n', 'x' }, 'S', function() + mc.matchSkipCursor(-1) + end) + + -- Add and remove cursors with control + left click. + set('n', '', mc.handleMouse) + set('n', '', mc.handleMouseDrag) + set('n', '', mc.handleMouseRelease) + + -- Disable and enable cursors. + set({ 'n', 'x' }, '', mc.toggleCursor) + + -- Mappings defined in a keymap layer only apply when there are + -- multiple cursors. This lets you have overlapping mappings. + mc.addKeymapLayer(function(layerSet) + -- Select a different cursor as the main one. + layerSet({ 'n', 'x' }, '', mc.prevCursor) + layerSet({ 'n', 'x' }, '', mc.nextCursor) + + -- Delete the main cursor. + layerSet({ 'n', 'x' }, 'x', mc.deleteCursor) + + -- Enable and clear cursors using escape. + layerSet('n', '', function() + if not mc.cursorsEnabled() then + mc.enableCursors() + else + mc.clearCursors() + end + end) + + -- Pressing `gaip` will add a cursor on each line of a paragraph. + set('n', 'ga', mc.addCursorOperator) + + -- Clone every cursor and disable the originals. + set({ 'n', 'x' }, '', mc.duplicateCursors) + + -- Align cursor columns. + set('n', 'a', mc.alignCursors) + + -- Split visual selections by regex. + set('x', 'S', mc.splitCursors) + + -- match new cursors within visual selections by regex. + set('x', 'M', mc.matchCursors) + + -- bring back cursors if you accidentally clear them + set('n', 'gv', mc.restoreCursors) + + -- Add a cursor for all matches of cursor word/selection in the document. + set({ 'n', 'x' }, 'A', mc.matchAllAddCursors) + + -- Rotate the text contained in each visual selection between cursors. + set('x', 't', function() + mc.transposeCursors(1) + end) + set('x', 'T', function() + mc.transposeCursors(-1) + end) + + -- Append/insert for each line of visual selections. + -- Similar to block selection insertion. + set('x', 'I', mc.insertVisual) + set('x', 'A', mc.appendVisual) + + -- Increment/decrement sequences, treaing all cursors as one sequence. + set({ 'n', 'x' }, 'g', mc.sequenceIncrement) + set({ 'n', 'x' }, 'g', mc.sequenceDecrement) + + -- Add a cursor and jump to the next/previous search result. + set('n', '/n', function() + mc.searchAddCursor(1) + end) + set('n', '/N', function() + mc.searchAddCursor(-1) + end) + + -- Jump to the next/previous search result without adding a cursor. + set('n', '/s', function() + mc.searchSkipCursor(1) + end) + set('n', '/S', function() + mc.searchSkipCursor(-1) + end) + + -- Add a cursor to every search result in the buffer. + set('n', '/A', mc.searchAllAddCursors) + + -- Pressing `miwap` will create a cursor in every match of the + -- string captured by `iw` inside range `ap`. + -- This action is highly customizable, see `:h multicursor-operator`. + set({ 'n', 'x' }, 'm', mc.operator) + + -- Add or skip adding a new cursor by matching diagnostics. + set({ 'n', 'x' }, ']d', function() + mc.diagnosticAddCursor(1) + end) + set({ 'n', 'x' }, '[d', function() + mc.diagnosticAddCursor(-1) + end) + set({ 'n', 'x' }, ']s', function() + mc.diagnosticSkipCursor(1) + end) + set({ 'n', 'x' }, '[S', function() + mc.diagnosticSkipCursor(-1) + end) + + -- Press `mdip` to add a cursor for every error diagnostic in the range `ip`. + set({ 'n', 'x' }, 'md', function() + -- See `:h vim.diagnostic.GetOpts`. + mc.diagnosticMatchCursors { severity = vim.diagnostic.severity.ERROR } + end) + end) + + -- Customize how cursors look. + local hl = vim.api.nvim_set_hl + hl(0, 'MultiCursorCursor', { reverse = true }) + hl(0, 'MultiCursorVisual', { link = 'Visual' }) + hl(0, 'MultiCursorSign', { link = 'SignColumn' }) + hl(0, 'MultiCursorMatchPreview', { link = 'Search' }) + hl(0, 'MultiCursorDisabledCursor', { reverse = true }) + hl(0, 'MultiCursorDisabledVisual', { link = 'Visual' }) + hl(0, 'MultiCursorDisabledSign', { link = 'SignColumn' }) + end, +} diff --git a/lua/custom/plugins/nerdy.lua b/lua/custom/plugins/nerdy.lua new file mode 100644 index 00000000..4e437530 --- /dev/null +++ b/lua/custom/plugins/nerdy.lua @@ -0,0 +1,13 @@ +return { + '2kabhishek/nerdy.nvim', + dependencies = { + 'folke/snacks.nvim', + }, + cmd = 'Nerdy', + opts = { + max_recents = 30, -- Configure recent icons limit + add_default_keybindings = true, -- Add default keybindings + copy_to_clipboard = false, -- Copy glyph to clipboard instead of inserting + copy_register = '+', -- Register to use for copying (if `copy_to_clipboard` is true) + }, +} diff --git a/lua/custom/plugins/nightfox.lua b/lua/custom/plugins/nightfox.lua new file mode 100644 index 00000000..edefa260 --- /dev/null +++ b/lua/custom/plugins/nightfox.lua @@ -0,0 +1,53 @@ +return { + 'EdenEast/nightfox.nvim', + lazy = false, + priority = 1000, + config = function() + require('nightfox').setup { + options = { + -- Compiled file's destination location + compile_path = vim.fn.stdpath 'cache' .. '/nightfox', + compile_file_suffix = '_compiled', -- Compiled file suffix + transparent = true, -- Disable setting background + terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` + dim_inactive = false, -- Non focused panes set to alternative background + module_default = true, -- Default enable value for modules + colorblind = { + enable = false, -- Enable colorblind support + simulate_only = false, -- Only show simulated colorblind colors and not diff shifted + severity = { + protan = 0, -- Severity [0,1] for protan (red) + deutan = 0, -- Severity [0,1] for deutan (green) + tritan = 0, -- Severity [0,1] for tritan (blue) + }, + }, + styles = { -- Style to be applied to different syntax groups + comments = 'NONE', -- Value is any valid attr-list value `:help attr-list` + conditionals = 'NONE', + constants = 'NONE', + functions = 'NONE', + keywords = 'NONE', + numbers = 'NONE', + operators = 'NONE', + strings = 'NONE', + types = 'NONE', + variables = 'NONE', + }, + inverse = { -- Inverse highlight for different types + match_paren = false, + visual = false, + search = false, + }, + modules = { -- List of various plugins and additional options + -- ... + }, + }, + palettes = {}, + specs = {}, + groups = {}, + } + + -- setup must be called before loading + -- vim.cmd 'colorscheme dayfox' + end, +} diff --git a/lua/custom/plugins/nvim-autopairs.lua b/lua/custom/plugins/nvim-autopairs.lua new file mode 100644 index 00000000..39546347 --- /dev/null +++ b/lua/custom/plugins/nvim-autopairs.lua @@ -0,0 +1,28 @@ +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = true, + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function + opts = { + enabled = function(bufnr) + return true + end, -- control if auto-pairs should be enabled when attaching to a buffer + disable_filetype = { 'TelescopePrompt', 'spectre_panel', 'snacks_picker_input' }, + disable_in_macro = true, -- disable when recording or executing a macro + disable_in_visualblock = false, -- disable when insert after visual block mode + disable_in_replace_mode = true, + ignored_next_char = [=[[%w%%%'%[%"%.%`%$]]=], + enable_moveright = true, + enable_afterquote = true, -- add bracket pairs after quote + enable_check_bracket_line = true, --- check bracket in same line + enable_bracket_in_quote = true, -- + enable_abbr = false, -- trigger abbreviation + break_undo = true, -- switch for basic rule break undo sequence + check_ts = false, + map_cr = true, + map_bs = true, -- map the key + map_c_h = false, -- Map the key to delete a pair + map_c_w = false, -- map to delete a pair if possible + }, +} diff --git a/lua/custom/plugins/peek.lua b/lua/custom/plugins/peek.lua new file mode 100644 index 00000000..c21ed5b2 --- /dev/null +++ b/lua/custom/plugins/peek.lua @@ -0,0 +1,31 @@ +return { + 'toppair/peek.nvim', + event = { 'VeryLazy' }, + build = 'deno task --quiet build:fast', + config = function() + require('peek').setup { + auto_load = true, -- whether to automatically load preview when + -- entering another markdown buffer + close_on_bdelete = true, -- close preview window on buffer delete + + syntax = true, -- enable syntax highlighting, affects performance + + theme = 'light', -- 'dark' or 'light' + + update_on_change = true, + + app = 'webview', -- 'webview', 'browser', string or a table of strings + -- explained below + + filetype = { 'markdown' }, -- list of filetypes to recognize as markdown + + -- relevant if update_on_change is true + throttle_at = 200000, -- start throttling when file exceeds this + -- amount of bytes in size + throttle_time = 'auto', -- minimum amount of time in milliseconds + -- that has to pass before starting new render + } + vim.api.nvim_create_user_command('PeekOpen', require('peek').open, {}) + vim.api.nvim_create_user_command('PeekClose', require('peek').close, {}) + end, +} diff --git a/lua/custom/plugins/render-markdown.lua b/lua/custom/plugins/render-markdown.lua new file mode 100644 index 00000000..7139a38b --- /dev/null +++ b/lua/custom/plugins/render-markdown.lua @@ -0,0 +1,53 @@ +return { + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.nvim' }, -- if you use the mini.nvim suite + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.icons' }, -- if you use standalone mini plugins + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = { + checkbox = { + enabled = true, + render_modes = false, + bullet = false, + left_pad = 0, + right_pad = 1, + unchecked = { + icon = '󰄱 ', + highlight = 'RenderMarkdownUnchecked', + scope_highlight = nil, + }, + checked = { + icon = '󰱒 ', + highlight = 'RenderMarkdownChecked', + scope_highlight = nil, + }, + custom = { + doing = { raw = '[d]', rendered = ' ', highlight = 'RenderMarkdownTodo', scope_highlight = nil }, + pending = { raw = '[p]', rendered = '󰥔 ', highlight = 'RenderMarkdownTodo', scope_highlight = nil }, + asking = { raw = '[a]', rendered = '󱜺 ', highlight = 'RenderMarkDownTodo', scope_highlight = nil }, + }, + scope_priority = nil, + }, + }, + html = { + -- Turn on / off all HTML rendering. + enabled = true, + -- Additional modes to render HTML. + render_modes = false, + comment = { + -- Turn on / off HTML comment concealing. + conceal = false, + -- Optional text to inline before the concealed comment. + text = nil, + -- Highlight for the inlined text. + highlight = 'RenderMarkdownHtmlComment', + }, + -- HTML tags whose start and end will be hidden and icon shown. + -- The key is matched against the tag name, value type below. + -- | icon | optional icon inlined at start of tag | + -- | highlight | optional highlight for the icon | + -- | scope_highlight | optional highlight for item associated with tag | + tag = {}, + }, +} diff --git a/lua/custom/plugins/rose-pine.lua b/lua/custom/plugins/rose-pine.lua new file mode 100644 index 00000000..27cfd345 --- /dev/null +++ b/lua/custom/plugins/rose-pine.lua @@ -0,0 +1,92 @@ +-- lua/plugins/rose-pine.lua +return { + 'rose-pine/neovim', + lazy = false, + priority = 1000, + name = 'rose-pine', + config = function() + require('rose-pine').setup { + variant = 'auto', -- auto, main, moon, or dawn + dark_variant = 'main', -- main, moon, or dawn + dim_inactive_windows = false, + extend_background_behind_borders = true, + + enable = { + terminal = true, + legacy_highlights = true, -- Improve compatibility for previous versions of Neovim + migrations = true, -- Handle deprecated options automatically + }, + + styles = { + bold = true, + italic = true, + transparency = false, + }, + + groups = { + border = 'muted', + link = 'iris', + panel = 'surface', + + error = 'love', + hint = 'iris', + info = 'foam', + note = 'pine', + todo = 'rose', + warn = 'gold', + + git_add = 'foam', + git_change = 'rose', + git_delete = 'love', + git_dirty = 'rose', + git_ignore = 'muted', + git_merge = 'iris', + git_rename = 'pine', + git_stage = 'iris', + git_text = 'rose', + git_untracked = 'subtle', + + h1 = 'iris', + h2 = 'foam', + h3 = 'rose', + h4 = 'gold', + h5 = 'pine', + h6 = 'foam', + }, + + palette = { + -- Override the builtin palette per variant + -- moon = { + -- base = '#18191a', + -- overlay = '#363738', + -- }, + }, + + -- NOTE: Highlight groups are extended (merged) by default. Disable this + -- per group via `inherit = false` + highlight_groups = { + -- Comment = { fg = "foam" }, + -- StatusLine = { fg = "love", bg = "love", blend = 15 }, + -- VertSplit = { fg = "muted", bg = "muted" }, + -- Visual = { fg = "base", bg = "text", inherit = false }, + }, + + before_highlight = function(group, highlight, palette) + -- Disable all undercurls + -- if highlight.undercurl then + -- highlight.undercurl = false + -- end + -- + -- Change palette colour + -- if highlight.fg == palette.pine then + -- highlight.fg = palette.foam + -- end + end, + } + + -- vim.cmd 'colorscheme rose-pine' + -- vim.cmd("colorscheme rose-pine-main") + -- vim.cmd("colorscheme rose-pine-moon") + -- vim.cmd("colorscheme rose-pine-dawn") + end, +} diff --git a/lua/custom/plugins/rustaceanvim.lua b/lua/custom/plugins/rustaceanvim.lua new file mode 100644 index 00000000..eb83332c --- /dev/null +++ b/lua/custom/plugins/rustaceanvim.lua @@ -0,0 +1,5 @@ +return { + 'mrcjkb/rustaceanvim', + version = '^6', -- Recommended + lazy = false, -- This plugin is already lazy +} diff --git a/lua/custom/plugins/snacks.lua b/lua/custom/plugins/snacks.lua new file mode 100644 index 00000000..d1c190f1 --- /dev/null +++ b/lua/custom/plugins/snacks.lua @@ -0,0 +1,57 @@ +return { + 'folke/snacks.nvim', + -- enabled = false, + priority = 1000, + lazy = false, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + bigfile = { enabled = true }, + dashboard = { enabled = true }, + explorer = { enabled = true }, + indent = { enabled = true }, + input = { enabled = true }, + picker = { enabled = true }, + + notifier = { + enabled = true, + timeout = 3000, -- default timeout in ms + width = { min = 40, max = 0.4 }, + height = { min = 1, max = 0.6 }, + -- editor margin to keep free. tabline and statusline are taken into account automatically + margin = { top = 0, right = 1, bottom = 0 }, + padding = true, -- add 1 cell of left/right padding to the notification window + gap = 0, -- gap between notifications + sort = { 'level', 'added' }, -- sort by level and time + -- minimum log level to display. trace is the lowest + -- all notifications are stored in history + level = vim.log.levels.trace, + icons = { + error = ' ', + warn = ' ', + info = ' ', + debug = ' ', + trace = ' ', + }, + keep = function(notif) + return vim.fn.getcmdpos() > 0 + end, + style = 'compact', + top_down = false, -- place notifications from top to bottom + date_format = '%R', -- time format for notifications + -- format for footer when more lines are available + -- `%d` is replaced with the number of lines. + -- only works for styles with a border + ---@type string|boolean + more_format = ' ↓ %d lines ', + refresh = 50, -- refresh at most every 50ms + }, + + quickfile = { enabled = true }, + scope = { enabled = true }, + scroll = { enabled = false }, + statuscolumn = { enabled = true }, + words = { enabled = true }, + }, +} diff --git a/lua/custom/plugins/tiny-inline-diagnostic.lua b/lua/custom/plugins/tiny-inline-diagnostic.lua new file mode 100644 index 00000000..6ee610ea --- /dev/null +++ b/lua/custom/plugins/tiny-inline-diagnostic.lua @@ -0,0 +1,138 @@ +return { + 'rachartier/tiny-inline-diagnostic.nvim', + event = 'VeryLazy', -- `LspAttach`,`VeryLazy` + priority = 1000, -- needs to be loaded in first + config = function() + require('tiny-inline-diagnostic').setup { + -- Style preset for diagnostic messages + -- Available options: + -- "modern", "classic", "minimal", "powerline", + -- "ghost", "simple", "nonerdfont", "amongus" + preset = 'modern', + + transparent_bg = true, -- Set the background of the diagnostic to transparent + + hi = { + error = 'DiagnosticError', -- Highlight group for error messages + warn = 'DiagnosticWarn', -- Highlight group for warning messages + info = 'DiagnosticInfo', -- Highlight group for informational messages + hint = 'DiagnosticHint', -- Highlight group for hint or suggestion messages + arrow = 'NonText', -- Highlight group for diagnostic arrows + + -- Background color for diagnostics + -- Can be a highlight group or a hexadecimal color (#RRGGBB) + background = 'CursorLine', + + -- Color blending option for the diagnostic background + -- Use "None" or a hexadecimal color (#RRGGBB) to blend with another color + mixing_color = 'None', + }, + + options = { + -- Display the source of the diagnostic (e.g., basedpyright, vsserver, lua_ls etc.) + show_source = true, + + -- Use icons defined in the diagnostic configuration + use_icons_from_diagnostic = true, + + -- Set the arrow icon to the same color as the first diagnostic severity + set_arrow_to_diag_color = false, + + -- Add messages to diagnostics when multiline diagnostics are enabled + -- If set to false, only signs will be displayed + add_messages = true, + + -- Time (in milliseconds) to throttle updates while moving the cursor + -- Increase this value for better performance if your computer is slow + -- or set to 0 for immediate updates and better visual + throttle = 20, + + -- Minimum message length before wrapping to a new line + softwrap = 30, + + -- Configuration for multiline diagnostics + -- Can either be a boolean or a table with the following options: + -- multilines = { + -- enabled = false, + -- always_show = false, + -- } + -- If it set as true, it will enable the feature with this options: + -- multilines = { + -- enabled = true, + -- always_show = false, + -- } + multilines = { + -- Enable multiline diagnostic messages + enabled = true, + + -- Always show messages on all lines for multiline diagnostics + always_show = true, + }, + + -- Display all diagnostic messages on the cursor line + show_all_diags_on_cursorline = true, + + -- Enable diagnostics in Insert mode + -- If enabled, it is better to set the `throttle` option to 0 to avoid visual artifacts + enable_on_insert = true, + + -- Enable diagnostics in Select mode (e.g when auto inserting with Blink) + enable_on_select = true, + + overflow = { + -- Manage how diagnostic messages handle overflow + -- Options: + -- "wrap" - Split long messages into multiple lines + -- "none" - Do not truncate messages + -- "oneline" - Keep the message on a single line, even if it's long + mode = 'wrap', + + -- Trigger wrapping to occur this many characters earlier when mode == "wrap". + -- Increase this value appropriately if you notice that the last few characters + -- of wrapped diagnostics are sometimes obscured. + padding = 0, + }, + + -- Configuration for breaking long messages into separate lines + break_line = { + -- Enable the feature to break messages after a specific length + enabled = true, + + -- Number of characters after which to break the line + after = 30, + }, + + -- Custom format function for diagnostic messages + -- Example: + -- format = function(diagnostic) + -- return diagnostic.message .. " [" .. diagnostic.source .. "]" + -- end + format = nil, + + virt_texts = { + -- Priority for virtual text display + priority = 2048, + }, + + -- Filter diagnostics by severity + -- Available severities: + -- vim.diagnostic.severity.ERROR + -- vim.diagnostic.severity.WARN + -- vim.diagnostic.severity.INFO + -- vim.diagnostic.severity.HINT + severity = { + vim.diagnostic.severity.ERROR, + vim.diagnostic.severity.WARN, + vim.diagnostic.severity.INFO, + vim.diagnostic.severity.HINT, + }, + + -- Events to attach diagnostics to buffers + -- You should not change this unless the plugin does not work with your configuration + overwrite_events = nil, + }, + disabled_ft = {}, -- List of filetypes to disable the plugin + } + vim.diagnostic.config { virtual_text = false } -- Only if needed in your configuration, if you already have native LSP diagnostics + end, +} diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua new file mode 100644 index 00000000..c14cedb5 --- /dev/null +++ b/lua/custom/plugins/toggleterm.lua @@ -0,0 +1,6 @@ +return { + 'akinsho/toggleterm.nvim', + version = '*', + config = true, + opts = {}, +} diff --git a/lua/custom/plugins/tree-sitter-d2.lua b/lua/custom/plugins/tree-sitter-d2.lua new file mode 100644 index 00000000..312d1201 --- /dev/null +++ b/lua/custom/plugins/tree-sitter-d2.lua @@ -0,0 +1,7 @@ +return { + 'ravsii/tree-sitter-d2', + enable = true, + ft = { 'd2', 'md' }, + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + build = 'make nvim-install', +} diff --git a/lua/custom/plugins/typst-preview.lua b/lua/custom/plugins/typst-preview.lua new file mode 100644 index 00000000..767d724e --- /dev/null +++ b/lua/custom/plugins/typst-preview.lua @@ -0,0 +1,7 @@ +return { + 'chomosuke/typst-preview.nvim', + lazy = false, -- or ft = 'typst' + ft = 'typst', + version = '1.*', + opts = {}, -- lazy.nvim will implicitly calls `setup {}` +} diff --git a/lua/custom/plugins/typst.lua b/lua/custom/plugins/typst.lua new file mode 100644 index 00000000..5677bbb6 --- /dev/null +++ b/lua/custom/plugins/typst.lua @@ -0,0 +1,8 @@ +return { + 'kaarmu/typst.vim', + ft = 'typst', + lazy = false, + config = function() + vim.g.typst_pdf_viewer = 'skim' + end, +} diff --git a/lua/custom/plugins/zk-nvim.lua b/lua/custom/plugins/zk-nvim.lua new file mode 100644 index 00000000..c5b086e7 --- /dev/null +++ b/lua/custom/plugins/zk-nvim.lua @@ -0,0 +1,30 @@ +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 = 'select', + + highlight = { + additional_vim_regex_highlighting = true, + }, + + 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, +}