diff options
| author | ache <ache@ache.one> | 2024-09-18 14:41:11 +0200 |
|---|---|---|
| committer | ache <ache@ache.one> | 2024-09-18 14:41:11 +0200 |
| commit | d757a05576b0785fe79791c9a7d60bd6c4ba63b8 (patch) | |
| tree | 7a3d10ccd51b30b4927438eb07672679019f71ee | |
| parent | Color NBSP ! 🌈 (diff) | |
Clean up plugins
36 files changed, 987 insertions, 667 deletions
diff --git a/lua/ache/plugins/auto-session.lua b/lua/ache/plugins/auto-session.lua index 7709a3b..5d1912e 100644 --- a/lua/ache/plugins/auto-session.lua +++ b/lua/ache/plugins/auto-session.lua @@ -1,4 +1,7 @@ -- Barely use it +--[ +-- This plugin helps to make sessions and quickly jump in. +--] return { "rmagatti/auto-session", diff --git a/lua/ache/plugins/autopairs.lua b/lua/ache/plugins/autopairs.lua index 1d297fe..48c7854 100644 --- a/lua/ache/plugins/autopairs.lua +++ b/lua/ache/plugins/autopairs.lua @@ -1,25 +1,28 @@ +--[ +-- Quick add matching pair of a somes characters. +--] return { - "windwp/nvim-autopairs", - event = { "InsertEnter" }, - dependencies = { - "hrsh7th/nvim-cmp", -- Why ?! - }, - config = function() - local autopairs = require("nvim-autopairs") + "windwp/nvim-autopairs", + event = { "InsertEnter" }, + dependencies = { + "hrsh7th/nvim-cmp", -- Why ?! + }, + config = function() + local autopairs = require("nvim-autopairs") - autopairs.setup({ - check_ts = true, -- ts is for treesitter - ts_config = { - lua = { "string" }, -- Don't add pairs in lua string treesitter nodes. - javascript = { "template_string" }, -- Don't add pairs in JS template template_string treesitter nodes. - java = false, - }, - }) + autopairs.setup({ + check_ts = true, -- ts is for treesitter + ts_config = { + lua = { "string" }, -- Don't add pairs in lua string treesitter nodes. + javascript = { "template_string" }, -- Don't add pairs in JS template template_string treesitter nodes. + java = false, + }, + }) - local cmp_autopairs = require("nvim-autopairs.completion.cmp") - local cmp = require("cmp") + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + local cmp = require("cmp") - -- Makes autopairs and completion work together. - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) - end, + -- Makes autopairs and completion work together. + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end, } diff --git a/lua/ache/plugins/bufferline.lua b/lua/ache/plugins/bufferline.lua index 8d2dbaa..11490ce 100644 --- a/lua/ache/plugins/bufferline.lua +++ b/lua/ache/plugins/bufferline.lua @@ -1,3 +1,6 @@ +--[ +-- A plugin to have powerfull tabs. +--] return { "akinsho/bufferline.nvim", version = "*", diff --git a/lua/ache/plugins/comment.lua b/lua/ache/plugins/comment.lua index c8f8c17..e90f0da 100644 --- a/lua/ache/plugins/comment.lua +++ b/lua/ache/plugins/comment.lua @@ -1,18 +1,20 @@ +--[ +-- A plugin to comment and uncomment +--] return { - "numToStr/Comment.nvim", - event = {"BufReadPre", "BufNewFile"}, - dependencies = { - "JoosepAlviste/nvim-ts-context-commentstring", - }, - -- NOTE: gc to comment. - config = function() - local comment = require("Comment") - local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") + "numToStr/Comment.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + }, + -- NOTE: gc to comment. + config = function() + local comment = require("Comment") + local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") - - comment.setup({ - -- for commenting tsx, jsx, svelte, html files - pre_hook = ts_context_commentstring.create_pre_hook(), - }) - end + comment.setup({ + -- for commenting tsx, jsx, svelte, html files + pre_hook = ts_context_commentstring.create_pre_hook(), + }) + end, } diff --git a/lua/ache/plugins/dressing.lua b/lua/ache/plugins/dressing.lua index 105f7e5..1aa9c95 100644 --- a/lua/ache/plugins/dressing.lua +++ b/lua/ache/plugins/dressing.lua @@ -1,4 +1,8 @@ +--[ +-- Add a small editbox near the actual action. +--] + return { - "stevearc/dressing.nvim", - event = "VeryLazy", + "stevearc/dressing.nvim", + event = "VeryLazy", } diff --git a/lua/ache/plugins/fidget.lua b/lua/ache/plugins/fidget.lua index 2d70394..c3b48e1 100644 --- a/lua/ache/plugins/fidget.lua +++ b/lua/ache/plugins/fidget.lua @@ -1,6 +1,11 @@ +--[ +-- A plugin to show notifications and LSP progress messages. +-- +-- Does works well. +--] return { - "j-hui/fidget.nvim", - opts = { - -- options - }, + "j-hui/fidget.nvim", + opts = { + -- options + }, } diff --git a/lua/ache/plugins/firenvim.lua b/lua/ache/plugins/firenvim.lua index 73ae7ab..b3f74c0 100644 --- a/lua/ache/plugins/firenvim.lua +++ b/lua/ache/plugins/firenvim.lua @@ -1,3 +1,7 @@ +--[ +-- Edit a Web text edit within neovim ! +--] + return { "glacambre/firenvim", diff --git a/lua/ache/plugins/formatting.lua b/lua/ache/plugins/formatting.lua index d3c7e5f..38910bf 100644 --- a/lua/ache/plugins/formatting.lua +++ b/lua/ache/plugins/formatting.lua @@ -1,35 +1,39 @@ +--[ +-- Formatter plugin for Neovim. +--] return { - "stevearc/conform.nvim", - event = {"BufReadPre", "BufNewFile" }, - config = function() - local conform = require("conform") + "stevearc/conform.nvim", + enable = false, + event = { "BufReadPre", "BufNewFile" }, + config = function() + local conform = require("conform") - conform.setup({ - formatters_by_ft = { - javascript = { "prettier" }, - typescript = { "prettier" }, - svelte = { "prettier" }, - css = { "prettier" }, - html = { "prettier" }, - json = { "prettier" }, - yaml = { "prettier" }, - markdown = { "prettier" }, - lua = { "stylua" }, - python = { "isort", "black" }, - }, - format_on_save = { - lsp_fallback = true, - async = false, - tiemout_ms = 1000, - }, - }) + conform.setup({ + formatters_by_ft = { + javascript = { "prettier" }, + typescript = { "prettier" }, + svelte = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + yaml = { "prettier" }, + markdown = { "prettier" }, + lua = { "stylua" }, + python = { "isort", "black" }, + }, + format_on_save = { + lsp_fallback = true, + async = false, + tiemout_ms = 1000, + }, + }) - vim.keymap.set({ "n", "v"}, "<leader>mp", function() - conform.format({ - lsp_fallback = true, - async = false, - tiemout_ms = 1000, - }) - end, { desc = "Format file or range (in visual mode)"}) - end, + vim.keymap.set({ "n", "v" }, "<leader>mp", function() + conform.format({ + lsp_fallback = true, + async = false, + tiemout_ms = 1000, + }) + end, { desc = "Format file or range (in visual mode)" }) + end, } diff --git a/lua/ache/plugins/gitsigns.lua b/lua/ache/plugins/gitsigns.lua index 80950bc..fef5906 100644 --- a/lua/ache/plugins/gitsigns.lua +++ b/lua/ache/plugins/gitsigns.lua @@ -1,102 +1,106 @@ +--[ +-- Add next to the line number the "git status" of a line. +--] + return { - "lewis6991/gitsigns.nvim", - event = { "BufReadPre", "BufNewFile" }, - config = function() - require("gitsigns").setup({ - signs = { - add = { text = "┃" }, - change = { text = "┃" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - untracked = { text = "┆" }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - follow_files = true, - }, - auto_attach = true, - attach_to_untracked = false, - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - virt_text_priority = 100, - }, - current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>", - -- current_line_blame_formatter_opts = { - -- relative_time = false, - -- }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, -- Disable if file is longer than this (in lines) - preview_config = { - -- Options passed to nvim_open_win - border = "single", - style = "minimal", - relative = "cursor", - row = 0, - col = 1, - }, - on_attach = function(buf) - local gs = package.loaded.gitsigns + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("gitsigns").setup({ + signs = { + add = { text = "┃" }, + change = { text = "┃" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "┆" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + follow_files = true, + }, + auto_attach = true, + attach_to_untracked = false, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + virt_text_priority = 100, + }, + current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>", + -- current_line_blame_formatter_opts = { + -- relative_time = false, + -- }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + on_attach = function(buf) + local gs = package.loaded.gitsigns - -- Navigation - vim.keymap.set("n", ">h", gs.next_hunk, { desc = "Go to next hunk", buffer = buf }) - vim.keymap.set("n", "<h", gs.prev_hunk, { desc = "Go to previous hunk", buffer = buf }) + -- Navigation + vim.keymap.set("n", ">h", gs.next_hunk, { desc = "Go to next hunk", buffer = buf }) + vim.keymap.set("n", "<h", gs.prev_hunk, { desc = "Go to previous hunk", buffer = buf }) - -- Actions - ---- Reset and blame hunk - vim.keymap.set("n", "<leader>hs", gs.stage_hunk, { desc = "Stage hunk", buffer = buf }) - vim.keymap.set("n", "<leader>hr", gs.reset_hunk, { desc = "Reset hunk", buffer = buf }) - vim.keymap.set("v", "<leader>hs", function() - gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end, { desc = "Stage hunk", buffer = buf }) - vim.keymap.set("v", "<leader>hr", function() - gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end, { desc = "Reset hunk", buffer = buf }) + -- Actions + ---- Reset and blame hunk + vim.keymap.set("n", "<leader>hs", gs.stage_hunk, { desc = "Stage hunk", buffer = buf }) + vim.keymap.set("n", "<leader>hr", gs.reset_hunk, { desc = "Reset hunk", buffer = buf }) + vim.keymap.set("v", "<leader>hs", function() + gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, { desc = "Stage hunk", buffer = buf }) + vim.keymap.set("v", "<leader>hr", function() + gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, { desc = "Reset hunk", buffer = buf }) - ---- Reset and blame hunkcurrent_line_blame_formatter_opts - vim.keymap.set("n", "<leader>hs", gs.stage_hunk, { desc = "Stage hunk", buffer = buf }) - vim.keymap.set("n", "<leader>hS", gs.stage_buffer, { desc = "Stage current buffer", buffer = buf }) - vim.keymap.set("n", "<leader>hR", gs.reset_buffer, { desc = "Reset current buffer", buffer = buf }) + ---- Reset and blame hunkcurrent_line_blame_formatter_opts + vim.keymap.set("n", "<leader>hs", gs.stage_hunk, { desc = "Stage hunk", buffer = buf }) + vim.keymap.set("n", "<leader>hS", gs.stage_buffer, { desc = "Stage current buffer", buffer = buf }) + vim.keymap.set("n", "<leader>hR", gs.reset_buffer, { desc = "Reset current buffer", buffer = buf }) - ---- Undo - vim.keymap.set("n", "<leader>hu", gs.undo_stage_hunk, { desc = "Undo stage hunk", buffer = buf }) - -- vim.keymap.set("n", "<leader>hU", gs.undo_stage_buffer, { desc = "Undo stage buffer", buffer = buf}) + ---- Undo + vim.keymap.set("n", "<leader>hu", gs.undo_stage_hunk, { desc = "Undo stage hunk", buffer = buf }) + -- vim.keymap.set("n", "<leader>hU", gs.undo_stage_buffer, { desc = "Undo stage buffer", buffer = buf}) - -- Blame - vim.keymap.set("n", "<leader>hb", function() - gs.blame_line({ full = true }) - end, { desc = "Toggle line blame", buffer = buf }) - vim.keymap.set( - "n", - "<leader>hB", - gs.toggle_current_line_blame, - { desc = "Toggle current line blame", buffer = buf } - ) + -- Blame + vim.keymap.set("n", "<leader>hb", function() + gs.blame_line({ full = true }) + end, { desc = "Toggle line blame", buffer = buf }) + vim.keymap.set( + "n", + "<leader>hB", + gs.toggle_current_line_blame, + { desc = "Toggle current line blame", buffer = buf } + ) - -- Diff - -- TODO: WTF ? - vim.keymap.set("n", "<leader>hd", gs.diffthis, { desc = "Diff this", buffer = buf }) - vim.keymap.set("n", "<leader>hD", function() - gs.diffthis("~") - end, { desc = "Diff this ~", buffer = buf }) + -- Diff + -- TODO: WTF ? + vim.keymap.set("n", "<leader>hd", gs.diffthis, { desc = "Diff this", buffer = buf }) + vim.keymap.set("n", "<leader>hD", function() + gs.diffthis("~") + end, { desc = "Diff this ~", buffer = buf }) - -- Text objects - vim.keymap.set( - { "o", "x" }, - "<leader>ih", - "<cmd><C-U>Gitsigns select_hunk<CR>", - { desc = "Gitsigns select hunk", buffer = buf } - ) - end, - }) - end, + -- Text objects + vim.keymap.set( + { "o", "x" }, + "<leader>ih", + "<cmd><C-U>Gitsigns select_hunk<CR>", + { desc = "Gitsigns select hunk", buffer = buf } + ) + end, + }) + end, } diff --git a/lua/ache/plugins/hexokinase.lua b/lua/ache/plugins/hexokinase.lua index 10162a0..ea348fd 100644 --- a/lua/ache/plugins/hexokinase.lua +++ b/lua/ache/plugins/hexokinase.lua @@ -1,24 +1,32 @@ -- NOTE: That plugin is old and archived +--but works very well. +-- +--[ +-- This plugin will add a small example of a color next to the associated usage of that color in the code. +-- +-- +-- WARNING: It use hexokinase that is a external tool. +--] return { - "RRethy/vim-hexokinase", - enabled = true, - build = "make hexokinase", - config = function() - vim.g.Hexokinase_highlighters = { "virtual" } - -- Alternatives options: - -- vim.g.Hexokinase_ftEnabled = ['css', 'html', 'javascript'] - -- vim.g.Hexokinase_ftOptInPatterns = { - -- 'css': 'full_hex,rgb,rgba,hsl,hsla,colour_names', - -- 'html': 'full_hex,rgb,rgba,hsl,hsla,colour_names' - -- } - -- vim.g.Hexokinase_highlighters = [ - -- 'virtual', - -- 'sign_column', - -- 'background', - -- 'backgroundfull', - -- 'foreground', - -- 'foregroundfull' - -- } - end, + "RRethy/vim-hexokinase", + enabled = true, + build = "make hexokinase", + config = function() + vim.g.Hexokinase_highlighters = { "virtual" } + -- Alternatives options: + -- vim.g.Hexokinase_ftEnabled = ['css', 'html', 'javascript'] + -- vim.g.Hexokinase_ftOptInPatterns = { + -- 'css': 'full_hex,rgb,rgba,hsl,hsla,colour_names', + -- 'html': 'full_hex,rgb,rgba,hsl,hsla,colour_names' + -- } + -- vim.g.Hexokinase_highlighters = [ + -- 'virtual', + -- 'sign_column', + -- 'background', + -- 'backgroundfull', + -- 'foreground', + -- 'foregroundfull' + -- } + end, } diff --git a/lua/ache/plugins/indent-blankline.lua b/lua/ache/plugins/indent-blankline.lua index 0d8920c..2b64202 100644 --- a/lua/ache/plugins/indent-blankline.lua +++ b/lua/ache/plugins/indent-blankline.lua @@ -1,50 +1,56 @@ -return { - "lukas-reineke/indent-blankline.nvim", - event = {"BufReadPre", "BufNewFile"}, - main = "ibl", - opts = {}, - config = function() - local highlightScope = { - "RainbowYellow", - } - local highlight = { - "RainbowBlue", - "RainbowCyan", - "RainbowGreen", - "RainbowViolet", - "RainbowRed", - "RainbowOrange", - } +--[ +-- This plugin highlight the scope with a link between the line that stars a scope and the one that ends it. +-- It's called "indentation guides". +-- +-- Also, it's rainbow color! 🌈 (☆^O^☆) +--] - local hooks = require "ibl.hooks" - -- create the highlight groups in the highlight setup hook, so they are reset - -- every time the colorscheme changes - hooks.register(hooks.type.HIGHLIGHT_SETUP, function() - vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) - vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) - vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) - vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) - vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) - vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) - vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) - end) +return { + "lukas-reineke/indent-blankline.nvim", + event = { "BufReadPre", "BufNewFile" }, + main = "ibl", + opts = {}, + config = function() + local highlightScope = { + "RainbowYellow", + } + local highlight = { + "RainbowBlue", + "RainbowCyan", + "RainbowGreen", + "RainbowViolet", + "RainbowRed", + "RainbowOrange", + } + local hooks = require("ibl.hooks") + -- create the highlight groups in the highlight setup hook, so they are reset + -- every time the colorscheme changes + hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) + vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) + vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) + vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) + vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) + vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) + vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) + end) - require("ibl").setup({ - indent = { - highlight = highlight, - char = "┊" - }, - scope = { - highlight = highlightScope, - char = "┆" - }, - whitespace = { - highlight = highlightScope, - remove_blankline_trail = true, - }, - }) - --[[ + require("ibl").setup({ + indent = { + highlight = highlight, + char = "┊", + }, + scope = { + highlight = highlightScope, + char = "┆", + }, + whitespace = { + highlight = highlightScope, + remove_blankline_trail = true, + }, + }) + --[[ Alternative chars: • left aligned solid • `▏` @@ -72,5 +78,5 @@ return { • `║` -- --]] - end + end, } diff --git a/lua/ache/plugins/leap.lua b/lua/ache/plugins/leap.lua index ffe3e89..1ae0d51 100644 --- a/lua/ache/plugins/leap.lua +++ b/lua/ache/plugins/leap.lua @@ -1,10 +1,16 @@ +--[ +-- 🦘 ! +-- +-- A plugin to jump over the screen with a few keys. +-- Help to navigate throug the code easily. +--] return { - "ggandor/leap.nvim", - dependencies = { "tpope/vim-repeat" }, - config = function () - vim.keymap.set({'n'}, 's', '<Plug>(leap-forward)') - vim.keymap.set({'n'}, 'S', '<Plug>(leap-backward)') - vim.keymap.set({'n', 'x', 'o'}, '<space>s', '<Plug>(leap)') - vim.keymap.set({'n', 'x', 'o'}, '<leader>l', '<Plug>(leap-from-window)') - end + "ggandor/leap.nvim", + dependencies = { "tpope/vim-repeat" }, + config = function() + vim.keymap.set({ "n" }, "s", "<Plug>(leap-forward)") + vim.keymap.set({ "n" }, "S", "<Plug>(leap-backward)") + vim.keymap.set({ "n", "x", "o" }, "<space>s", "<Plug>(leap)") + vim.keymap.set({ "n", "x", "o" }, "<leader>l", "<Plug>(leap-from-window)") + end, } diff --git a/lua/ache/plugins/linting.lua b/lua/ache/plugins/linting.lua index e6be595..2054851 100644 --- a/lua/ache/plugins/linting.lua +++ b/lua/ache/plugins/linting.lua @@ -1,8 +1,15 @@ -- TODO: Add explaination of how to configure and how does it works +--[ +-- An asynchronous linter plugin for Neovim (>= 0.6.0) complementary to the built-in Language Server Protocol support. +-- +-- nvim-lint has a more narrow scope than ale: +-- It spawns linters, parses their output, and reports the results via the vim.diagnostic module. +--] -- return { "mfussenegger/nvim-lint", event = { "BufReadPre", "BufNewFile" }, + enable = false, config = function() local lint = require("lint") diff --git a/lua/ache/plugins/llm/gen.lua b/lua/ache/plugins/llm/gen.lua index 482ffa7..ed7abc7 100644 --- a/lua/ache/plugins/llm/gen.lua +++ b/lua/ache/plugins/llm/gen.lua @@ -1,47 +1,50 @@ +--[ +-- Basic LLM completion. +--] return { - "David-Kunz/gen.nvim", - enabled = false, - cmd = { "Gen" }, - opts = { - host = "box.ache.one", -- The host running the Ollama service. - port = "1080", -- The port on which the Ollama service is listening. - quit_map = "q", -- set keymap for close the response window - retry_map = "wc-rw", -- set keymap to re-send the current prompt - init = function(_) - -- pcall(io.popen, "ollama serve > /dev/null 2>&1 &") - end, - -- Function to initialize Ollama - command = function(options) - local body = { model = options.model, stream = true } - return "curl -u 'cecca:rouge_et_hedy<3' --basic --silent --no-buffer -X POST https://" - .. options.host - .. ":" - .. options.port - .. "/ollama/api/chat -d $body" - end, - -- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped). - -- This can also be a command string. - -- The executed command must return a JSON object with { response, context } - -- (context property is optional). - -- list_models = '<omitted lua function>', -- Retrieves a list of model names - display_mode = "float", -- The display mode. Can be "float" or "split" or "horizontal-split". - show_prompt = false, -- Shows the prompt submitted to Ollama. - show_model = false, -- Displays which model you are using at the beginning of your chat session. - no_auto_close = false, -- Never closes the window automatically. - debug = false, -- Prints errors and the command which is run. - }, - config = function(_, opts) - local gen = require("gen") - gen.setup(opts) + "David-Kunz/gen.nvim", + enabled = false, + cmd = { "Gen" }, + opts = { + host = "box.ache.one", -- The host running the Ollama service. + port = "1080", -- The port on which the Ollama service is listening. + quit_map = "q", -- set keymap for close the response window + retry_map = "wc-rw", -- set keymap to re-send the current prompt + init = function(_) + -- pcall(io.popen, "ollama serve > /dev/null 2>&1 &") + end, + -- Function to initialize Ollama + command = function(options) + local body = { model = options.model, stream = true } + return "curl -u 'cecca:rouge_et_hedy<3' --basic --silent --no-buffer -X POST https://" + .. options.host + .. ":" + .. options.port + .. "/ollama/api/chat -d $body" + end, + -- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped). + -- This can also be a command string. + -- The executed command must return a JSON object with { response, context } + -- (context property is optional). + -- list_models = '<omitted lua function>', -- Retrieves a list of model names + display_mode = "float", -- The display mode. Can be "float" or "split" or "horizontal-split". + show_prompt = false, -- Shows the prompt submitted to Ollama. + show_model = false, -- Displays which model you are using at the beginning of your chat session. + no_auto_close = false, -- Never closes the window automatically. + debug = false, -- Prints errors and the command which is run. + }, + config = function(_, opts) + local gen = require("gen") + gen.setup(opts) - gen.prompts["Complete"] = { - prompt = "$text", - replace = true, - } - gen.prompts["Improove"] = { - prompt = "Améliore ce texte de manière à le rendre formel mais amical:\n\n$text\n", - -- replace = true, - model = "MathiasB/llama3fr:latest", - } - end, + gen.prompts["Complete"] = { + prompt = "$text", + replace = true, + } + gen.prompts["Improove"] = { + prompt = "Améliore ce texte de manière à le rendre formel mais amical:\n\n$text\n", + -- replace = true, + model = "MathiasB/llama3fr:latest", + } + end, } diff --git a/lua/ache/plugins/llm/gp.lua b/lua/ache/plugins/llm/gp.lua new file mode 100644 index 0000000..9e59199 --- /dev/null +++ b/lua/ache/plugins/llm/gp.lua @@ -0,0 +1,77 @@ +return { + "robitx/gp.nvim", + config = function() + local conf = { + -- For customization, refer to Install > Configuration in the Documentation/Readme + providers = { + ollama = { + endpoint = "http://localhost:11434/v1/chat/completions", + }, + }, + agents = { + { + provider = "ollama", + name = "Codestrall", + chat = true, + command = false, + -- string with model name or table with model name and parameters + model = { + model = "codestral", + temperature = 0.5, + top_p = 1, + min_p = 0.05, + }, + -- system prompt (use this to specify the persona/role of the AI) + system_prompt = require("gp.defaults").code_system_prompt, + }, + { + provider = "ollama", + name = "Chatstrall", + chat = true, + command = false, + -- string with model name or table with model name and parameters + model = { + model = "mistral", + temperature = 0.6, + top_p = 1, + min_p = 0.05, + }, + -- system prompt (use this to specify the persona/role of the AI) + system_prompt = "Tu es un IA assistante général.", + }, + { + name = "ChatOllamaLlama3.1-8B", + disable = true, + }, + { + name = "ChatGPT4o", + disable = true, + }, + { + name = "ChatGPT4o-mini", + disable = true, + }, + { + provider = "ollama", + name = "ChatDeepSeek-coder", + chat = true, + command = false, + -- string with model name or table with model name and parameters + model = { + model = "deepseek-coder-v2", + temperature = 0.7, + top_p = 1, + min_p = 0.05, + }, + -- system prompt (use this to specify the persona/role of the AI) + system_prompt = require("gp.defaults").code_system_prompt, + }, + }, + default_chat_agent = "Chatstrall", + default_command_agent = nil, + } + require("gp").setup(conf) + + -- Setup shortcuts here (see Usage > Shortcuts in the Documentation/Readme) + end, +} diff --git a/lua/ache/plugins/lsp/lspconfig.lua b/lua/ache/plugins/lsp/lspconfig.lua index 59e9ceb..332652f 100644 --- a/lua/ache/plugins/lsp/lspconfig.lua +++ b/lua/ache/plugins/lsp/lspconfig.lua @@ -1,3 +1,7 @@ +--[ +-- Ensure that the LSP feature is up and runing. +--] + return { "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile" }, @@ -121,7 +125,7 @@ return { -- Configuration specific to svelte LSP server lspconfig["svelte"].setup({ capabilities = capabilities, - on_attach = function(client, bufnr) + on_attach = function(client, _) vim.api.nvim_create_autocmd("BufWritePost", { pattern = { "*.js", "*.ts" }, callback = function(ctx) diff --git a/lua/ache/plugins/ltex-extra.lua b/lua/ache/plugins/lsp/ltex-extra.lua index fe209ad..9ae2d3a 100644 --- a/lua/ache/plugins/ltex-extra.lua +++ b/lua/ache/plugins/lsp/ltex-extra.lua @@ -1,3 +1,5 @@ +-- LanguageTool LSP. + local ltex_extra_opts = {} local ltex_ls_opts = { ltex = { diff --git a/lua/ache/plugins/lsp/mason-config.lua b/lua/ache/plugins/lsp/mason-config.lua index a2a26e8..0352aef 100644 --- a/lua/ache/plugins/lsp/mason-config.lua +++ b/lua/ache/plugins/lsp/mason-config.lua @@ -1,3 +1,8 @@ +--[ +-- This plugin is responsable of having external tools correcly present on the system. +-- Precisely, the configuration part. +--] + return { "williamboman/mason.nvim", dependencies = { @@ -24,7 +29,7 @@ return { mason_lspconfig.setup({ lazy = true, ensure_installed = { - "tsserver", + -- "tsserver", "html", "cssls", "ltex", diff --git a/lua/ache/plugins/lsp/mason-lspconf.lua b/lua/ache/plugins/lsp/mason-lspconf.lua index 267bbb2..06b5edf 100644 --- a/lua/ache/plugins/lsp/mason-lspconf.lua +++ b/lua/ache/plugins/lsp/mason-lspconf.lua @@ -1,8 +1,12 @@ +--[ +-- This plugin is responsable of having external tools correcly present on the system. +--] + return { - -- NOTE: mason is a dependencie of mason-lspconfig. Not the other way around. - "williamboman/mason-lspconfig.nvim", - dependencies = { - "williamboman/mason.nvim", - "neovim/nvim-lspconfig", - }, + -- NOTE: mason is a dependencie of mason-lspconfig. Not the other way around. + "williamboman/mason-lspconfig.nvim", + dependencies = { + "williamboman/mason.nvim", + "neovim/nvim-lspconfig", + }, } diff --git a/lua/ache/plugins/lsp/rust-tools.lua b/lua/ache/plugins/lsp/rust-tools.lua index ee94be5..fe5c97e 100644 --- a/lua/ache/plugins/lsp/rust-tools.lua +++ b/lua/ache/plugins/lsp/rust-tools.lua @@ -1,17 +1,20 @@ +--[ +-- I don't know, rust related. +--] return { - "simrat39/rust-tools.nvim", - config = function() - local rt = require("rust-tools") + "simrat39/rust-tools.nvim", + config = function() + local rt = require("rust-tools") - rt.setup({ - server = { - on_attach = function(_, bufnr) - -- Hover actions - vim.keymap.set("n", "<C-!>", rt.hover_actions.hover_actions, { buffer = bufnr }) - -- Code action groups - vim.keymap.set("n", "<leader>a", rt.code_action_group.code_action_group, { buffer = bufnr }) - end, - }, - }) - end, + rt.setup({ + server = { + on_attach = function(_, bufnr) + -- Hover actions + vim.keymap.set("n", "<C-!>", rt.hover_actions.hover_actions, { buffer = bufnr }) + -- Code action groups + vim.keymap.set("n", "<leader>a", rt.code_action_group.code_action_group, { buffer = bufnr }) + end, + }, + }) + end, } diff --git a/lua/ache/plugins/lualine.lua b/lua/ache/plugins/lualine.lua index 7da4424..ab05bdb 100644 --- a/lua/ache/plugins/lualine.lua +++ b/lua/ache/plugins/lualine.lua @@ -1,3 +1,7 @@ +--[ +-- A modern status bar for neovim. +--] + return { "nvim-lualine/lualine.nvim", event = "VimEnter", @@ -26,6 +30,7 @@ return { opts.sections.lualine_x = { { "location" }, { + -- AWESOME: The has_updates feature is a killer-feature. lazy_status.updates, cond = lazy_status.has_updates, color = { fg = "#dd9e64" }, diff --git a/lua/ache/plugins/model.lua b/lua/ache/plugins/model.lua index 43d89d5..5383ffc 100644 --- a/lua/ache/plugins/model.lua +++ b/lua/ache/plugins/model.lua @@ -1,44 +1,42 @@ +--[ +-- A basic Model completion with ollama. +--] return { - "gsuuon/model.nvim", - cmd = { "M", "Model", "Mchat" }, - init = function() - vim.filetype.add({ - extension = { - mchat = "mchat", - }, - }) - end, - ft = "mchat", + "gsuuon/model.nvim", + cmd = { "M", "Model", "Mchat" }, + init = function() + vim.filetype.add({ + extension = { + mchat = "mchat", + }, + }) + end, + ft = "mchat", - keys = { - { "<C-m>d", ":Mdelete<cr>", mode = "n" }, - { "<C-m>s", ":Mselect<cr>", mode = "n" }, - { "<C-m><space>", ":Mchat<cr>", mode = "n" }, - }, + keys = { + { "<C-m>d", ":Mdelete<cr>", mode = "n" }, + { "<C-m>s", ":Mselect<cr>", mode = "n" }, + { "<C-m><space>", ":Mchat<cr>", mode = "n" }, + }, - config = function() - local model = require("model") - local ollama = require("mchat.providers.ollama") + config = function() + local model = require("model") + local ollama = require("mchat.providers.ollama") - model.setup({ - prompts = { - ["ollama:starling"] = { - provider = ollama, - params = { - model = "starling-lm", - }, - builder = function(input) - return { - prompt = "GPT4 Correct User: " .. input .. "<|end_of_turn|>GPT4 Correct Assistant: ", - } - end, - }, - }, - }) - - -- require('model.providers.llamacpp').setup({ - -- binary = '~/path/to/server/binary', - -- models = '~/path/to/models/directory' - -- }) - end, + model.setup({ + prompts = { + ["ollama:starling"] = { + provider = ollama, + params = { + model = "starling-lm", + }, + builder = function(input) + return { + prompt = "GPT4 Correct User: " .. input .. "<|end_of_turn|>GPT4 Correct Assistant: ", + } + end, + }, + }, + }) + end, } diff --git a/lua/ache/plugins/nvim-cmp.lua b/lua/ache/plugins/nvim-cmp.lua index abe6a78..da962a8 100644 --- a/lua/ache/plugins/nvim-cmp.lua +++ b/lua/ache/plugins/nvim-cmp.lua @@ -1,115 +1,120 @@ +--[ +-- Completion with snippets and LSP and all... +-- +-- Very good. +--] return { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - { - -- TODO: Put that one in its own config file ! - "L3MON4D3/LuaSnip", - build = "make install_jsregexp", - version = "v2.*", - dependencies = { - "rafamadriz/friendly-snippets", - }, - opts = { history = true, updateevents = "TextChanged,TextChangedI" }, - config = function() - local ls = require("luasnip") + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + { + -- TODO: Put that one in its own config file ! + "L3MON4D3/LuaSnip", + build = "make install_jsregexp", + version = "v2.*", + dependencies = { + "rafamadriz/friendly-snippets", + }, + opts = { history = true, updateevents = "TextChanged,TextChangedI" }, + config = function() + local ls = require("luasnip") - require("luasnip.loaders.from_vscode").lazy_load() - require("luasnip.loaders.from_snipmate").lazy_load() - require("luasnip.loaders.from_lua").lazy_load() + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_snipmate").lazy_load() + require("luasnip.loaders.from_lua").lazy_load() - print(vim.g.snipmate_snippets_path or "Hello") - print(vim.g.vscode_snippets_path or "Hello2") + print(vim.g.snipmate_snippets_path or "Hello") + print(vim.g.vscode_snippets_path or "Hello2") - vim.api.nvim_create_autocmd("InsertLeave", { - callback = function() - if - require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] - and not require("luasnip").session.jump_active - then - require("luasnip").unlink_current() - end - end, - }) + vim.api.nvim_create_autocmd("InsertLeave", { + callback = function() + if + require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] + and not require("luasnip").session.jump_active + then + require("luasnip").unlink_current() + end + end, + }) - -- Set keymaps - vim.keymap.set({ "i" }, "<C-K>", function() - ls.expand() - end, { silent = true }) - vim.keymap.set({ "i", "s" }, "<C-L>", function() - ls.jump(1) - end, { silent = true }) - vim.keymap.set({ "i", "s" }, "<C-J>", function() - ls.jump(-1) - end, { silent = true }) + -- Set keymaps + vim.keymap.set({ "i" }, "<C-K>", function() + ls.expand() + end, { silent = true }) + vim.keymap.set({ "i", "s" }, "<C-L>", function() + ls.jump(1) + end, { silent = true }) + vim.keymap.set({ "i", "s" }, "<C-J>", function() + ls.jump(-1) + end, { silent = true }) - vim.keymap.set({ "i", "s" }, "<C-E>", function() - if ls.choice_active() then - ls.change_choice(1) - end - end, { silent = true }) - end, - }, - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "onsails/lspkind.nvim", - }, - config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - local lspkind = require("lspkind") + vim.keymap.set({ "i", "s" }, "<C-E>", function() + if ls.choice_active() then + ls.change_choice(1) + end + end, { silent = true }) + end, + }, + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "onsails/lspkind.nvim", + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + local lspkind = require("lspkind") - --NOTE: - -- Ctrl + Space (insert mode)=> to trigger completion. + --NOTE: + -- Ctrl + Space (insert mode)=> to trigger completion. - cmp.setup({ - completion = { - -- DOC: This is just help. - -- - menuone: popup even when there's only one match - -- - noinsert: Do not insert text until a selection is made - -- - noselect: Do not select, force to select one from the menu - -- - shortness: avoid showing extra messages when using completion - -- - updatetime: set updatetime for CursorHold - -- Check :help completeopt - completeopt = "menu,menuone,preview,noselect", - }, - -- Select a snippet engine. - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - ["<c-k>"] = cmp.mapping.select_prev_item(), - ["<c-j>"] = cmp.mapping.select_next_item(), - ["<c-b>"] = cmp.mapping.scroll_docs(-4), - ["<c-f>"] = cmp.mapping.scroll_docs(4), - ["<c-space>"] = cmp.mapping.complete(), - ["<c-e>"] = cmp.mapping.abort(), - ["<CR>"] = cmp.mapping.confirm({ select = true }), - }), + cmp.setup({ + completion = { + -- DOC: This is just help. + -- - menuone: popup even when there's only one match + -- - noinsert: Do not insert text until a selection is made + -- - noselect: Do not select, force to select one from the menu + -- - shortness: avoid showing extra messages when using completion + -- - updatetime: set updatetime for CursorHold + -- Check :help completeopt + completeopt = "menu,menuone,preview,noselect", + }, + -- Select a snippet engine. + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + ["<c-k>"] = cmp.mapping.select_prev_item(), + ["<c-j>"] = cmp.mapping.select_next_item(), + ["<c-b>"] = cmp.mapping.scroll_docs(-4), + ["<c-f>"] = cmp.mapping.scroll_docs(4), + ["<c-space>"] = cmp.mapping.complete(), + ["<c-e>"] = cmp.mapping.abort(), + ["<CR>"] = cmp.mapping.confirm({ select = true }), + }), - -- Order is important ! - sources = { - { name = "nvim_lsp_signature_help", keyword_length = 2 }, - { name = "nvim_lsp", keyword_length = 2 }, -- lsp completion - { name = "nvim-lua", keyword_length = 2 }, - { name = "luasnip", keyword_length = 3 }, -- snippets - { name = "buffer", keyword_length = 3 }, -- text within current buffer - { name = "path" }, -- system path - { name = "calc" }, -- source for math calculation ! - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - formatting = { - expandable_indicator = true, - fields = { cmp.ItemField.Kind, cmp.ItemField.Abbr, cmp.ItemField.Menu }, - --[[ + -- Order is important ! + sources = { + { name = "nvim_lsp_signature_help", keyword_length = 2 }, + { name = "nvim_lsp", keyword_length = 2 }, -- lsp completion + { name = "nvim-lua", keyword_length = 2 }, + { name = "luasnip", keyword_length = 3 }, -- snippets + { name = "buffer", keyword_length = 3 }, -- text within current buffer + { name = "path" }, -- system path + { name = "calc" }, -- source for math calculation ! + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + formatting = { + expandable_indicator = true, + fields = { cmp.ItemField.Kind, cmp.ItemField.Abbr, cmp.ItemField.Menu }, + --[[ -- TODO: Use that icons ! 🥳 format = function(entry, item) local menu_icon = { @@ -122,32 +127,32 @@ return { return item end, --]] - format = lspkind.cmp_format({ - maxwidth = 50, - ellipsis_char = "...", - }), - }, - }) + format = lspkind.cmp_format({ + maxwidth = 50, + ellipsis_char = "...", + }), + }, + }) - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline(":", { - -- mapping = cmp.mapping.preset.cmdline(), - mapping = cmp.mapping.preset.cmdline({ - ["<CR>"] = { - c = function(default) - if cmp.visible() then - return cmp.confirm({ select = true }) - end + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(":", { + -- mapping = cmp.mapping.preset.cmdline(), + mapping = cmp.mapping.preset.cmdline({ + ["<CR>"] = { + c = function(default) + if cmp.visible() then + return cmp.confirm({ select = true }) + end - default() - end, - }, - }), - sources = cmp.config.sources({ - { name = "path" }, - }, { - { name = "cmdline" }, - }), - }) - end, + default() + end, + }, + }), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + }) + end, } diff --git a/lua/ache/plugins/nvim-tree.lua b/lua/ache/plugins/nvim-tree.lua index e4b1f7f..9a07780 100644 --- a/lua/ache/plugins/nvim-tree.lua +++ b/lua/ache/plugins/nvim-tree.lua @@ -1,52 +1,60 @@ -return { - "nvim-tree/nvim-tree.lua", - dependencies = "nvim-tree/nvim-web-devicons", - config = function() -- this function is call as a post install callback - local nvimtree = require("nvim-tree") +---[ +--- A plugin to have the working directory files with a tree in a panel. +---] - -- recommanded settings from nvim-tree documentation - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 +return { + "nvim-tree/nvim-tree.lua", + dependencies = "nvim-tree/nvim-web-devicons", + config = function() -- this function is call as a post install callback + local nvimtree = require("nvim-tree") - nvimtree.setup({ - sort = { - sorter = "case_sensitive", - }, - -- TODO: Try to not set width - view = { - width = 30, - }, - renderer = { - indent_markers = { - enable = true, - }, - icons = { - glyphs = { - folder = { - arrow_closed = ">", - arrow_open = "v", - }, - }, - }, - group_empty = true, - }, - actions = {}, - filters = { - custom = { - ".DS-Store", -- fuck mac - }, - dotfiles = true, - }, - git = { - ignore = true, - } - }) + -- recommanded settings from nvim-tree documentation + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + nvimtree.setup({ + sort = { + sorter = "case_sensitive", + }, + -- TODO: Try to not set width + view = { + width = 30, + }, + renderer = { + indent_markers = { + enable = true, + }, + icons = { + glyphs = { + folder = { + arrow_closed = ">", + arrow_open = "v", + }, + }, + }, + group_empty = true, + }, + actions = {}, + filters = { + custom = { + ".DS-Store", -- fuck mac + }, + dotfiles = true, + }, + git = { + ignore = true, + }, + }) - -- Setup keymap - vim.keymap.set("n", "<c-c>c", "<cmd>NvimTreeToggle<CR>", {desc = "Toggle file explorer"}) - vim.keymap.set("n", "<c-c>x", "<cmd>NvimTreeFindFileToggle<CR>", {desc = "Toggle file explorer on current file"}) - vim.keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", {desc = "Collapse file explorer"}) - vim.keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", {desc = "Refresh file explorer"}) - end + -- Setup keymap + vim.keymap.set("n", "<c-c>c", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" }) + vim.keymap.set( + "n", + "<c-c>x", + "<cmd>NvimTreeFindFileToggle<CR>", + { desc = "Toggle file explorer on current file" } + ) + vim.keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", { desc = "Collapse file explorer" }) + vim.keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" }) + end, } diff --git a/lua/ache/plugins/nvim-ts-autotag.lua b/lua/ache/plugins/nvim-ts-autotag.lua new file mode 100644 index 0000000..b30cec5 --- /dev/null +++ b/lua/ache/plugins/nvim-ts-autotag.lua @@ -0,0 +1,37 @@ +--[ +-- This plugin use treesitter to auto-close HTML tags. +-- +-- It's configured in treesitter.lua as a dependency. +--] +return { + "windwp/nvim-ts-autotag", + enable = true, + config = function() + require("nvim-ts-autotag").setup({ + opts = { + -- Defaults + enable_close = true, -- Auto close tags + enable_rename = true, -- Auto rename pairs of tags + enable_close_on_slash = false, -- Auto close on trailing </ + }, + + -- Also override individual filetype configs, these take priority. + -- Empty by default, useful if one of the "opts" global settings + -- doesn't work well in a specific filetype + per_filetype = { + ["html"] = { + enable_close = true, + enable_close_on_slash = true, + }, + ["svelte"] = { + enable_close = true, + enable_close_on_slash = true, + }, + ["xml"] = { + enable_close = true, + enable_close_on_slash = true, + }, + }, + }) + end, +} diff --git a/lua/ache/plugins/rainbow-delimiters.lua b/lua/ache/plugins/rainbow-delimiters.lua index 021dde0..80e8845 100644 --- a/lua/ache/plugins/rainbow-delimiters.lua +++ b/lua/ache/plugins/rainbow-delimiters.lua @@ -1,3 +1,9 @@ +--[ +-- This Neovim plugin provides alternating syntax highlighting (“rainbow parentheses”) for Neovim, powered by Tree-sitter +-- +-- Simple and efficient. Differents color for differents brackets so it's easier to found the matching bracket. +--] + return { - "HiPhish/rainbow-delimiters.nvim", + "HiPhish/rainbow-delimiters.nvim", } diff --git a/lua/ache/plugins/scope.lua b/lua/ache/plugins/scope.lua index 88b0458..4fa3043 100644 --- a/lua/ache/plugins/scope.lua +++ b/lua/ache/plugins/scope.lua @@ -1,7 +1,11 @@ +---[ +--- Should do something about tabs but I'm not sure. +---] return { - "tiagovla/scope.nvim", - -- FIXME: Use an other plugin. Doesn't do what I want. - config = function() - require("scope").setup({}) - end + "tiagovla/scope.nvim", + -- FIXME: Use an other plugin. Doesn't do what I want. + config = function() + require("scope").setup({}) + end, + enable = false, } diff --git a/lua/ache/plugins/surround.lua b/lua/ache/plugins/surround.lua index 2f51c21..6cfde98 100644 --- a/lua/ache/plugins/surround.lua +++ b/lua/ache/plugins/surround.lua @@ -1,27 +1,33 @@ +--[ +-- A plugin to add and manipulate "surrounding" characters. +-- +-- I barely use it. :/ +-- +-- NOTE: +-- ys => To add surround. ys => then selection => then the char to surround. +-- dsX => To delete surround. +-- csYX => To change surround. Y => old one, X = new one +--] return { - "kylechui/nvim-surround", - -- event = { "BufReadPre", "BufNewFile" }, - event = "VeryLazy", - version = "*", - config = function() - require("nvim-surround").setup({ - keymaps = { - insert = "<C-g>s", - insert_line = "<C-g>S", - normal = "ys", - normal_cur = "yss", - normal_line = "yS", - normal_cur_line = "ySS", - visual = "s", - visual_line = "gS", - delete = "ds", - change = "cs", - change_line = "cS", - }, - }) - end, - -- NOTE: - -- ys => To add surround. ys => then selection => then the char to surround. - -- dsX => To delete surround. - -- csYX => To change surround. Y => old one, X = new one + "kylechui/nvim-surround", + -- event = { "BufReadPre", "BufNewFile" }, + event = "VeryLazy", + version = "*", + config = function() + require("nvim-surround").setup({ + keymaps = { + insert = "<C-g>s", + insert_line = "<C-g>S", + normal = "ys", + normal_cur = "yss", + normal_line = "yS", + normal_cur_line = "ySS", + visual = "s", + visual_line = "gS", + delete = "ds", + change = "cs", + change_line = "cS", + }, + }) + end, } diff --git a/lua/ache/plugins/telescope.lua b/lua/ache/plugins/telescope.lua index 55b6c4a..d424f23 100644 --- a/lua/ache/plugins/telescope.lua +++ b/lua/ache/plugins/telescope.lua @@ -1,3 +1,8 @@ +--[ +-- A plugin to make "search box" and panel. +-- Good UI. 👍 +--] + return { "nvim-telescope/telescope.nvim", branch = "0.1.x", @@ -47,6 +52,11 @@ return { "dawnfox", "terafox", "carbonfox", + "cyberdream", + "jellybeans-nvim", + "ayu-night", + "ayu-light", + "pastelnight", "night-owl", "catppuccin-latte", "catppuccin-mocha", diff --git a/lua/ache/plugins/todo-comments.lua b/lua/ache/plugins/todo-comments.lua index 6696bbf..f2b93f1 100644 --- a/lua/ache/plugins/todo-comments.lua +++ b/lua/ache/plugins/todo-comments.lua @@ -1,20 +1,40 @@ +--[ +-- This plugin highlights some block code like TODO and WARNING, ... +-- It also helps navigate between them. +-- +-- Here are the keywords: +-- +-- FIX (ISSUE, FIXIT, BUG, FIXME) +-- TODO +-- HACK +-- WARN (WARNING, XXX) +-- PERF (OPTIM, PERFORMANCE, OPTIMIZE) +-- NOTE (INFO) +-- TEST (TESTING, PASSED, FAILED) +-- +-- +-- NOTE: I should add a new category like AWESOME to explains AWESOME part of the code. +-- Like that: +-- AWESOME: This code does that and it's AWESOME +--] + return { - "folke/todo-comments.nvim", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "nvim-lua/plenary.nvim" - }, - config = function() - local todo_comments = require("todo-comments") + "folke/todo-comments.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = function() + local todo_comments = require("todo-comments") - vim.keymap.set("n", "td>", function() - todo_comments.jump_next() - end, { desc = "Next todo comment"}) + vim.keymap.set("n", "td>", function() + todo_comments.jump_next() + end, { desc = "Next todo comment" }) - vim.keymap.set("n", "td<", function() - todo_comments.jump_prev() - end, { desc = "Previous todo comment"}) + vim.keymap.set("n", "td<", function() + todo_comments.jump_prev() + end, { desc = "Previous todo comment" }) - todo_comments.setup() - end, + todo_comments.setup() + end, } diff --git a/lua/ache/plugins/treesitter.lua b/lua/ache/plugins/treesitter.lua index 2c19cad..1ac6771 100644 --- a/lua/ache/plugins/treesitter.lua +++ b/lua/ache/plugins/treesitter.lua @@ -1,76 +1,115 @@ +--[ +-- It's treesitter, I should check how it works ! +-- +-- The goal of nvim-treesitter is both to provide a simple and easy way to use the interface for tree-sitter in Neovim and to provide some basic functionality such as highlighting based on it: +-- +-- +-- Treesitter uses a different parser for every language, which needs to be generated via tree-sitter-cli from a grammar.js file, then compiled to a .so library that needs to be placed in neovim's runtimepath (typically under parser/{language}.so). To simplify this, nvim-treesitter provides commands to automate this process. If the language is already supported by nvim-treesitter, you can install it with :TSinstall <language_to_install> +--] + return { - "nvim-treesitter/nvim-treesitter", - event = { "BufReadPre", "BufNewFile" }, - build = ":TSUpdate", - dependencies = { - "windwp/nvim-ts-autotag", - }, - config = function() - local treesitter = require("nvim-treesitter.configs") + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + build = ":TSUpdate", + -- dependencies = { + -- "windwp/nvim-ts-autotag", + -- }, + config = function() + local treesitter = require("nvim-treesitter.configs") - treesitter.setup({ - modules = {}, - ignore_install = { "" }, - sync_install = false, - highlight = { - enable = true, - }, - indent = { - enable = true, - }, - autotag = { -- With nvim-ts-autotag plugin - enable = true, - }, - --[[ + treesitter.setup({ + modules = {}, + ignore_install = { "" }, + sync_install = false, + highlight = { + enable = true, + }, + indent = { + enable = true, + }, + -- TODO: Install nvim-ts-autotag + -- autotag = { -- With nvim-ts-autotag plugin + -- enable = true, + -- }, + --[[ rainbow = { enable = true, extended_mode = true, max_file_lines = nil, }, --]] - ensure_installed = { - "rust", - "go", - "python", - "ocaml", - "json", - "javascript", - "typescript", - "tsx", - "yaml", - "css", - "lua", - -- "mchat", - -- { "mchat", "gsuuon/tree-sitter-mchat" }, - "toml", - }, - auto_install = true, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "<c-space>", - node_incremental = "<c-space>", - scope_incremental = false, - node_decremental = "<bs>", - }, - }, - }) + ensure_installed = { + "rust", + "go", + "html", + "python", + "ocaml", + "json", + "javascript", + "svelte", + "typescript", + "tsx", + "yaml", + "css", + "lua", + -- "mchat", + -- { "mchat", "gsuuon/tree-sitter-mchat" }, + "toml", + }, + auto_install = true, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "<c-space>", + node_incremental = "<c-space>", + scope_incremental = false, + node_decremental = "<bs>", + }, + }, + }) + + -- require("nvim-ts-autotag").setup({ + -- opts = { + -- -- Defaults + -- enable_close = true, -- Auto close tags + -- enable_rename = true, -- Auto rename pairs of tags + -- enable_close_on_slash = false, -- Auto close on trailing </ + -- }, + -- + -- -- Also override individual filetype configs, these take priority. + -- -- Empty by default, useful if one of the "opts" global settings + -- -- doesn't work well in a specific filetype + -- per_filetype = { + -- ["html"] = { + -- enable_close = true, + -- enable_close_on_slash = true, + -- }, + -- ["svelte"] = { + -- enable_close = true, + -- enable_close_on_slash = true, + -- }, + -- ["xml"] = { + -- enable_close = true, + -- enable_close_on_slash = true, + -- }, + -- }, + -- }) - -- local parser_config = require("nvim-treesitter.parsers").get_parser_configs() - -- parser_config.mchat = { - -- install_info = { - -- url = "~/.config/nvim/tree-sitter-mchat", -- local path or git repo - -- files = { "src/parser.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc - -- -- optional entries: - -- branch = "main", -- default branch in case of git repo if different from master - -- generate_requires_npm = false, -- if stand-alone parser without npm dependencies - -- requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c - -- }, - -- -- filetype = "zu", -- if filetype does not match the parser name - -- } + -- local parser_config = require("nvim-treesitter.parsers").get_parser_configs() + -- parser_config.mchat = { + -- install_info = { + -- url = "~/.config/nvim/tree-sitter-mchat", -- local path or git repo + -- files = { "src/parser.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc + -- -- optional entries: + -- branch = "main", -- default branch in case of git repo if different from master + -- generate_requires_npm = false, -- if stand-alone parser without npm dependencies + -- requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c + -- }, + -- -- filetype = "zu", -- if filetype does not match the parser name + -- } - vim.wo.foldmethod = "expr" - vim.wo.foldexpr = "nvim_treesitter#foldexpr()" - vim.wo.foldlevel = 9 - end, + vim.wo.foldmethod = "expr" + vim.wo.foldexpr = "nvim_treesitter#foldexpr()" + vim.wo.foldlevel = 9 + end, } diff --git a/lua/ache/plugins/troubles.lua b/lua/ache/plugins/troubles.lua index 60ee515..da3e008 100644 --- a/lua/ache/plugins/troubles.lua +++ b/lua/ache/plugins/troubles.lua @@ -1,16 +1,22 @@ +--[ +-- A pretty list for showing diagnostics, references, telescope results, quickfix and location lists to help you solve all the trouble your code is causing. +-- +-- Check diagnostics and LSP error quickly with a dedicated panel. +--] + return { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim" }, - -- TODO: Configure that shit. - opts = {}, - cmd = "Trouble", - keys = { - { "<leader>xx", "<cmd>Trouble<CR>", desc = "Toggle trouble list" }, - { "<leader>xw", "<cmd>Trouble workspace_diagnostics<CR>", desc = "Toggle trouble workspace list" }, - { "<leader>xd", "<cmd>Trouble document_diagnostics<CR>", desc = "Toggle trouble document list" }, - { "<leader>xq", "<cmd>Trouble quickfix<CR>", desc = "Toggle trouble quickfix list" }, - { "<leader>xl", "<cmd>Trouble locdiagnostics<CR>", desc = "Toggle trouble location list" }, - { "<leader>xt", "<cmd>TodoTrouble<CR>", desc = "Open todo in trouble" }, - { "<leader>cs", "<cmd>Trouble symbols toggle focus=false<CR>", desc = "Symbols (Trouble)" }, - }, + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim" }, + -- TODO: Configure that shit. + opts = {}, + cmd = "Trouble", + keys = { + { "<leader>xx", "<cmd>Trouble<CR>", desc = "Toggle trouble list" }, + { "<leader>xw", "<cmd>Trouble workspace_diagnostics<CR>", desc = "Toggle trouble workspace list" }, + { "<leader>xd", "<cmd>Trouble document_diagnostics<CR>", desc = "Toggle trouble document list" }, + { "<leader>xq", "<cmd>Trouble quickfix<CR>", desc = "Toggle trouble quickfix list" }, + { "<leader>xl", "<cmd>Trouble locdiagnostics<CR>", desc = "Toggle trouble location list" }, + { "<leader>xt", "<cmd>TodoTrouble<CR>", desc = "Open todo in trouble" }, + { "<leader>cs", "<cmd>Trouble symbols toggle focus=false<CR>", desc = "Symbols (Trouble)" }, + }, } diff --git a/lua/ache/plugins/twilight.lua b/lua/ache/plugins/twilight.lua index 6a33f94..62c1dc6 100644 --- a/lua/ache/plugins/twilight.lua +++ b/lua/ache/plugins/twilight.lua @@ -1,5 +1,8 @@ +--[ +-- This plugin removes the color (dims) inactive portions of the code you're editing. +--] + return { - "folke/twilight.nvim", - opts = { - }, + "folke/twilight.nvim", + opts = {}, } diff --git a/lua/ache/plugins/vim-grammarous.lua b/lua/ache/plugins/vim-grammarous.lua index bd28815..aae32be 100644 --- a/lua/ache/plugins/vim-grammarous.lua +++ b/lua/ache/plugins/vim-grammarous.lua @@ -1,3 +1,9 @@ +--[ +-- This plugin add support for languageTool. +-- +-- It's not helpful and should be removed as LSP languageTool is better. +--] + return { "dpelle/vim-LanguageTool", enabled = false, diff --git a/lua/ache/plugins/vimtext.lua b/lua/ache/plugins/vimtext.lua index d62d540..08460a4 100644 --- a/lua/ache/plugins/vimtext.lua +++ b/lua/ache/plugins/vimtext.lua @@ -1,17 +1,22 @@ +--[ +-- LaTeX support for vim. +-- Not realy usefull, should check if needed. +--] + return { - "lervag/vimtex", - lazy = false, -- we don't want to lazy load VimTeX - -- tag = "v2.15", -- uncomment to pin to a specific release - init = function() - -- VimTeX configuration goes here, e.g. - -- vim.g.vimtex_view_method = "zathura" + "lervag/vimtex", + lazy = false, -- we don't want to lazy load VimTeX + -- tag = "v2.15", -- uncomment to pin to a specific release + init = function() + -- VimTeX configuration goes here, e.g. + -- vim.g.vimtex_view_method = "zathura" - vim.g.vimtex_compiler_latexmk_engines = { ["_"] = "-lualatex -shell-escape" } - vim.g.vimtex_indent_on_ampersands = 0 - vim.g.vimtex_view_method = "sioyek" - vim.g.matchup_override_vimtex = 1 + vim.g.vimtex_compiler_latexmk_engines = { ["_"] = "-lualatex -shell-escape" } + vim.g.vimtex_indent_on_ampersands = 0 + vim.g.vimtex_view_method = "sioyek" + vim.g.matchup_override_vimtex = 1 - -- Other settings - vim.g.latexindent_opt = "-m" -- for neoformat, I use latexindent - end, + -- Other settings + vim.g.latexindent_opt = "-m" -- for neoformat, I use latexindent + end, } diff --git a/lua/ache/plugins/which-key.lua b/lua/ache/plugins/which-key.lua index 9675559..33b1f3e 100644 --- a/lua/ache/plugins/which-key.lua +++ b/lua/ache/plugins/which-key.lua @@ -1,9 +1,14 @@ +--[ +-- Show a helpful remainder when you start typing a shortkey. +-- +-- After some time of hesitation, "which-key" will show all the available mapping and describe them. +--] return { - "folke/which-key.nvim", - event = "VeryLazy", - init = function() - vim.opt.timeout = true - vim.opt.timeoutlen = 500 - end, - opts = {}, -- Use default configuration. + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.opt.timeout = true + vim.opt.timeoutlen = 500 + end, + opts = {}, -- Use default configuration. } |