From b0cfdab1e93f660fda8f9398e30c9c996a1760f3 Mon Sep 17 00:00:00 2001 From: "eric.marin" Date: Wed, 16 Oct 2024 21:45:26 +0200 Subject: nvim change installed neorg removed trouble modified lspsaga --- nvim/lua/config/options.lua | 1 + nvim/lua/plugins/dashboard-nvim.lua | 5 ++ nvim/lua/plugins/lspsaga.lua | 43 ++++++++------ nvim/lua/plugins/neorg.lua | 105 +++++++++++++++++++++++++++++++++++ nvim/lua/plugins/noice.lua | 2 +- nvim/lua/plugins/nvim-cmp.lua | 6 +- nvim/lua/plugins/nvim-lspconfig.lua | 70 +++++++++++++++-------- nvim/lua/plugins/nvim-treesitter.lua | 3 +- nvim/lua/plugins/telescope.lua | 25 +++++---- nvim/lua/plugins/todo-comments.lua | 18 +++--- nvim/lua/plugins/trouble.lua | 24 -------- nvim/lua/plugins/which-key.lua | 25 +++++++-- 12 files changed, 235 insertions(+), 92 deletions(-) create mode 100644 nvim/lua/plugins/neorg.lua delete mode 100644 nvim/lua/plugins/trouble.lua (limited to 'nvim/lua') diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua index 1629194..d79c664 100644 --- a/nvim/lua/config/options.lua +++ b/nvim/lua/config/options.lua @@ -17,6 +17,7 @@ opt.signcolumn = "yes" opt.cmdheight = 1 opt.scrolloff = 10 opt.completeopt = "menuone,noinsert,noselect" +opt.conceallevel = 3 -- Search opt.incsearch = true diff --git a/nvim/lua/plugins/dashboard-nvim.lua b/nvim/lua/plugins/dashboard-nvim.lua index ea071df..287bf21 100644 --- a/nvim/lua/plugins/dashboard-nvim.lua +++ b/nvim/lua/plugins/dashboard-nvim.lua @@ -189,6 +189,11 @@ Quotes = { "", "Quiet people have the loudest minds.", "~ Stephen Hawking", + }, + { + "", + "An idiot admires complexity, a genius admires simplicity.", + "~ Terry Davis", } } diff --git a/nvim/lua/plugins/lspsaga.lua b/nvim/lua/plugins/lspsaga.lua index e486799..d6faadc 100644 --- a/nvim/lua/plugins/lspsaga.lua +++ b/nvim/lua/plugins/lspsaga.lua @@ -1,24 +1,33 @@ +local config = function() + require("lspsaga").setup({ + ui = { + code_action = "", + }, + outline = { + keys = { + toggle_or_jump = "" + } + }, + finder = { + keys = { + toggle_or_open = "", + shuttle = "", + } + }, + diagnostic = { + diagnostic_only_current = true, + } + }) + vim.diagnostic.config({ + virtual_text = false + }) +end + return { "nvimdev/lspsaga.nvim", lazy = true, event = { "BufReadPost", "BufWritePost", "BufNewFile" }, - config = function() - require("lspsaga").setup({ - -- keybinds for navigation in lspsaga window - move_in_saga = { prev = "", next = "" }, - -- use enter to open file with finder - finder_action_keys = { - open = "" - }, - -- use enter to open file with definition preview - definition_action_keys = { - edit = "" - }, - ui = { - code_action = "", - }, - }) - end, + config = config, dependencies = { "nvim-treesitter/nvim-treesitter", -- optional "nvim-tree/nvim-web-devicons", -- optional diff --git a/nvim/lua/plugins/neorg.lua b/nvim/lua/plugins/neorg.lua new file mode 100644 index 0000000..be2f7e2 --- /dev/null +++ b/nvim/lua/plugins/neorg.lua @@ -0,0 +1,105 @@ +local config = function() + -- remap keybinds + vim.keymap.set("v", "<", "(neorg.promo.demote.range)", { buffer = true }) + vim.keymap.set("v", ">", "(neorg.promo.promote.range)", { buffer = true }) + vim.keymap.set("n", "ma", "(neorg.qol.todo-items.todo.task-ambiguous)", { buffer = true }) + vim.keymap.set("n", "mc", "(neorg.qol.todo-items.todo.task-cancelled)", { buffer = true }) + vim.keymap.set("n", "md", "(neorg.qol.todo-items.todo.task-done)", { buffer = true }) + vim.keymap.set("n", "mh", "(neorg.qol.todo-items.todo.task-on-hold)", { buffer = true }) + vim.keymap.set("n", "mi", "(neorg.qol.todo-items.todo.task-important)", { buffer = true }) + vim.keymap.set("n", "mp", "(neorg.qol.todo-items.todo.task-pending)", { buffer = true }) + vim.keymap.set("n", "mr", "(neorg.qol.todo-items.todo.task-recurring)", { buffer = true }) + vim.keymap.set("n", "mu", "(neorg.qol.todo-items.todo.task-undone)", { buffer = true }) + + require("neorg").setup({ + load = { + ["core.defaults"] = { + config = { + disable = { + "core.esupports.metagen", + "core.journal", + } + } + }, + ["core.completion"] = { + config = { + engine = "nvim-cmp" + } + }, + ["core.journal"] = { + config = { + journal_folder = "neorg/journal/" + } + }, + ["core.esupports.metagen"] = { + config = { + timezone = "implicit-local", + type = "empty" + } + }, + ["core.concealer"] = { + config = { + icons = { + heading = { + icons = { "󰲠", "󰲢", "󰲤", "󰲦", "󰲨", "󰲪" }, + }, + todo = { + cancelled = { icon = "" }, + pending = { icon = "󰔛" }, + uncertain = { icon = "" }, + urgent = { icon = "" }, + }, + code_block = { + conceal = true, + width = "content", + padding = { + right = 1, + } + } + } + } + }, + ["core.highlights"] = { + config = { + highlights = { + headings = { + ["1"] = { + prefix = "+RenderMarkdownH1", + title = "+RenderMarkdownH1" + }, + ["2"] = { + prefix = "+RenderMarkdownH2", + title = "+RenderMarkdownH2" + }, + ["3"] = { + prefix = "+RenderMarkdownH3", + title = "+RenderMarkdownH3" + }, + ["4"] = { + prefix = "+RenderMarkdownH4", + title = "+RenderMarkdownH4" + }, + ["5"] = { + prefix = "+RenderMarkdownH5", + title = "+RenderMarkdownH5" + }, + ["6"] = { + prefix = "+RenderMarkdownH6", + title = "+RenderMarkdownH6" + } + } + } + } + } + } + }) +end + +return { + "nvim-neorg/neorg", + lazy = true, + ft = "norg", + cmd = "Neorg", + version = "*", -- Pin Neorg to the latest stable release + config = config, +} diff --git a/nvim/lua/plugins/noice.lua b/nvim/lua/plugins/noice.lua index 7aa127c..aa4d482 100644 --- a/nvim/lua/plugins/noice.lua +++ b/nvim/lua/plugins/noice.lua @@ -14,7 +14,7 @@ local config = function() command_palette = true, -- position the cmdline and popupmenu together long_message_to_split = true, -- long messages will be sent to a split inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help + lsp_doc_border = true, -- add a border to hover docs and signature help }, }) end diff --git a/nvim/lua/plugins/nvim-cmp.lua b/nvim/lua/plugins/nvim-cmp.lua index d997a2c..800391d 100644 --- a/nvim/lua/plugins/nvim-cmp.lua +++ b/nvim/lua/plugins/nvim-cmp.lua @@ -35,13 +35,15 @@ local config = function() }, sources = cmp.config.sources( { + { name = "lazydev", group_index = 0 } + }, { + { name = "neorg" } + }, { { name = "nvim_lsp" }, }, { { name = "buffer" }, }, { { name = "path" }, - }, { - { name = "lazydev", group_index = 0 } } ) }) diff --git a/nvim/lua/plugins/nvim-lspconfig.lua b/nvim/lua/plugins/nvim-lspconfig.lua index d5729bf..5be314c 100644 --- a/nvim/lua/plugins/nvim-lspconfig.lua +++ b/nvim/lua/plugins/nvim-lspconfig.lua @@ -11,15 +11,28 @@ local config = function() local on_attach = function(client, bufnr) local keymap = vim.keymap - local opts = { noremap = true, silent = true, buffer = bufnr } + local lsp = vim.lsp + local opts = { noremap = true, silent = true, buffer = bufnr, desc = "" } -- setting custom keymaps - keymap.set("n", "lf", ":Lspsaga finder", opts) -- go to definition - keymap.set("n", "lp", ":Lspsaga peek_definition", opts) -- peak definition - keymap.set("n", "lg", ":Lspsaga goto_definition", opts) -- go to definition - keymap.set("n", "la", ":Lspsaga code_action", opts) -- see available code actions - keymap.set("n", "lr", ":Lspsaga rename", opts) -- smart rename - keymap.set("n", "ld", ":Lspsaga hover_doc", opts) -- show documentation for what is under cursor + opts.desc = "Finder" + keymap.set("n", "lf", ":Lspsaga finder", opts) -- go to definition + opts.desc = "Peek Definition (Lspsaga)" + keymap.set("n", "lp", ":Lspsaga peek_definition", opts) -- peak definition + opts.desc = "Goto Definition (Lspsaga)" + keymap.set("n", "lg", ":Lspsaga goto_definition", opts) -- go to definition + opts.desc = "Code Action (Lspsaga)" + keymap.set("n", "la", ":Lspsaga code_action", opts) -- see available code actions + opts.desc = "Rename (Lspsaga)" + keymap.set("n", "lr", ":Lspsaga rename", opts) -- smart rename + opts.desc = "Hover Documentation (Lspsaga)" + keymap.set("n", "lk", lsp.buf.hover, opts) -- show documentation for what is under cursor + opts.desc = "Outline (Lspsaga)" + keymap.set("n", "lo", ":Lspsaga outline", opts) -- show outline + opts.desc = "Diagnostic (Lspsaga)" + keymap.set("n", "ld", ":Lspsaga show_workspace_diagnostics", opts) -- show diagnostics + + keymap.del("n", "K", { buffer = bufnr }) -- enable auto formatting on save if client.supports_method("textDocument/formatting") then @@ -33,16 +46,16 @@ local config = function() end -- efm server configuration - lspconfig.efm.setup({ - init_options = { - documentFormatting = true, - documentRangeFormatting = true, - hover = true, - documentSymbol = true, - codeAction = true, - completion = true, - }, - }) + -- lspconfig.efm.setup({ + -- init_options = { + -- documentFormatting = true, + -- documentRangeFormatting = true, + -- hover = true, + -- documentSymbol = true, + -- codeAction = true, + -- completion = true, + -- }, + -- }) -- clangd server configuration lspconfig.clangd.setup({ on_attach = on_attach, @@ -63,21 +76,32 @@ local config = function() on_attach = on_attach, capabilities = capabilities, }) - -- lua-language-server + -- lua-language-server configuration lspconfig.lua_ls.setup({ on_attach = on_attach, capabilities = capabilities, }) -- nixd configuration - -- lspconfig.nixd.setup({ - -- on_attach = on_attach, - -- capabilities = capabilities, - -- }) - -- typescript-language-server + lspconfig.nixd.setup({ + on_attach = on_attach, + capabilities = capabilities, + }) + -- typescript-language-server configuration lspconfig.ts_ls.setup({ on_attach = on_attach, capabilities = capabilities, }) + -- cssls-language-server configuration + lspconfig.cssls.setup({ + on_attach = on_attach, + capabilities = capabilities, + }) + -- vacuum configuration + lspconfig.vacuum.setup({ + on_attach = on_attach, + capabilities = capabilities, + filetypes = { "yaml", "json" } + }) end return { diff --git a/nvim/lua/plugins/nvim-treesitter.lua b/nvim/lua/plugins/nvim-treesitter.lua index 800df42..ffb8824 100644 --- a/nvim/lua/plugins/nvim-treesitter.lua +++ b/nvim/lua/plugins/nvim-treesitter.lua @@ -19,7 +19,8 @@ local config = function() "rust", "haskell", "nix", - "javascript" + "javascript", + "norg", }, auto_install = false, highlight = { diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua index da57922..cb17298 100644 --- a/nvim/lua/plugins/telescope.lua +++ b/nvim/lua/plugins/telescope.lua @@ -1,17 +1,18 @@ local init = function() local keymap = vim.keymap - keymap.set("n", "tk", ":Telescope keymaps", - { noremap = true, silent = true, desc = "Keymaps (Telescope)" }) -- Keymaps - keymap.set("n", "th", ":Telescope help_tags", - { noremap = true, silent = true, desc = "Help (Telescope)" }) -- Help - keymap.set("n", "tf", ":Telescope find_files", - { noremap = true, silent = true, desc = "Find files (Telescope)" }) -- Find files - keymap.set("n", "ta", ":Telescope", - { noremap = true, silent = true, desc = "All commands (Telescope)" }) -- All commands - keymap.set("n", "tg", ":Telescope live_grep", - { noremap = true, silent = true, desc = "Find words (Telescope)" }) -- Find words - keymap.set("n", "tb", ":Telescope buffers", - { noremap = true, silent = true, desc = "Buffers (Telescope)" }) -- Buffers + local opts = { noremap = true, silent = true, desc = "" } + opts.desc = "Keymaps (Telescope)" + keymap.set("n", "tk", ":Telescope keymaps", opts) -- Keymaps + opts.desc = "Help (Telescope)" + keymap.set("n", "th", ":Telescope help_tags", opts) -- Help + opts.desc = "Find files (Telescope)" + keymap.set("n", "tf", ":Telescope find_files", opts) -- Find files + opts.desc = "All commands (Telescope)" + keymap.set("n", "ta", ":Telescope", opts) -- All commands + opts.desc = "Find words (Telescope)" + keymap.set("n", "tg", ":Telescope live_grep", opts) -- Find words + opts.desc = "Buffers (Telescope)" + keymap.set("n", "tb", ":Telescope buffers", opts) -- Buffers end local config = function() diff --git a/nvim/lua/plugins/todo-comments.lua b/nvim/lua/plugins/todo-comments.lua index 34da0fe..85e8090 100644 --- a/nvim/lua/plugins/todo-comments.lua +++ b/nvim/lua/plugins/todo-comments.lua @@ -1,9 +1,5 @@ -return { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - lazy = true, - event = { "BufReadPost", "BufWritePost", "BufNewFile" }, - opts = { +local config = function() + require("todo-comments").setup({ keywords = { FIX = { icon = "", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" } }, TODO = { icon = "", color = "info" }, @@ -22,7 +18,15 @@ return { hack = "#F5A97F", perf = "#C6A0F6" } - } + }) +end + +return { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + lazy = true, + event = { "BufReadPost", "BufWritePost", "BufNewFile" }, + config = config } -- FIX: ciao diff --git a/nvim/lua/plugins/trouble.lua b/nvim/lua/plugins/trouble.lua deleted file mode 100644 index a49d906..0000000 --- a/nvim/lua/plugins/trouble.lua +++ /dev/null @@ -1,24 +0,0 @@ -local init = function() - local keymap = vim.keymap - keymap.set("n", "rd", ":Trouble diagnostics toggle", - { noremap = true, silent = true, desc = "Diagnostics (Trouble)" }) -- Diagnostics - keymap.set("n", "rt", ":Trouble todo toggle", - { noremap = true, silent = true, desc = "Todos (Trouble)" }) -- Todos - keymap.set("n", "ro", ":Trouble symbols toggle", - { noremap = true, silent = true, desc = "Outline (Trouble)" }) -- Outline -end - -local config = function() - require("trouble").setup({ - use_diagnostic_signs = true - }) -end - -return { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - lazy = true, - cmd = "Trouble", - init = init, - config = config -} diff --git a/nvim/lua/plugins/which-key.lua b/nvim/lua/plugins/which-key.lua index 5b1383e..4e391f9 100644 --- a/nvim/lua/plugins/which-key.lua +++ b/nvim/lua/plugins/which-key.lua @@ -1,10 +1,25 @@ +local config = function() + require("which-key").setup() + vim.o.timeout = true + vim.o.timeoutlen = 500 +end + return { "folke/which-key.nvim", lazy = true, event = "VeryLazy", - init = function() - vim.o.timeout = true - vim.o.timeoutlen = 500 - end, - opts = {} + config = config, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, + dependencies = { + "echasnovski/mini.icons", + "nvim-tree/nvim-web-devicons", -- optional + }, } -- cgit v1.2.3