diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-09-18 00:58:26 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-09-18 00:58:28 +0200 |
commit | cb36ccfa8db66db953795fd8e22138ed1712b1cd (patch) | |
tree | fc0f8ef4e73c5fa7fb627d383a991aeb49a59bca /lua | |
parent | 424ad679f861031485e2e2f0ca19f5b559db929b (diff) |
checkpoint
- added basic luasnip configuration
- added highlights for TODO and FIXME keywords
- added incremental selection of treesitter
- added prettier to conform formatters
- added when_disabled function to disable pairs in comments
- changed the hiding keybind to :Hide command
- only enable ` pairs in markdown
- removed <c-k> keybind
- removed cmp's calc source
- renamed keybinds for consistency
- reorganized plugins in lazy.lua
Diffstat (limited to 'lua')
-rw-r--r-- | lua/config/lazy.lua | 151 | ||||
-rw-r--r-- | lua/config/lsp.lua | 27 | ||||
-rw-r--r-- | lua/config/map.lua | 24 | ||||
-rw-r--r-- | lua/config/set.lua | 3 |
4 files changed, 102 insertions, 103 deletions
diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 1bdad47..3cbe77c 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -14,68 +14,68 @@ vim.opt.rtp:prepend(lazypath) -- plugins installation and configuration require("lazy").setup({ - -- lsp setup + "echasnovski/mini.nvim", + "lewis6991/gitsigns.nvim", + "tpope/vim-vinegar", + "tpope/vim-eunuch", + "mg979/vim-visual-multi", + "jghauser/follow-md-links.nvim", + "m4xshen/autoclose.nvim", + "stevearc/conform.nvim", + "mfussenegger/nvim-lint", + "neovim/nvim-lspconfig", + { - -- LSP Support - "neovim/nvim-lspconfig", - -- lsp download manager "williamboman/mason.nvim", - -- automatic lsp setup - "williamboman/mason-lspconfig.nvim", - -- additional formater support - "stevearc/conform.nvim", - -- additional linter support - "mfussenegger/nvim-lint", - -- mason autoinstaller for formatter's and linter's - "WhoIsSethDaniel/mason-tool-installer.nvim", - -- minimal snippet's support - "dcampos/nvim-snippy", - -- basic snippet's - "honza/vim-snippets", - -- cmp for autocompletion - { - "hrsh7th/nvim-cmp", - dependencies = { - -- cmp nvim-lsp plugin - "hrsh7th/cmp-nvim-lsp", - -- path comletion - "hrsh7th/cmp-path", - -- cmp snippy support - "dcampos/cmp-snippy", - "hrsh7th/cmp-calc", - }, - event = { "InsertEnter", "CmdlineEnter" }, + dependencies = { + "williamboman/mason-lspconfig.nvim", + -- for formatters and linters + "WhoIsSethDaniel/mason-tool-installer.nvim", }, - -- kind icons - "onsails/lspkind.nvim", - -- Minimal neovim modules for a lot of things - "echasnovski/mini.nvim", - -- Adds git related signs to the gutter, as well as utilities for managing changes - "lewis6991/gitsigns.nvim", - -- better ntrw - "tpope/vim-vinegar", - "tpope/vim-eunuch", - -- integration with tmux keybinds - { - "christoomey/vim-tmux-navigator", - cmd = { - "TmuxNavigateLeft", - "TmuxNavigateDown", - "TmuxNavigateUp", - "TmuxNavigateRight", - "TmuxNavigatePrevious", - }, - keys = { - { "<M-h>", "<cmd>TmuxNavigateLeft<cr>" }, - { "<M-j>", "<cmd>TmuxNavigateDown<cr>" }, - { "<M-k>", "<cmd>TmuxNavigateUp<cr>" }, - { "<M-l>", "<cmd>TmuxNavigateRight<cr>" }, - { "<M-\\>", "<cmd>TmuxNavigatePrevious<cr>" }, - }, + config = function() + require("mason").setup({ + ui = { + border = "rounded", + }, + }) + end, + }, + { + --snippets + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp", + }, + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + "hrsh7th/cmp-buffer", + "saadparwaiz1/cmp_luasnip", + "onsails/lspkind.nvim", }, - -- auto close brackets - "m4xshen/autoclose.nvim", + event = { "InsertEnter", "CmdlineEnter" }, }, + + { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + }, + keys = { + { "<M-h>", "<cmd>TmuxNavigateLeft<cr>" }, + { "<M-j>", "<cmd>TmuxNavigateDown<cr>" }, + { "<M-k>", "<cmd>TmuxNavigateUp<cr>" }, + { "<M-l>", "<cmd>TmuxNavigateRight<cr>" }, + { "<M-\\>", "<cmd>TmuxNavigatePrevious<cr>" }, + }, + }, + { "ray-x/go.nvim", dependencies = { -- optional packages @@ -91,9 +91,6 @@ require("lazy").setup({ build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries }, - "mg979/vim-visual-multi", - "jghauser/follow-md-links.nvim", - { "dstein64/vim-startuptime", cmd = "StartupTime", @@ -132,9 +129,8 @@ require("lazy").setup({ vim.cmd.colorscheme("nord") end, }, - - -- Fuzzy Finder (files, lsp, etc) { + -- Fuzzy Finder (files, lsp, etc) "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim", @@ -146,20 +142,14 @@ require("lazy").setup({ }, }, }, - { - -- Highlight, edit, and navigate code "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", }, - { - -- harpoon your way around code - { - "ThePrimeagen/harpoon", - branch = "harpoon2", - requires = { "nvim-lua/plenary.nvim", lazy = true }, - }, + "ThePrimeagen/harpoon", + branch = "harpoon2", + requires = { "nvim-lua/plenary.nvim", lazy = true }, }, }, { @@ -175,14 +165,13 @@ require("lazy").setup({ }, }, }, - install = { - colorscheme = { "nord" }, - missing = false, - }, - change_detection = { - enabled = false, - notify = false, - }, - checker = { enabled = false }, - -- defaults = {lazy = true}, + -- install = { + -- colorscheme = { "nord" }, + -- missing = false, + -- }, + -- change_detection = { + -- enabled = true, + -- notify = true, + -- }, + -- checker = { enabled = true, notify = false }, }) diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 715d0f9..e94966a 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -14,8 +14,9 @@ map("n", " lq", vim.diagnostic.setqflist) -- [[ LSP Setups ]] local lspconfig = require("lspconfig") --- go lspconfig.gopls.setup({}) +lspconfig.clangd.setup({}) +lspconfig.emmet_ls.setup({}) -- lua -- with neovim support @@ -54,14 +55,19 @@ require("lspconfig").lua_ls.setup({ -- [[ nvim cmp ]] require("cmp_nvim_lsp").default_capabilities() local cmp = require("cmp") +local context = require("cmp.config.context") local lspkind = require("lspkind") cmp.setup({ - completion = { - autocomplete = false, - }, + enabled = function() + if context.in_treesitter_capture("comment") == true or context.in_syntax_group("Comment") then + return false + else + return true + end + end, snippet = { expand = function(args) - require("snippy").expand_snippet(args.body) + require("luasnip").lsp_expand(args.body) end, }, window = { @@ -86,11 +92,14 @@ cmp.setup({ }), }), sources = cmp.config.sources({ - { name = "nvim_lsp" }, - -- { name = "snippy" }, + { + name = "nvim_lsp", + keyword_length = 3, + }, + { name = "luasnip" }, }, { - { name = "buffer" }, - { name = "calc" }, + -- { name = "buffer", max_item_count = 5 }, + { name = "path", max_item_count = 5 }, }), formatting = { format = lspkind.cmp_format({ diff --git a/lua/config/map.lua b/lua/config/map.lua index 230588f..85c1e0f 100644 --- a/lua/config/map.lua +++ b/lua/config/map.lua @@ -25,7 +25,6 @@ map("x", "<leader>p", [["_dP]], { desc = "Paste while keeping the registry" }) -- moving map("i", "<C-a>", "<C-o>I", { noremap = true }) map("i", "<C-e>", "<C-o>A", { noremap = true }) -map("i", "<C-k>", "<C-o>D", { noremap = true }) -- buffers map("n", "<leader>sp", "<cmd>sp<cr>", { desc = "Open horizontal split" }) @@ -53,18 +52,17 @@ map({ "n", "v" }, "<leader>d", [["_d]]) map("n", "<LocalLeader>rt", ":-1r " .. vim.fn.stdpath("config") .. "/templates", { noremap = true }) -- hide all -local s = { hidden_all = 0 } -map("n", "<C-h>", function() - s.hidden_all = 1 - s.hidden_all - local opt = s.hidden_all == 0 - vim.opt.showmode = opt - vim.opt.ruler = opt - vim.opt.nu = opt - vim.opt.rnu = opt - vim.opt.showcmd = opt - vim.opt.laststatus = opt and 2 or 0 - vim.opt.signcolumn = opt and "yes" or "no" -end, { noremap = true }) +local hidden = true -- flag +vim.api.nvim_create_user_command("Hide", function() + hidden = hidden == false + vim.opt.showmode = hidden + vim.opt.ruler = hidden + vim.opt.nu = hidden + vim.opt.rnu = hidden + vim.opt.showcmd = hidden + vim.opt.laststatus = hidden and 2 or 0 + vim.opt.signcolumn = hidden and "yes" or "no" +end, {}) -- write map("n", "<Leader>w", "<cmd>write<cr>", { noremap = true }) diff --git a/lua/config/set.lua b/lua/config/set.lua index 3623a02..ce43d04 100644 --- a/lua/config/set.lua +++ b/lua/config/set.lua @@ -109,3 +109,6 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s vim.diagnostic.config({ float = { border = _border }, }) + +-- highlight to-do's +vim.cmd("match Todo /\\(TODO\\|FIXME\\):/") |