summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2024-07-21 05:30:30 +0200
committerache <ache@ache.one>2024-07-21 05:30:30 +0200
commitd69c281f43ba4168df32ef4ae6b77f88bfc60d86 (patch)
tree844fe20b45d099cbd35c1ccb3ae89dafb3da51a7
Init commit
-rw-r--r--init.lua2
-rw-r--r--lua/ache/config/init.lua5
-rw-r--r--lua/ache/config/keymaps.lua36
-rw-r--r--lua/ache/config/options.lua41
-rw-r--r--lua/ache/lazy.lua28
-rw-r--r--lua/ache/plugins/auto-session.lua14
-rw-r--r--lua/ache/plugins/autopairs.lua25
-rw-r--r--lua/ache/plugins/bufferline.lua11
-rw-r--r--lua/ache/plugins/comment.lua18
-rw-r--r--lua/ache/plugins/dressing.lua4
-rw-r--r--lua/ache/plugins/fidget.lua6
-rw-r--r--lua/ache/plugins/firevim.lua25
-rw-r--r--lua/ache/plugins/formatting.lua35
-rw-r--r--lua/ache/plugins/gitsigns.lua102
-rw-r--r--lua/ache/plugins/hexokinase.lua24
-rw-r--r--lua/ache/plugins/indent-blankline.lua76
-rw-r--r--lua/ache/plugins/leap.lua10
-rw-r--r--lua/ache/plugins/linting.lua28
-rw-r--r--lua/ache/plugins/llm/gen.lua47
-rw-r--r--lua/ache/plugins/llm/llm.lua_23
-rw-r--r--lua/ache/plugins/llm/model.lua81
-rw-r--r--lua/ache/plugins/llm/ollama.lua_44
-rw-r--r--lua/ache/plugins/llm/ollamachad.lua_35
-rw-r--r--lua/ache/plugins/llm/tabby.lua_23
-rw-r--r--lua/ache/plugins/lsp/lspconfig.lua158
-rw-r--r--lua/ache/plugins/lsp/mason-config.lua53
-rw-r--r--lua/ache/plugins/lsp/mason-lspconf.lua8
-rw-r--r--lua/ache/plugins/lsp/rust-tools.lua17
-rw-r--r--lua/ache/plugins/lualine.lua61
-rw-r--r--lua/ache/plugins/model.lua44
-rw-r--r--lua/ache/plugins/night-owl.lua10
-rw-r--r--lua/ache/plugins/nvim-cmp.lua153
-rw-r--r--lua/ache/plugins/nvim-tree.lua52
-rw-r--r--lua/ache/plugins/rainbow-delimiters.lua3
-rw-r--r--lua/ache/plugins/scope.lua7
-rw-r--r--lua/ache/plugins/surround.lua27
-rw-r--r--lua/ache/plugins/telescope.lua52
-rw-r--r--lua/ache/plugins/todo-comments.lua20
-rw-r--r--lua/ache/plugins/treesitter.lua76
-rw-r--r--lua/ache/plugins/troubles.lua16
-rw-r--r--lua/ache/plugins/twilight.lua5
-rw-r--r--lua/ache/plugins/vimtext.lua17
-rw-r--r--lua/ache/plugins/which-key.lua9
-rw-r--r--plugin/trailing-white-space.vim41
44 files changed, 1572 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..6584fdd
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,2 @@
+require("ache.config")
+require("ache.lazy")
diff --git a/lua/ache/config/init.lua b/lua/ache/config/init.lua
new file mode 100644
index 0000000..23d39b3
--- /dev/null
+++ b/lua/ache/config/init.lua
@@ -0,0 +1,5 @@
+require("ache.config.options")
+require("ache.config.keymaps")
+
+
+-- TODO: Try signcolumn=number
diff --git a/lua/ache/config/keymaps.lua b/lua/ache/config/keymaps.lua
new file mode 100644
index 0000000..1fd1125
--- /dev/null
+++ b/lua/ache/config/keymaps.lua
@@ -0,0 +1,36 @@
+vim.g.mapleader = "!"
+
+-- vim.keymap.set(mode, lhs, rhs, opts?)
+-- mode is:
+-- n => normal mode
+vim.keymap.set("n", "//", ":nohls<CR>", { desc = "clear search highlights" })
+vim.keymap.set("n", "cd", ":cd ", { desc = "change directory" })
+
+-- command alias => ca
+vim.keymap.set("ca", "tn", "tabnew")
+
+-- Make some unvisible chars visible.
+vim.opt.list = true
+vim.opt.listchars = {
+ tab = "› ",
+ -- lead = '·', -- lead is just an invisible normal space
+ trail = "ꞏ",
+ extends = "♯",
+ eol = "¬",
+ nbsp = "⍽",
+}
+
+vim.keymap.set("n", "<space><return>", ":w<return>", { desc = "quick save file" })
+
+-- Number increment
+-- It's c-a for Add ! and c-x to decress ! But since you just can't remenber ...
+vim.keymap.set("n", "<leader>+", "<c-a>", { desc = "Increment number" })
+vim.keymap.set("n", "<leader>-", "<c-x>", { desc = "Decrement number" })
+
+-- Window management
+-- Just use <c-w> !
+
+-- Tab navigation
+vim.keymap.set("n", "t<tab>", "<cmd>tabnext<CR>", { desc = "Go to next tab" })
+vim.keymap.set("n", "t<s-tab>", "<cmd>tabp<CR>", { desc = "Go to previous tab" })
+vim.keymap.set("n", "<leader>gt", "<cmd>tabnew %<CR>", { desc = "Open current buffer into a new tab" })
diff --git a/lua/ache/config/options.lua b/lua/ache/config/options.lua
new file mode 100644
index 0000000..c2a8d86
--- /dev/null
+++ b/lua/ache/config/options.lua
@@ -0,0 +1,41 @@
+vim.cmd("let g:netrw_liststyle = 3")
+
+local opt = {
+ -- Numbering
+ relativenumber = true,
+ number = true,
+
+ -- tabs & indentation
+ tabstop = 2, -- a tab is 2 spaces width
+ shiftwidth = 2, -- 2 spaces to indent
+ expandtab = true, -- transform tab to space. Use <C-v><Tab> to insert tab.
+ autoindent = true, -- copy indent from current line when starting new one
+
+ -- Long line management.
+ wrap = true,
+
+ -- search
+ ignorecase = true, -- ignore case when typing but ⤵
+ smartcase = true, -- mixed case in search imply case-sensitive search
+
+ cursorline = true,
+
+ -- turn on termguicolor for colorscheme to work
+ termguicolors = true,
+ -- background = "dark",
+ signcolumn = "yes:1", -- TODO: Try number !
+
+ -- split behavior
+ splitright = true,
+ splitbelow = true,
+
+ -- Use the system clipboard using external program like xsel
+ clipboard = "unnamedplus",
+
+ -- I fucking don't know
+ backspace = "indent,eol,start",
+}
+
+for k, v in pairs(opt) do
+ vim.opt[k] = v
+end
diff --git a/lua/ache/lazy.lua b/lua/ache/lazy.lua
new file mode 100644
index 0000000..756330c
--- /dev/null
+++ b/lua/ache/lazy.lua
@@ -0,0 +1,28 @@
+--- Basic lua installation lines.
+
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+if not (vim.uv or vim.loop).fs_stat(lazypath) then
+ vim.fn.system({
+ "git",
+ "clone",
+ "--filter=blob:none",
+ "https://github.com/folke/lazy.nvim.git",
+ "--branch=stable", -- latest stable release
+ lazypath,
+ })
+end
+
+vim.opt.rtp:prepend(lazypath)
+
+require("lazy").setup(
+ { { import = "ache.plugins" }, { import = "ache.plugins.lsp" }, { import = "ache.plugins.llm" } },
+ {
+ checker = {
+ enabled = true,
+ notify = false,
+ },
+ change_detection = {
+ notify = false,
+ },
+ }
+) -- Will list every lua file in the directory and load them.
diff --git a/lua/ache/plugins/auto-session.lua b/lua/ache/plugins/auto-session.lua
new file mode 100644
index 0000000..700e4b8
--- /dev/null
+++ b/lua/ache/plugins/auto-session.lua
@@ -0,0 +1,14 @@
+return {
+ "rmagatti/auto-session",
+ config = function()
+ local auto_session = require("auto-session")
+
+ auto_session.setup({
+ auto_restore_enabled = false,
+ auto_session_allowed_dirs = { "~/git/*", "~/Test/*" },
+ })
+
+ vim.keymap.set("n", "<leader>wr", "<cmd>SessionRestore<CR>", { desc = "Restore session relative to working directory" })
+ vim.keymap.set("n", "<leader>ws", "<cmd>SessionSave<CR>", { desc = "Save session from the current working directory" })
+ end,
+}
diff --git a/lua/ache/plugins/autopairs.lua b/lua/ache/plugins/autopairs.lua
new file mode 100644
index 0000000..1d297fe
--- /dev/null
+++ b/lua/ache/plugins/autopairs.lua
@@ -0,0 +1,25 @@
+return {
+ "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,
+ },
+ })
+
+ 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,
+}
diff --git a/lua/ache/plugins/bufferline.lua b/lua/ache/plugins/bufferline.lua
new file mode 100644
index 0000000..8fe18e3
--- /dev/null
+++ b/lua/ache/plugins/bufferline.lua
@@ -0,0 +1,11 @@
+return {
+ "akinsho/bufferline.nvim",
+ version = "*",
+ dependencies = "nvim-tree/nvim-web-devicons",
+ config = function()
+ vim.opt.termguicolors = true
+ require("bufferline").setup({})
+ vim.keymap.set("n", "<tab>", "<cmd>bnext<cr>")
+ vim.keymap.set("n", "<s-tab>", "<cmd>bprev<cr>")
+ end,
+}
diff --git a/lua/ache/plugins/comment.lua b/lua/ache/plugins/comment.lua
new file mode 100644
index 0000000..c8f8c17
--- /dev/null
+++ b/lua/ache/plugins/comment.lua
@@ -0,0 +1,18 @@
+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")
+
+
+ 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
new file mode 100644
index 0000000..105f7e5
--- /dev/null
+++ b/lua/ache/plugins/dressing.lua
@@ -0,0 +1,4 @@
+return {
+ "stevearc/dressing.nvim",
+ event = "VeryLazy",
+}
diff --git a/lua/ache/plugins/fidget.lua b/lua/ache/plugins/fidget.lua
new file mode 100644
index 0000000..2d70394
--- /dev/null
+++ b/lua/ache/plugins/fidget.lua
@@ -0,0 +1,6 @@
+return {
+ "j-hui/fidget.nvim",
+ opts = {
+ -- options
+ },
+}
diff --git a/lua/ache/plugins/firevim.lua b/lua/ache/plugins/firevim.lua
new file mode 100644
index 0000000..772dc4e
--- /dev/null
+++ b/lua/ache/plugins/firevim.lua
@@ -0,0 +1,25 @@
+return {
+ "glacambre/firenvim",
+
+ -- Lazy load firenvim
+ -- Explanation: https://github.com/folke/lazy.nvim/discussions/463#discussioncomment-4819297
+ lazy = not vim.g.started_by_firenvim,
+ build = function()
+ vim.fn["firenvim#install"](0)
+ end,
+ config = function()
+ vim.g.firenvim_config = {
+ globalSettings = { alt = "all" },
+ localSettings = {
+ [".*"] = {
+ cmdline = "neovim",
+ content = "text",
+ priority = 0,
+ selector = "textarea",
+ takeover = "never",
+ },
+ },
+ }
+ vim.g.firenvim_config.localSettings[".*"] = { takeover = "never" }
+ end,
+}
diff --git a/lua/ache/plugins/formatting.lua b/lua/ache/plugins/formatting.lua
new file mode 100644
index 0000000..d3c7e5f
--- /dev/null
+++ b/lua/ache/plugins/formatting.lua
@@ -0,0 +1,35 @@
+return {
+ "stevearc/conform.nvim",
+ 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,
+ },
+ })
+
+ 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
new file mode 100644
index 0000000..80950bc
--- /dev/null
+++ b/lua/ache/plugins/gitsigns.lua
@@ -0,0 +1,102 @@
+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
+
+ -- 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 })
+
+ ---- 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})
+
+ -- 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 })
+
+ -- 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
new file mode 100644
index 0000000..10162a0
--- /dev/null
+++ b/lua/ache/plugins/hexokinase.lua
@@ -0,0 +1,24 @@
+-- NOTE: That plugin is old and archived
+
+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,
+}
diff --git a/lua/ache/plugins/indent-blankline.lua b/lua/ache/plugins/indent-blankline.lua
new file mode 100644
index 0000000..0d8920c
--- /dev/null
+++ b/lua/ache/plugins/indent-blankline.lua
@@ -0,0 +1,76 @@
+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,
+ },
+ })
+ --[[
+ Alternative chars:
+ • left aligned solid
+ • `▏`
+ • `▎` (default)
+ • `▍`
+ • `▌`
+ • `▋`
+ • `▊`
+ • `▉`
+ • `█`
+ • center aligned solid
+ • `│`
+ • `┃`
+ • right aligned solid
+ • `▕`
+ • `▐`
+ • center aligned dashed
+ • `╎`
+ • `╏`
+ • `┆` <<-- CURRENT ONE
+ • `┇`
+ • `┊`
+ • `┋`
+ • center aligned double
+ • `║`
+--
+ --]]
+ end
+}
diff --git a/lua/ache/plugins/leap.lua b/lua/ache/plugins/leap.lua
new file mode 100644
index 0000000..ffe3e89
--- /dev/null
+++ b/lua/ache/plugins/leap.lua
@@ -0,0 +1,10 @@
+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
+}
diff --git a/lua/ache/plugins/linting.lua b/lua/ache/plugins/linting.lua
new file mode 100644
index 0000000..253107e
--- /dev/null
+++ b/lua/ache/plugins/linting.lua
@@ -0,0 +1,28 @@
+return {
+ "mfussenegger/nvim-lint",
+ event = { "BufReadPre", "BufNewFile" },
+ config = function()
+ local lint = require("lint")
+
+ lint.linters_by_ft = {
+ javascript = { "eslint_d" },
+ typescript = { "eslint_d" },
+ svelte = { "eslint_d" },
+ python = { "ruff" },
+ }
+
+ local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
+
+ vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
+ group = lint_augroup,
+ callback = function()
+ lint.try_lint()
+ end,
+ })
+
+ vim.keymap.set("n", "<leader>l", function()
+ lint.try_lint()
+ -- TODO: Linting for file or buffer ?
+ end, { desc = "Trigger linting for current file" })
+ end,
+}
diff --git a/lua/ache/plugins/llm/gen.lua b/lua/ache/plugins/llm/gen.lua
new file mode 100644
index 0000000..482ffa7
--- /dev/null
+++ b/lua/ache/plugins/llm/gen.lua
@@ -0,0 +1,47 @@
+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)
+
+ 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/llm.lua_ b/lua/ache/plugins/llm/llm.lua_
new file mode 100644
index 0000000..6e0e6ff
--- /dev/null
+++ b/lua/ache/plugins/llm/llm.lua_
@@ -0,0 +1,23 @@
+return {
+ "huggingface/llm.nvim",
+ enabled = false,
+ opts = {
+ backend = "ollama",
+ model = "codestral:latest",
+ url = "http://192.168.1.11:11434/", -- llm-ls uses "/api/generate"
+ -- cf https://github.com/ollama/ollama/blob/main/docs/api.md#parameters_doc
+ -- Function that print fibonacci numbers:
+ -- tec =
+
+ request_body = {
+ -- Modelfile options for the model you use
+ options = {
+ temperature = 0.2,
+ top_p = 0.95,
+ },
+ },
+ lsp = {
+ bin_path = vim.api.nvim_call_function("stdpath", { "data" }) .. "/mason/bin/llm-ls",
+ },
+ },
+}
diff --git a/lua/ache/plugins/llm/model.lua b/lua/ache/plugins/llm/model.lua
new file mode 100644
index 0000000..20ccb10
--- /dev/null
+++ b/lua/ache/plugins/llm/model.lua
@@ -0,0 +1,81 @@
+return {
+ "gsuuon/model.nvim",
+ enabled = true,
+
+ -- Don't need these if lazy = false
+ 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" },
+ },
+ config = function(_, opts)
+ local ollama = require("model.providers.ollama")
+ local model = require("model")
+ local starters = require("model.prompts.chats")
+ local qflist = require("model.util.qflist")
+
+ model.setup({
+ chats = {
+ ["codellama:qfix"] = vim.tbl_deep_extend("force", starters["together:codellama"], {
+ system = "You are an intelligent programming assistant",
+ create = function()
+ return qflist.get_text()
+ end,
+ }),
+ ["ollama:mistral"] = vim.tbl_deep_extend("force", starters["ollama:starling"], {}),
+ },
+ 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,
+ },
+ ["ollama:mistral"] = {
+ provider = ollama,
+ params = {
+ model = "mistral",
+ },
+ builder = function(input)
+ return {
+ prompt = input,
+ params = {
+ model = "mistral",
+ },
+ }
+ end,
+ },
+ },
+ })
+ end,
+
+ -- To override defaults add a config field and call setup()
+
+ -- config = function()
+ -- require('model').setup({
+ -- prompts = {..},
+ -- chats = {..},
+ -- ..
+ -- })
+ --
+ -- require('model.providers.llamacpp').setup({
+ -- binary = '~/path/to/server/binary',
+ -- models = '~/path/to/models/directory'
+ -- })
+ --end
+}
diff --git a/lua/ache/plugins/llm/ollama.lua_ b/lua/ache/plugins/llm/ollama.lua_
new file mode 100644
index 0000000..3cfda80
--- /dev/null
+++ b/lua/ache/plugins/llm/ollama.lua_
@@ -0,0 +1,44 @@
+return {
+ "nomnivore/ollama.nvim",
+ enabled = false,
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "MunifTanjim/nui.nvim",
+ },
+
+ -- All the user commands added by the plugin
+ cmd = { "Ollama", "OllamaModel" },
+
+ keys = {
+ -- Sample keybind for prompt menu. Note that the <c-u> is important for selections to work properly.
+ {
+ "<leader>oo",
+ ":<c-u>lua require('ollama').prompt()<cr>",
+ desc = "ollama prompt",
+ mode = { "n", "v" },
+ },
+
+ -- Sample keybind for direct prompting. Note that the <c-u> is important for selections to work properly.
+ {
+ "<leader>oG",
+ ":<c-u>lua require('ollama').prompt('Generate_Code')<cr>",
+ desc = "ollama Generate Code",
+ mode = { "n", "v" },
+ },
+ },
+
+ ---@type Ollama.Config
+ opts = {
+ -- your configuration overrides
+ url = "https://box.ache.one:1080/ollama",
+ prompts = {
+ Complete_this = {
+ prompt = "$sel",
+ input_label = "> ",
+ model = "mistral",
+ action = "display_replace",
+ extract = "$after",
+ },
+ },
+ },
+}
diff --git a/lua/ache/plugins/llm/ollamachad.lua_ b/lua/ache/plugins/llm/ollamachad.lua_
new file mode 100644
index 0000000..9c1b01e
--- /dev/null
+++ b/lua/ache/plugins/llm/ollamachad.lua_
@@ -0,0 +1,35 @@
+return {
+ "Lommix/ollamachad.nvim",
+ enabled = false,
+ config = function()
+ --- this is the default, you do not need to call setup if you use the default endpoints
+ require("ollamachad").setup({
+ generate_api_url = "https://box.ache.one:1080/ollama/api/generate",
+ chat_api_url = "https://box.ache.one:1080/ollama/api/chat",
+ keymap = {
+ -- send prompt
+ prompt = "<CR>",
+ -- close chat
+ close = "<Esc>",
+ -- clear chat
+ clear = "<C-n>",
+ -- tab between prompt and chat
+ tab = "<Tab>",
+ },
+ })
+
+ -- local chat = require("ollamachad.chat")
+ local gen = require("ollamachad.generate")
+ local util = require("ollamachad.util")
+
+ -- rewrite selected text in visual mode
+ vim.keymap.set("v", "<leader>cr", function()
+ local instruction = "Improove the following text in its original language: "
+ local request = {
+ model = "mistral",
+ prompt = instruction .. util.read_visiual_lines(),
+ }
+ gen.prompt(request)
+ end, { silent = true, desc = "Rewrite the selected text" })
+ end,
+}
diff --git a/lua/ache/plugins/llm/tabby.lua_ b/lua/ache/plugins/llm/tabby.lua_
new file mode 100644
index 0000000..cdc8a2d
--- /dev/null
+++ b/lua/ache/plugins/llm/tabby.lua_
@@ -0,0 +1,23 @@
+-- vim.g.tabby_trigger_mode = "automatic"
+
+-- Accept with Tab
+-- vim.g.tabby_keybinding_accept = "<Tab>"
+--
+-- -- Trigger with Ctr + h
+-- vim.g.tabby_keybinding_trigger_or_dismiss = "<c-h>"
+-- vim.g.tabby_trigger_mode = "manual"
+--
+-- -- Toggle auto mode with Ctr + x then <leader>
+-- vim.keymap.set({ "i", "n" }, "<c-x><leader>", function()
+-- if vim.g.tabby_trigger_mode == "manual" then
+-- vim.g.tabby_trigger_mode = "auto"
+-- else
+-- vim.g.tabby_trigger_mode = "manual"
+-- end
+-- end)
+
+-- No configuration
+return {
+ { "TabbyML/vim-tabby" },
+ enabled = false,
+}
diff --git a/lua/ache/plugins/lsp/lspconfig.lua b/lua/ache/plugins/lsp/lspconfig.lua
new file mode 100644
index 0000000..d7ef824
--- /dev/null
+++ b/lua/ache/plugins/lsp/lspconfig.lua
@@ -0,0 +1,158 @@
+return {
+ "neovim/nvim-lspconfig",
+ event = { "BufReadPre", "BufNewFile" },
+ dependencies = {
+ "hrsh7th/cmp-nvim-lsp",
+ "williamboman/mason-lspconfig.nvim",
+ { "antosha417/nvim-lsp-file-operations", config = true },
+ { "folke/neodev.nvim", opts = {} },
+ },
+ config = function()
+ local lspconfig = require("lspconfig")
+ local mason_lspconfig = require("mason-lspconfig")
+ local cmp_nvim_lsp = require("cmp_nvim_lsp")
+
+ vim.api.nvim_create_autocmd("LspAttach", {
+ group = vim.api.nvim_create_augroup("UserLspConfig", {}),
+ callback = function(ev)
+ -- Buffer local mappings.
+ -- See `:help vim.lsp.*` for documentation on any of the functions below.
+
+ -- Keybinds
+ vim.keymap.set(
+ "n",
+ "gR",
+ "<cmd>Telescope lsp_references<CR>",
+ { buffer = ev.buf, silent = true, desc = "Show LSP references" }
+ )
+ vim.keymap.set(
+ "n",
+ "gD",
+ vim.lsp.buf.declaration,
+ { buffer = ev.buf, silent = true, desc = "Go to declaration" }
+ )
+ vim.keymap.set(
+ "n",
+ "gd",
+ "<cmd>Telescope lsp_definitions<CR>",
+ { buffer = ev.buf, silent = true, desc = "Show LSP definitions" }
+ )
+ vim.keymap.set(
+ "n",
+ "gi",
+ "<cmd>Telescope lsp_implementations<CR>",
+ { buffer = ev.buf, silent = true, desc = "Show LSP implementations" }
+ )
+ vim.keymap.set(
+ "n",
+ "gt",
+ "<cmd>Telescope lsp_type_definitions<CR>",
+ { buffer = ev.buf, silent = true, desc = "Show LSP type definitions" }
+ )
+ vim.keymap.set(
+ { "n", "v" },
+ "<leader>ca",
+ vim.lsp.buf.code_action,
+ { buffer = ev.buf, silent = true, desc = "See available code actions" }
+ )
+ vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { buffer = ev.buf, silent = true, desc = "Smart rename" })
+ vim.keymap.set(
+ "n",
+ "<leader>D",
+ "<cmd>Telescope diagnostics bufnr=0<CR>",
+ { buffer = ev.buf, silent = true, desc = "Show buffer diagnostics" }
+ )
+ vim.keymap.set(
+ "n",
+ "<leader>d",
+ vim.diagnostic.open_float,
+ { buffer = ev.buf, silent = true, desc = "Show line diagnostics" }
+ )
+ vim.keymap.set(
+ "n",
+ "<d",
+ vim.diagnostic.goto_prev,
+ { buffer = ev.buf, silent = true, desc = "Go to previous diagnostic" }
+ )
+ vim.keymap.set(
+ "n",
+ ">d",
+ vim.diagnostic.goto_next,
+ { buffer = ev.buf, silent = true, desc = "Go to next diagnostic" }
+ )
+ vim.keymap.set(
+ "n",
+ "K",
+ vim.lsp.buf.hover,
+ { buffer = ev.buf, silent = true, desc = "Show documentation for what is under the cursor" }
+ )
+ vim.keymap.set(
+ "n",
+ "<leader>rs",
+ "<cmd>LspRestart<CR>",
+ { buffer = ev.buf, silent = true, desc = "Restart LSP" }
+ )
+ end,
+ })
+
+ -- used to enable autocompletion (assign to every lsp server config)
+ local capabilities = cmp_nvim_lsp.default_capabilities()
+
+ -- Change the diagnostics symbols in the sign column (gutter)
+ local signs = { Error = " ", Warn = " ", Hint = "󰠠 ", Info = " " }
+ for type, icon in pairs(signs) do
+ local hl = "DiagnosticSign" .. type
+ vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
+ end
+
+ mason_lspconfig.setup_handlers({
+ -- default handler for installed servers
+ function(server_name)
+ lspconfig[server_name].setup({
+ capabilities = capabilities,
+ })
+ end,
+ ["svelte"] = function()
+ -- Configuration specific to svelte LSP server
+ lspconfig["svelte"].setup({
+ capabilities = capabilities,
+ on_attach = function(client, bufnr)
+ vim.api.nvim_create_autocmd("BufWritePost", {
+ pattern = { "*.js", "*.ts" },
+ callback = function(ctx)
+ -- Here use ctx.match instead of ctx.file
+ client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
+ end,
+ })
+ end,
+ })
+ end,
+ ["lua_ls"] = function()
+ lspconfig["lua_ls"].setup({
+ capabilities = capabilities,
+ settings = {
+ Lua = {
+ -- make the language server recognize the "vim" global variable
+ diagnostics = {
+ globals = { "vim" },
+ },
+ completion = {
+ callSnippet = "Replace",
+ },
+ },
+ },
+ })
+ end,
+ ["pyright"] = function()
+ lspconfig["pyright"].setup({
+ capabilities = capabilities,
+ settings = {
+ python = {
+ pythonPath = "/usr/bin/python",
+ },
+ },
+ })
+ end,
+ })
+ end,
+}
diff --git a/lua/ache/plugins/lsp/mason-config.lua b/lua/ache/plugins/lsp/mason-config.lua
new file mode 100644
index 0000000..bd2dcbe
--- /dev/null
+++ b/lua/ache/plugins/lsp/mason-config.lua
@@ -0,0 +1,53 @@
+return {
+ "williamboman/mason.nvim",
+ dependencies = {
+ "WhoIsSethDaniel/mason-tool-installer.nvim",
+ "mfussenegger/nvim-dap",
+ "jay-babu/mason-nvim-dap.nvim",
+ "neovim/nvim-lspconfig",
+ },
+ config = function()
+ local mason = require("mason")
+
+ local mason_lspconfig = require("mason-lspconfig")
+ local mason_tool_installer = require("mason-tool-installer")
+ local mason_dap = require("mason-nvim-dap")
+ local lspconfig = require("lspconfig")
+
+ mason.setup()
+ mason_dap.setup({
+ ensure_installed = {
+ "codelldb",
+ },
+ })
+
+ mason_lspconfig.setup({
+ lazy = true,
+ ensure_installed = {
+ "tsserver",
+ "html",
+ "cssls",
+ "tailwindcss",
+ "svelte",
+ "lua_ls",
+ "pyright",
+ "ruff_lsp",
+ "rust_analyzer",
+ },
+ })
+
+ mason_tool_installer.setup({
+ ensure_installed = {
+ "prettier", -- Web related formatter
+ "stylua", -- Lua formatter
+ "isort", -- Python formatter
+ "black", -- Python formatter too
+ -- "ruff", -- Python linter
+ "eslint_d", -- JS linter
+ "llm-ls",
+ },
+ })
+
+ -- lspconfig.pyright.setup({})
+ end,
+}
diff --git a/lua/ache/plugins/lsp/mason-lspconf.lua b/lua/ache/plugins/lsp/mason-lspconf.lua
new file mode 100644
index 0000000..267bbb2
--- /dev/null
+++ b/lua/ache/plugins/lsp/mason-lspconf.lua
@@ -0,0 +1,8 @@
+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",
+ },
+}
diff --git a/lua/ache/plugins/lsp/rust-tools.lua b/lua/ache/plugins/lsp/rust-tools.lua
new file mode 100644
index 0000000..ee94be5
--- /dev/null
+++ b/lua/ache/plugins/lsp/rust-tools.lua
@@ -0,0 +1,17 @@
+return {
+ "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,
+}
diff --git a/lua/ache/plugins/lualine.lua b/lua/ache/plugins/lualine.lua
new file mode 100644
index 0000000..75b9b09
--- /dev/null
+++ b/lua/ache/plugins/lualine.lua
@@ -0,0 +1,61 @@
+return {
+ "nvim-lualine/lualine.nvim",
+ event = "VimEnter",
+ dependencies = {
+ "nvim-tree/nvim-web-devicons",
+ {
+ "linrongbin16/lsp-progress.nvim",
+ opts = {},
+ enabled = false,
+ },
+ {
+ "nvim-lua/lsp-status.nvim",
+ -- config = function()
+ -- local lsp_status = require("lsp-status")
+ --
+ -- lsp_status.register_progress()
+ -- end,
+ enabled = false,
+ },
+ },
+ config = function(_, opts)
+ local lualine = require("lualine")
+ local lazy_status = require("lazy.status")
+
+ opts.sections.lualine_x = {
+ { "location" },
+ {
+ lazy_status.updates,
+ cond = lazy_status.has_updates,
+ color = { fg = "#dd9e64" },
+ },
+ { "encoding" },
+ { "fileformat" },
+ { "filetype" },
+ }
+ lualine.setup(opts)
+
+ -- To use with lsp-progress
+ -- vim.api.nvim_create_augroup("lualine_augroup", { clear = true })
+ -- vim.api.nvim_create_autocmd("User", {
+ -- group = "lualine_augroup",
+ -- pattern = "LspProgressStatusUpdated",
+ -- callback = require("lualine").refresh,
+ -- })
+ end,
+ opts = {
+ sections = {
+ ---- To use lsp-status.nvim / works not realy well
+ -- lualine_c = {
+ -- "filename",
+ -- function()
+ -- if #vim.lsp.get_clients() > 0 then
+ -- return require("lsp-status").status()
+ -- else
+ -- return "Lol"
+ -- end
+ -- end,
+ -- },
+ },
+ },
+}
diff --git a/lua/ache/plugins/model.lua b/lua/ache/plugins/model.lua
new file mode 100644
index 0000000..43d89d5
--- /dev/null
+++ b/lua/ache/plugins/model.lua
@@ -0,0 +1,44 @@
+return {
+ "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" },
+ },
+
+ 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,
+}
diff --git a/lua/ache/plugins/night-owl.lua b/lua/ache/plugins/night-owl.lua
new file mode 100644
index 0000000..1d3a025
--- /dev/null
+++ b/lua/ache/plugins/night-owl.lua
@@ -0,0 +1,10 @@
+return {
+ "oxfist/night-owl.nvim",
+ 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()
+ -- load the colorscheme here
+ require("night-owl").setup()
+ vim.cmd.colorscheme("night-owl")
+ end,
+}
diff --git a/lua/ache/plugins/nvim-cmp.lua b/lua/ache/plugins/nvim-cmp.lua
new file mode 100644
index 0000000..abe6a78
--- /dev/null
+++ b/lua/ache/plugins/nvim-cmp.lua
@@ -0,0 +1,153 @@
+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")
+
+ 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")
+
+ 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 })
+
+ 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.
+
+ 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 },
+ --[[
+ -- TODO: Use that icons ! 🥳
+ format = function(entry, item)
+ local menu_icon = {
+ nvim_lsp = "λ",
+ vsnip = "⋗",
+ buffer = "Ω",
+ path = "🖫",
+ }
+ item.menu = menu_icon[entry.source.name]
+ return item
+ end,
+ --]]
+ 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
+
+ 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
new file mode 100644
index 0000000..e4b1f7f
--- /dev/null
+++ b/lua/ache/plugins/nvim-tree.lua
@@ -0,0 +1,52 @@
+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")
+
+ -- 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
+}
diff --git a/lua/ache/plugins/rainbow-delimiters.lua b/lua/ache/plugins/rainbow-delimiters.lua
new file mode 100644
index 0000000..021dde0
--- /dev/null
+++ b/lua/ache/plugins/rainbow-delimiters.lua
@@ -0,0 +1,3 @@
+return {
+ "HiPhish/rainbow-delimiters.nvim",
+}
diff --git a/lua/ache/plugins/scope.lua b/lua/ache/plugins/scope.lua
new file mode 100644
index 0000000..88b0458
--- /dev/null
+++ b/lua/ache/plugins/scope.lua
@@ -0,0 +1,7 @@
+return {
+ "tiagovla/scope.nvim",
+ -- FIXME: Use an other plugin. Doesn't do what I want.
+ config = function()
+ require("scope").setup({})
+ end
+}
diff --git a/lua/ache/plugins/surround.lua b/lua/ache/plugins/surround.lua
new file mode 100644
index 0000000..2f51c21
--- /dev/null
+++ b/lua/ache/plugins/surround.lua
@@ -0,0 +1,27 @@
+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
+}
diff --git a/lua/ache/plugins/telescope.lua b/lua/ache/plugins/telescope.lua
new file mode 100644
index 0000000..4696a4d
--- /dev/null
+++ b/lua/ache/plugins/telescope.lua
@@ -0,0 +1,52 @@
+return {
+ "nvim-telescope/telescope.nvim",
+ branch = "0.1.x",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ {
+ "nvim-telescope/telescope-fzf-native.nvim",
+ build = "make",
+ },
+ "nvim-tree/nvim-web-devicons",
+ "folke/todo-comments.nvim",
+ "tiagovla/scope.nvim",
+ },
+ -- TODO
+ config = function()
+ local telescope = require("telescope")
+ local actions = require("telescope.actions")
+ -- TODO: lqsdjflkqjsdf
+
+ telescope.setup({
+ defaults = {
+ path_display = { "smart" },
+ mappings = {
+ i = {
+ ["<C-k>"] = actions.move_selection_previous, -- move tot prev result
+ ["<C-j>"] = actions.move_selection_next,
+ ["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
+ ["<C-u>"] = false,
+ ["<C-d>"] = actions.close,
+ },
+ },
+ sorting_strategy = "ascending",
+ layout_strategy = "horizontal",
+ layout_config = {
+ prompt_position = "top",
+ },
+ borderchars = { "─", "│", "─", "│", "r", "╮", "╯", "╰" },
+ color_devicons = true,
+ },
+ })
+
+ telescope.load_extension("fzf")
+ telescope.load_extension("scope")
+
+ vim.keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd" })
+ vim.keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recet files" })
+ vim.keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" })
+ vim.keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Find string under cursor in cwd" })
+ vim.keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "Find todos" })
+ vim.keymap.set("n", "<leader>fb", "<cmd>Telescope scope buffers<CR>", { desc = "Find in buffers" })
+ end,
+}
diff --git a/lua/ache/plugins/todo-comments.lua b/lua/ache/plugins/todo-comments.lua
new file mode 100644
index 0000000..6696bbf
--- /dev/null
+++ b/lua/ache/plugins/todo-comments.lua
@@ -0,0 +1,20 @@
+return {
+ "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_prev()
+ end, { desc = "Previous todo comment"})
+
+ todo_comments.setup()
+ end,
+}
diff --git a/lua/ache/plugins/treesitter.lua b/lua/ache/plugins/treesitter.lua
new file mode 100644
index 0000000..2c19cad
--- /dev/null
+++ b/lua/ache/plugins/treesitter.lua
@@ -0,0 +1,76 @@
+return {
+ "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,
+ },
+ --[[
+ 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>",
+ },
+ },
+ })
+
+ -- 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,
+}
diff --git a/lua/ache/plugins/troubles.lua b/lua/ache/plugins/troubles.lua
new file mode 100644
index 0000000..60ee515
--- /dev/null
+++ b/lua/ache/plugins/troubles.lua
@@ -0,0 +1,16 @@
+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)" },
+ },
+}
diff --git a/lua/ache/plugins/twilight.lua b/lua/ache/plugins/twilight.lua
new file mode 100644
index 0000000..6a33f94
--- /dev/null
+++ b/lua/ache/plugins/twilight.lua
@@ -0,0 +1,5 @@
+return {
+ "folke/twilight.nvim",
+ opts = {
+ },
+}
diff --git a/lua/ache/plugins/vimtext.lua b/lua/ache/plugins/vimtext.lua
new file mode 100644
index 0000000..d62d540
--- /dev/null
+++ b/lua/ache/plugins/vimtext.lua
@@ -0,0 +1,17 @@
+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"
+
+ 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,
+}
diff --git a/lua/ache/plugins/which-key.lua b/lua/ache/plugins/which-key.lua
new file mode 100644
index 0000000..9675559
--- /dev/null
+++ b/lua/ache/plugins/which-key.lua
@@ -0,0 +1,9 @@
+return {
+ "folke/which-key.nvim",
+ event = "VeryLazy",
+ init = function()
+ vim.opt.timeout = true
+ vim.opt.timeoutlen = 500
+ end,
+ opts = {}, -- Use default configuration.
+}
diff --git a/plugin/trailing-white-space.vim b/plugin/trailing-white-space.vim
new file mode 100644
index 0000000..c0f2887
--- /dev/null
+++ b/plugin/trailing-white-space.vim
@@ -0,0 +1,41 @@
+hi ExtraWhitespaces ctermbg=238 guibg=#904030
+match ExtraWhitespaces /\s\+$/
+
+" Show special chars
+" set list
+"set listchars=tab:›\ ,trail:ꞏ,extends:♯,eol:¬,nbsp:⍽
+
+
+" EOL alternatives: ⏎ / ⁊ / ¬ / ∵ / ∴ / ⊢ / ‹ / ≡ /
+
+" ␣ and ⍽ are different (' ̄□ ̄;)!!
+" ⋅ and · are different ‼️ 🤯
+" The first is dot produt, the second is middle dot.
+" And there are more!
+" Here is ‧ hyphenation point.
+" Here is ・katana middle dot.
+" Here is ・ katana middle dot alternative.
+" Here is ˑ IPA triangular (?!) middle dot.
+" Here is ᛫ Runic single ponctuation. 🤣
+" Here is ∙ bullet operator.
+" Here is • bullet.
+" Here is ⸱ word separator middle dot.
+" Here is ꞏ Latin letter dot (dot as a letter!).
+" Here is ⸳ raised dot.
+" Here is ⋅ dot operator.
+" Here is · middle dot.
+" Here is ● black cercle.
+" Here is ⦁ z notation cercle. (https://en.wikipedia.org/wiki/Z_notation)
+" Here is · greek ano teleia.
+" Here is ∘ ring operator.
+" Here is . full stop.
+"
+" Symbol that should be used as a tabulation: ␉
+" Symbol that should be used as tabulation key: ↹
+" Symbol that should be used as nbsp: ⍽
+" Symbol that should be used as carriage return: ␍
+" Symbol that should be used as new line: ␤
+" Symbol that should be used as enter key: ⏎ / ⎆ / ⌤ / ⌤ / ↩ / ↵
+"
+" Symbol that should be used as paragraph separator: ¶ (pied-de-mouche)
+" Symbol that should be used as section separator: § (section sign)