From f1eee5e135d3d47bbba309182c14856f1df5e467 Mon Sep 17 00:00:00 2001 From: tiago Date: Sat, 27 Jan 2024 18:23:43 +0000 Subject: [PATCH] nvim lazy working noice --- .config/nvim/{after => _after}/plugin/cmp.lua | 0 .../{after => _after}/plugin/colorizer.lua | 0 .../{after => _after}/plugin/colorscheme.lua | 0 .../nvim/{after => _after}/plugin/fidget.lua | 0 .../{after => _after}/plugin/fugitive.lua | 0 .../nvim/{after => _after}/plugin/harpoon.lua | 0 .../{after => _after}/plugin/lspconfig.lua | 0 .../nvim/{after => _after}/plugin/null-ls.lua | 0 .../nvim/{after => _after}/plugin/orgmode.lua | 0 .../{after => _after}/plugin/statusline.lua | 0 .../{after => _after}/plugin/telescope.lua | 0 .../plugin/todo-comments.lua | 0 .../plugin/treesitter-context.lua | 0 .../{after => _after}/plugin/treesitter.lua | 0 .../{after => _after}/plugin/undotree.lua | 0 .../nvim/{after => _after}/plugin/vimtex.lua | 0 .config/nvim/{ => _lua}/tsousa/init.lua | 1 - .config/nvim/{lua => _lua}/tsousa/packer.lua | 0 .config/nvim/{ => _lua}/tsousa/remap.lua | 9 - .config/nvim/{ => _lua}/tsousa/set.lua | 3 + .config/nvim/ftplugin/java.lua | 6 - .config/nvim/ftplugin/lhaskell.lua | 4 - .config/nvim/lazy-lock.json | 34 +++ .config/nvim/lua/tsousa/init.lua | 33 ++- .config/nvim/{ => lua}/tsousa/lazy.lua | 0 .../nvim/lua/tsousa/plugins/colorscheme.lua | 36 +++ .../{ => lua}/tsousa/plugins/fugitive.lua | 0 .../nvim/{ => lua}/tsousa/plugins/harpoon.lua | 8 +- .../tsousa/plugins/init.lua} | 2 +- .config/nvim/lua/tsousa/plugins/lsp.lua | 278 ++++++++++++++++++ .../nvim/{ => lua}/tsousa/plugins/lualine.lua | 10 +- .config/nvim/lua/tsousa/plugins/null-ls.lua | 17 ++ .../nvim/{ => lua}/tsousa/plugins/orgmode.lua | 0 .config/nvim/lua/tsousa/plugins/telescope.lua | 14 + .../nvim/lua/tsousa/plugins/todo-comments.lua | 70 +++++ .../nvim/lua/tsousa/plugins/treesitter.lua | 134 +++++++++ .../{ => lua}/tsousa/plugins/undotree.lua | 0 .config/nvim/lua/tsousa/remap.lua | 1 + .config/nvim/lua/tsousa/set.lua | 3 +- .config/nvim/plugin/packer_compiled.lua | 9 +- .config/nvim/tsousa/packer.lua | 49 --- .config/nvim/tsousa/plugins/cmp.lua | 199 ------------- .config/nvim/tsousa/plugins/colorscheme.lua | 54 ---- .config/nvim/tsousa/plugins/fidget.lua | 4 - .config/nvim/tsousa/plugins/lspconfig.lua | 72 ----- .config/nvim/tsousa/plugins/mason.lua | 19 -- .config/nvim/tsousa/plugins/null-ls.lua | 12 - .config/nvim/tsousa/plugins/telescope.lua | 13 - .../tsousa/plugins/treesitter-context.lua | 37 --- .config/nvim/tsousa/plugins/treesitter.lua | 112 ------- 50 files changed, 638 insertions(+), 605 deletions(-) rename .config/nvim/{after => _after}/plugin/cmp.lua (100%) rename .config/nvim/{after => _after}/plugin/colorizer.lua (100%) rename .config/nvim/{after => _after}/plugin/colorscheme.lua (100%) rename .config/nvim/{after => _after}/plugin/fidget.lua (100%) rename .config/nvim/{after => _after}/plugin/fugitive.lua (100%) rename .config/nvim/{after => _after}/plugin/harpoon.lua (100%) rename .config/nvim/{after => _after}/plugin/lspconfig.lua (100%) rename .config/nvim/{after => _after}/plugin/null-ls.lua (100%) rename .config/nvim/{after => _after}/plugin/orgmode.lua (100%) rename .config/nvim/{after => _after}/plugin/statusline.lua (100%) rename .config/nvim/{after => _after}/plugin/telescope.lua (100%) rename .config/nvim/{after => _after}/plugin/todo-comments.lua (100%) rename .config/nvim/{after => _after}/plugin/treesitter-context.lua (100%) rename .config/nvim/{after => _after}/plugin/treesitter.lua (100%) rename .config/nvim/{after => _after}/plugin/undotree.lua (100%) rename .config/nvim/{after => _after}/plugin/vimtex.lua (100%) rename .config/nvim/{ => _lua}/tsousa/init.lua (98%) rename .config/nvim/{lua => _lua}/tsousa/packer.lua (100%) rename .config/nvim/{ => _lua}/tsousa/remap.lua (69%) rename .config/nvim/{ => _lua}/tsousa/set.lua (94%) delete mode 100644 .config/nvim/ftplugin/java.lua delete mode 100644 .config/nvim/ftplugin/lhaskell.lua create mode 100644 .config/nvim/lazy-lock.json rename .config/nvim/{ => lua}/tsousa/lazy.lua (100%) create mode 100644 .config/nvim/lua/tsousa/plugins/colorscheme.lua rename .config/nvim/{ => lua}/tsousa/plugins/fugitive.lua (100%) rename .config/nvim/{ => lua}/tsousa/plugins/harpoon.lua (53%) rename .config/nvim/{tsousa/plugins/ncplugins.lua => lua/tsousa/plugins/init.lua} (87%) create mode 100644 .config/nvim/lua/tsousa/plugins/lsp.lua rename .config/nvim/{ => lua}/tsousa/plugins/lualine.lua (83%) create mode 100644 .config/nvim/lua/tsousa/plugins/null-ls.lua rename .config/nvim/{ => lua}/tsousa/plugins/orgmode.lua (100%) create mode 100644 .config/nvim/lua/tsousa/plugins/telescope.lua create mode 100644 .config/nvim/lua/tsousa/plugins/todo-comments.lua create mode 100644 .config/nvim/lua/tsousa/plugins/treesitter.lua rename .config/nvim/{ => lua}/tsousa/plugins/undotree.lua (100%) delete mode 100644 .config/nvim/tsousa/packer.lua delete mode 100644 .config/nvim/tsousa/plugins/cmp.lua delete mode 100644 .config/nvim/tsousa/plugins/colorscheme.lua delete mode 100644 .config/nvim/tsousa/plugins/fidget.lua delete mode 100644 .config/nvim/tsousa/plugins/lspconfig.lua delete mode 100644 .config/nvim/tsousa/plugins/mason.lua delete mode 100644 .config/nvim/tsousa/plugins/null-ls.lua delete mode 100644 .config/nvim/tsousa/plugins/telescope.lua delete mode 100644 .config/nvim/tsousa/plugins/treesitter-context.lua delete mode 100644 .config/nvim/tsousa/plugins/treesitter.lua diff --git a/.config/nvim/after/plugin/cmp.lua b/.config/nvim/_after/plugin/cmp.lua similarity index 100% rename from .config/nvim/after/plugin/cmp.lua rename to .config/nvim/_after/plugin/cmp.lua diff --git a/.config/nvim/after/plugin/colorizer.lua b/.config/nvim/_after/plugin/colorizer.lua similarity index 100% rename from .config/nvim/after/plugin/colorizer.lua rename to .config/nvim/_after/plugin/colorizer.lua diff --git a/.config/nvim/after/plugin/colorscheme.lua b/.config/nvim/_after/plugin/colorscheme.lua similarity index 100% rename from .config/nvim/after/plugin/colorscheme.lua rename to .config/nvim/_after/plugin/colorscheme.lua diff --git a/.config/nvim/after/plugin/fidget.lua b/.config/nvim/_after/plugin/fidget.lua similarity index 100% rename from .config/nvim/after/plugin/fidget.lua rename to .config/nvim/_after/plugin/fidget.lua diff --git a/.config/nvim/after/plugin/fugitive.lua b/.config/nvim/_after/plugin/fugitive.lua similarity index 100% rename from .config/nvim/after/plugin/fugitive.lua rename to .config/nvim/_after/plugin/fugitive.lua diff --git a/.config/nvim/after/plugin/harpoon.lua b/.config/nvim/_after/plugin/harpoon.lua similarity index 100% rename from .config/nvim/after/plugin/harpoon.lua rename to .config/nvim/_after/plugin/harpoon.lua diff --git a/.config/nvim/after/plugin/lspconfig.lua b/.config/nvim/_after/plugin/lspconfig.lua similarity index 100% rename from .config/nvim/after/plugin/lspconfig.lua rename to .config/nvim/_after/plugin/lspconfig.lua diff --git a/.config/nvim/after/plugin/null-ls.lua b/.config/nvim/_after/plugin/null-ls.lua similarity index 100% rename from .config/nvim/after/plugin/null-ls.lua rename to .config/nvim/_after/plugin/null-ls.lua diff --git a/.config/nvim/after/plugin/orgmode.lua b/.config/nvim/_after/plugin/orgmode.lua similarity index 100% rename from .config/nvim/after/plugin/orgmode.lua rename to .config/nvim/_after/plugin/orgmode.lua diff --git a/.config/nvim/after/plugin/statusline.lua b/.config/nvim/_after/plugin/statusline.lua similarity index 100% rename from .config/nvim/after/plugin/statusline.lua rename to .config/nvim/_after/plugin/statusline.lua diff --git a/.config/nvim/after/plugin/telescope.lua b/.config/nvim/_after/plugin/telescope.lua similarity index 100% rename from .config/nvim/after/plugin/telescope.lua rename to .config/nvim/_after/plugin/telescope.lua diff --git a/.config/nvim/after/plugin/todo-comments.lua b/.config/nvim/_after/plugin/todo-comments.lua similarity index 100% rename from .config/nvim/after/plugin/todo-comments.lua rename to .config/nvim/_after/plugin/todo-comments.lua diff --git a/.config/nvim/after/plugin/treesitter-context.lua b/.config/nvim/_after/plugin/treesitter-context.lua similarity index 100% rename from .config/nvim/after/plugin/treesitter-context.lua rename to .config/nvim/_after/plugin/treesitter-context.lua diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/_after/plugin/treesitter.lua similarity index 100% rename from .config/nvim/after/plugin/treesitter.lua rename to .config/nvim/_after/plugin/treesitter.lua diff --git a/.config/nvim/after/plugin/undotree.lua b/.config/nvim/_after/plugin/undotree.lua similarity index 100% rename from .config/nvim/after/plugin/undotree.lua rename to .config/nvim/_after/plugin/undotree.lua diff --git a/.config/nvim/after/plugin/vimtex.lua b/.config/nvim/_after/plugin/vimtex.lua similarity index 100% rename from .config/nvim/after/plugin/vimtex.lua rename to .config/nvim/_after/plugin/vimtex.lua diff --git a/.config/nvim/tsousa/init.lua b/.config/nvim/_lua/tsousa/init.lua similarity index 98% rename from .config/nvim/tsousa/init.lua rename to .config/nvim/_lua/tsousa/init.lua index 2f47106..2d47913 100644 --- a/.config/nvim/tsousa/init.lua +++ b/.config/nvim/_lua/tsousa/init.lua @@ -1,4 +1,3 @@ require("tsousa.packer") require("tsousa.set") require("tsousa.remap") - diff --git a/.config/nvim/lua/tsousa/packer.lua b/.config/nvim/_lua/tsousa/packer.lua similarity index 100% rename from .config/nvim/lua/tsousa/packer.lua rename to .config/nvim/_lua/tsousa/packer.lua diff --git a/.config/nvim/tsousa/remap.lua b/.config/nvim/_lua/tsousa/remap.lua similarity index 69% rename from .config/nvim/tsousa/remap.lua rename to .config/nvim/_lua/tsousa/remap.lua index 8e0bcaa..3388279 100644 --- a/.config/nvim/tsousa/remap.lua +++ b/.config/nvim/_lua/tsousa/remap.lua @@ -23,14 +23,5 @@ vim.keymap.set("v", "d", "\"_d") -- This is going to get me cancelled vim.keymap.set("n", "Q", "") -vim.keymap.set("n", "f", function() - vim.lsp.buf.format() -end) - -vim.keymap.set("n", "", "cnextzz") -vim.keymap.set("n", "", "cprevzz") -vim.keymap.set("n", "k", "lnextzz") -vim.keymap.set("n", "j", "lprevzz") vim.keymap.set("n", "s", ":%s/\\<\\>//gI") -vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) diff --git a/.config/nvim/tsousa/set.lua b/.config/nvim/_lua/tsousa/set.lua similarity index 94% rename from .config/nvim/tsousa/set.lua rename to .config/nvim/_lua/tsousa/set.lua index 1fc6880..fc64b2c 100644 --- a/.config/nvim/tsousa/set.lua +++ b/.config/nvim/_lua/tsousa/set.lua @@ -1,3 +1,4 @@ +vim.opt.guicursor="" vim.opt.nu = true vim.opt.relativenumber = true @@ -38,4 +39,6 @@ vim.opt.updatetime = 50 -- Don't pass messages to |ins-completion-menu|. vim.opt.shortmess:append("c") +vim.opt.colorcolumn="80" + vim.g.mapleader = " " diff --git a/.config/nvim/ftplugin/java.lua b/.config/nvim/ftplugin/java.lua deleted file mode 100644 index dfecaa3..0000000 --- a/.config/nvim/ftplugin/java.lua +++ /dev/null @@ -1,6 +0,0 @@ -local config = { - cmd = { '/home/tsousa/.local/share/nvim/mason/bin/jdtls' }, - root_dir = vim.fs.dirname(vim.fs.find({ '.gradlew', '.git', 'mvnw' }, { upward = true })[1]), -} - -require('jdtls').start_or_attach(config) diff --git a/.config/nvim/ftplugin/lhaskell.lua b/.config/nvim/ftplugin/lhaskell.lua deleted file mode 100644 index 910c795..0000000 --- a/.config/nvim/ftplugin/lhaskell.lua +++ /dev/null @@ -1,4 +0,0 @@ -vim.bo.filetype = "tex" -vim.bo.syntax = "lhaskell" - - diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..725f753 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,34 @@ +{ + "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "dressing.nvim": { "branch": "master", "commit": "0e88293ce3459f4bb310125f3366304af6dc7990" }, + "fidget.nvim": { "branch": "main", "commit": "3a93300c076109d86c7ce35ec67a8034ae6ba9db" }, + "gruvbox.nvim": { "branch": "main", "commit": "4176b0b720db0c90ab4030e5c1b4893faf41fd51" }, + "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, + "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, + "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "b9084b1f42f790d6230dc66dbcb6bcc35b148552" }, + "mason.nvim": { "branch": "main", "commit": "dcd0ea30ccfc7d47e879878d1270d6847a519181" }, + "none-ls.nvim": { "branch": "main", "commit": "912f81829e9ab4ee3d54c3ea5a304c264f0003bc" }, + "nvim": { "branch": "main", "commit": "afab7ec2a79c7127627dede79c0018b6e45663d0" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" }, + "nvim-treesitter": { "branch": "master", "commit": "b4138891b3454beeb14eef171c91c92377fcd715" }, + "nvim-treesitter-context": { "branch": "master", "commit": "9c06b115abc57c99cf0aa81dc29490f5001f57a1" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" }, + "nvim-web-devicons": { "branch": "master", "commit": "b427ac5f9dff494f839e81441fb3f04a58cbcfbc" }, + "orgmode": { "branch": "master", "commit": "ab045e3084d5987e8939d25d69b09baaf762278c" }, + "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" }, + "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, + "telescope.nvim": { "branch": "master", "commit": "2f3857c25bbd00ed7ac593c9d4071906369e4d20" }, + "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, + "undotree": { "branch": "master", "commit": "d9c8b4ef872e078e8c4080812e5a3ed56d151c00" }, + "vim-fugitive": { "branch": "master", "commit": "854a8df0d06b8d3fcb30fa7f2b08c62b553eee3b" }, + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" } +} \ No newline at end of file diff --git a/.config/nvim/lua/tsousa/init.lua b/.config/nvim/lua/tsousa/init.lua index 2d47913..958c691 100644 --- a/.config/nvim/lua/tsousa/init.lua +++ b/.config/nvim/lua/tsousa/init.lua @@ -1,3 +1,34 @@ -require("tsousa.packer") require("tsousa.set") require("tsousa.remap") +require("tsousa.lazy") + +local augroup = vim.api.nvim_create_augroup +local TsousaGroup = augroup('TsousaGroup', {}) + +local autocmd = vim.api.nvim_create_autocmd +local yank_group = augroup('HighlightYank', {}) + +function R(name) + require("plenary.reload").reload_module(name) +end + +autocmd('TextYankPost', { + group = yank_group, + pattern = '*', + callback = function() + vim.highlight.on_yank({ + higroup = 'IncSearch', + timeout = 40, + }) + end, +}) + +autocmd({ "BufWritePre" }, { + group = TsousaGroup, + pattern = "*", + command = [[%s/\s\+$//e]], +}) + +vim.g.netrw_browse_split = 0 +vim.g.netrw_banner = 0 +vim.g.netrw_winsize = 25 diff --git a/.config/nvim/tsousa/lazy.lua b/.config/nvim/lua/tsousa/lazy.lua similarity index 100% rename from .config/nvim/tsousa/lazy.lua rename to .config/nvim/lua/tsousa/lazy.lua diff --git a/.config/nvim/lua/tsousa/plugins/colorscheme.lua b/.config/nvim/lua/tsousa/plugins/colorscheme.lua new file mode 100644 index 0000000..69d4bf2 --- /dev/null +++ b/.config/nvim/lua/tsousa/plugins/colorscheme.lua @@ -0,0 +1,36 @@ +return { + { + "catppuccin/nvim", + priority = 1000, + config = function() + require("catppuccin").setup({ + flavour = "macchiato", -- latte, frappe, macchiato, mocha + transparent_background = true, + term_colors = false, + integrations = { + cmp = true, + gitsigns = true, + telescope = true, + treesitter = true, + treesitter_context = true, + }, + }) + vim.cmd.colorscheme("catppuccin") + end + }, + + { + "ellisonleao/gruvbox.nvim", + config = function() + require("gruvbox").setup({ + italic = { + strings = false, + comments = true, + operators = false, + folds = true, + }, + transparent_mode = true, + }) + end + }, +} diff --git a/.config/nvim/tsousa/plugins/fugitive.lua b/.config/nvim/lua/tsousa/plugins/fugitive.lua similarity index 100% rename from .config/nvim/tsousa/plugins/fugitive.lua rename to .config/nvim/lua/tsousa/plugins/fugitive.lua diff --git a/.config/nvim/tsousa/plugins/harpoon.lua b/.config/nvim/lua/tsousa/plugins/harpoon.lua similarity index 53% rename from .config/nvim/tsousa/plugins/harpoon.lua rename to .config/nvim/lua/tsousa/plugins/harpoon.lua index 8777f00..b22c104 100644 --- a/.config/nvim/tsousa/plugins/harpoon.lua +++ b/.config/nvim/lua/tsousa/plugins/harpoon.lua @@ -7,9 +7,9 @@ return { vim.keymap.set("n", "a", mark.add_file) vim.keymap.set("n", "", ui.toggle_quick_menu) - vim.keymap.set("n", "", function() ui.nav_file(1) end) - vim.keymap.set("n", "", function() ui.nav_file(2) end) - vim.keymap.set("n", "", function() ui.nav_file(3) end) - vim.keymap.set("n", "", function() ui.nav_file(4) end) + vim.keymap.set("n", "", function() ui.nav_file(1) end) + vim.keymap.set("n", "", function() ui.nav_file(2) end) + vim.keymap.set("n", "", function() ui.nav_file(3) end) + vim.keymap.set("n", "", function() ui.nav_file(4) end) end } diff --git a/.config/nvim/tsousa/plugins/ncplugins.lua b/.config/nvim/lua/tsousa/plugins/init.lua similarity index 87% rename from .config/nvim/tsousa/plugins/ncplugins.lua rename to .config/nvim/lua/tsousa/plugins/init.lua index 3028b37..e3a8ae3 100644 --- a/.config/nvim/tsousa/plugins/ncplugins.lua +++ b/.config/nvim/lua/tsousa/plugins/init.lua @@ -5,5 +5,5 @@ return { "tpope/vim-surround", "nvim-lualine/lualine.nvim", "nvim-treesitter/playground", - "runoshun/vim-alloy", + "j-hui/fidget.nvim", } diff --git a/.config/nvim/lua/tsousa/plugins/lsp.lua b/.config/nvim/lua/tsousa/plugins/lsp.lua new file mode 100644 index 0000000..ae3dfa5 --- /dev/null +++ b/.config/nvim/lua/tsousa/plugins/lsp.lua @@ -0,0 +1,278 @@ +return { + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + 'hrsh7th/cmp-nvim-lsp', -- lsp + 'hrsh7th/cmp-nvim-lua', -- Nvim API completions + 'hrsh7th/cmp-nvim-lsp-signature-help', -- Show function signatures + 'hrsh7th/cmp-buffer', --buffer completions + 'hrsh7th/cmp-path', --path completions + 'hrsh7th/cmp-cmdline', --cmdline completions + 'L3MON4D3/LuaSnip', + }, + config = function() + local cmp_status_ok, cmp = pcall(require, "cmp") + if not cmp_status_ok then + return + end + + local snip_status_ok, luasnip = pcall(require, "luasnip") + if not snip_status_ok then + return + end + + require("luasnip/loaders/from_vscode").lazy_load() + + local check_backspace = function() + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" + end + + -- 󰃐 󰆩 󰙅 󰛡  󰅲 some other good icons + local kind_icons = { + Text = "󰉿", + Method = "m", + Function = "󰊕", + Constructor = "", + Field = "", + Variable = "󰆧", + Class = "󰌗", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "", + Folder = "󰉋", + EnumMember = "", + Constant = "󰇽", + Struct = "", + Event = "", + Operator = "󰆕", + TypeParameter = "󰊄", + } + + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = { + [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [""] = cmp.mapping { + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }, + -- Accept currently selected item. If none selected, do nothing. + [""] = cmp.mapping.confirm { select = false }, + [""] = cmp.mapping(function(fallback) + if luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end), + [""] = cmp.mapping(function(fallback) + if luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end + ), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { + "i", + "s", + }), + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + -- Kind icons + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind + vim_item.menu = ({ + nvim_lsp = "(LSP)", + luasnip = "(Snippet)", + buffer = "(Text)", + nvim_lsp_signature_help = "(Signature)", + nvim_lua = "(Nvim LSP)", + path = "(Path)", + })[entry.source.name] + return vim_item + end, + }, + sources = cmp.config.sources( + { + { + name = "nvim_lsp", + entry_filter = function(entry, context) + local kind = entry:get_kind() + local line = context.cursor_line + local col = context.cursor.col + local char_before_cursor = string.sub(line, col - 1, col - 1) + + if char_before_cursor == "." then + if kind == 2 or kind == 5 then + return true + else + return false + end + elseif string.match(line, "^%s*%w*$") then + if kind == 3 or kind == 6 then + return true + else + return false + end + end + return true + end + + }, + { name = 'nvim_lua' }, + { name = 'luasnip' }, + { name = 'nvim_lsp_signature_help' }, + { name = 'path' }, + { name = 'orgmode' } + }, + { + --This sources will only show up if there aren't any sources from the other list + { name = "buffer", keyword_length = 5 }, + } + ), + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + window = { + documentation = cmp.config.window.bordered(), + completion = cmp.config.window.bordered({ + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None" + }) + + }, + experimental = { + ghost_text = true, + native_menu = false, + }, + } + end, + }, + { + "neovim/nvim-lspconfig", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "williamboman/mason.nvim", + }, + config = function() + vim.api.nvim_create_augroup("_mason", { clear = true }) + require("mason").setup({ + PATH = "skip", + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗" + }, + }, + max_concurrent_installers = 10, + }) + + local mason_lspconfig = require "mason-lspconfig" + + mason_lspconfig.setup({ + ensure_installed = {}, + automatic_installation = true + }) + + + local opts = { noremap = true, silent = true } + vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) + vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) + + -- Use an on_attach function to only map the following keys + -- after the language server attaches to the current buffer + local on_attach = function(client, bufnr) + -- Enable completion triggered by + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local bufopts = { noremap = true, silent = true, buffer = bufnr } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) + -- vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', 'ge', function() vim.diagnostic.goto_next() end, bufopts) + vim.keymap.set('n', 'gE', function() vim.diagnostic.goto_prev() end, bufopts) + vim.keymap.set('n', 'fo', function() vim.lsp.buf.format { async = true } end, bufopts) + end + + local lspconfig = require "lspconfig" + + -- ADD NVIM CMP AS A CAPABILITY + local lsp_defaults = lspconfig.util.default_config + + local capabilities = vim.tbl_deep_extend( + 'force', + lsp_defaults.capabilities, + require('cmp_nvim_lsp').default_capabilities() + ) + + mason_lspconfig.setup_handlers { + + -- This is a default handler that will be called for each installed server (also for new servers that are installed during a session) + function(server_name) + lspconfig[server_name].setup { + on_attach = on_attach, + on_init = on_init, + flags = lsp_flags, + capabilities = capabilities, + } + end, + } + end + } +} diff --git a/.config/nvim/tsousa/plugins/lualine.lua b/.config/nvim/lua/tsousa/plugins/lualine.lua similarity index 83% rename from .config/nvim/tsousa/plugins/lualine.lua rename to .config/nvim/lua/tsousa/plugins/lualine.lua index 0f6b577..c801025 100644 --- a/.config/nvim/tsousa/plugins/lualine.lua +++ b/.config/nvim/lua/tsousa/plugins/lualine.lua @@ -2,12 +2,12 @@ return { "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, config = function() - require('lualine').setup { + require("lualine").setup({ options = { icons_enabled = true, theme = 'auto', - component_separators = { left = '', right = '' }, - section_separators = { left = '', right = '' }, + component_separators = { left = '|', right = '|' }, + section_separators = { left = '', right = '' }, disabled_filetypes = { statusline = {}, winbar = {}, @@ -25,7 +25,7 @@ return { lualine_a = { 'mode' }, lualine_b = { 'branch', 'diff', 'diagnostics' }, lualine_c = { 'filename' }, - lualine_x = { 'encoding', 'fileformat', 'filetype' }, + lualine_x = { 'encoding', 'filetype' }, lualine_y = { 'progress' }, lualine_z = { 'location' } }, @@ -41,6 +41,6 @@ return { winbar = {}, inactive_winbar = {}, extensions = {} - } + }) end } diff --git a/.config/nvim/lua/tsousa/plugins/null-ls.lua b/.config/nvim/lua/tsousa/plugins/null-ls.lua new file mode 100644 index 0000000..895f15a --- /dev/null +++ b/.config/nvim/lua/tsousa/plugins/null-ls.lua @@ -0,0 +1,17 @@ +return { + "nvimtools/none-ls.nvim", + config = function() + local null_ls = require("null-ls") + + null_ls.setup({ + sources = { + null_ls.builtins.formatting.rustfmt, + null_ls.builtins.formatting.black, + null_ls.builtins.formatting.shfmt, + null_ls.builtins.formatting.prettierd.with({ + filetypes = { "html", "json", "yaml", "markdown" }, + }), + } + }) + end +} diff --git a/.config/nvim/tsousa/plugins/orgmode.lua b/.config/nvim/lua/tsousa/plugins/orgmode.lua similarity index 100% rename from .config/nvim/tsousa/plugins/orgmode.lua rename to .config/nvim/lua/tsousa/plugins/orgmode.lua diff --git a/.config/nvim/lua/tsousa/plugins/telescope.lua b/.config/nvim/lua/tsousa/plugins/telescope.lua new file mode 100644 index 0000000..961effd --- /dev/null +++ b/.config/nvim/lua/tsousa/plugins/telescope.lua @@ -0,0 +1,14 @@ +return { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim" + }, + config = function() + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'pf', builtin.find_files, {}) + vim.keymap.set('n', 'pg', builtin.live_grep, {}) + vim.keymap.set('n', 'gf', builtin.git_files, {}) + -- vim.keymap.set('n', 'sb', builtin.buffers, {}) + vim.keymap.set('n', 'vh', builtin.help_tags, {}) + end +} diff --git a/.config/nvim/lua/tsousa/plugins/todo-comments.lua b/.config/nvim/lua/tsousa/plugins/todo-comments.lua new file mode 100644 index 0000000..f422c23 --- /dev/null +++ b/.config/nvim/lua/tsousa/plugins/todo-comments.lua @@ -0,0 +1,70 @@ +return { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("todo-comments").setup({ + signs = true, -- show icons in the signs column + sign_priority = 8, -- sign priority + -- keywords recognized as todo comments + keywords = { + FIX = { + icon = " ", -- icon used for the sign, and in search results + color = "error", -- can be a hex color, or a named color (see below) + alt = { "FIXME", "BUG", "FIXIT", "ISSUE", "fix" }, -- a set of other keywords that all map to this FIX keywords + -- signs = false, -- configure signs for some keywords individually + }, + TODO = { icon = " ", color = "info", alt = { "todo" } }, + HACK = { icon = " ", color = "warning", alt = { "hack" } }, + WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX", "warn" } }, + PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE", "perf" } }, + NOTE = { icon = " ", color = "hint", alt = { "INFO", "info", "note" } }, + TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED", "test" } }, + }, + gui_style = { + fg = "NONE", -- The gui style to use for the fg highlight group. + bg = "BOLD", -- The gui style to use for the bg highlight group. + }, + merge_keywords = true, -- when true, custom keywords will be merged with the defaults + -- highlighting of the line containing the todo comment + -- * before: highlights before the keyword (typically comment characters) + -- * keyword: highlights of the keyword + -- * after: highlights after the keyword (todo text) + highlight = { + multiline = true, -- enable multine todo comments + multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword + multiline_context = 10, -- extra lines that will be re-evaluated when changing a line + before = "", -- "fg" or "bg" or empty + keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) + after = "fg", -- "fg" or "bg" or empty + pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex) + comments_only = true, -- uses treesitter to match keywords in comments only + max_line_len = 400, -- ignore lines longer than this + exclude = {}, -- list of file types to exclude highlighting + }, + -- list of named colors where we try to extract the guifg from the + -- list of highlight groups or use the hex color if hl not found as a fallback + colors = { + error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, + warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, + info = { "DiagnosticInfo", "#2563EB" }, + hint = { "DiagnosticHint", "#10B981" }, + default = { "Identifier", "#7C3AED" }, + test = { "Identifier", "#FF00FF" } + }, + search = { + command = "rg", + args = { + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + }, + -- regex that will be used to match keywords. + -- don't replace the (KEYWORDS) placeholder + pattern = [[\b(KEYWORDS):]], -- ripgrep regex + -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives + }, + }) + end +} diff --git a/.config/nvim/lua/tsousa/plugins/treesitter.lua b/.config/nvim/lua/tsousa/plugins/treesitter.lua new file mode 100644 index 0000000..4d46483 --- /dev/null +++ b/.config/nvim/lua/tsousa/plugins/treesitter.lua @@ -0,0 +1,134 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + version = false, -- last release is way too old and doesn't work on Windows + build = ":TSUpdate", + init = function(plugin) + -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early + -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which + -- no longer trigger the **nvim-treeitter** module to be loaded in time. + -- Luckily, the only thins that those plugins need are the custom queries, which we make available + -- during startup. + require("lazy.core.loader").add_to_rtp(plugin) + require("nvim-treesitter.query_predicates") + end, + dependencies = { + { + "nvim-treesitter/nvim-treesitter-textobjects", + config = function() + -- When in diff mode, we want to use the default + -- vim text objects c & C instead of the treesitter ones. + local move = require("nvim-treesitter.textobjects.move") ---@type table + local configs = require("nvim-treesitter.configs") + for name, fn in pairs(move) do + if name:find("goto") == 1 then + move[name] = function(q, ...) + if vim.wo.diff then + local config = configs.get_module("textobjects.move") + [name] ---@type table + for key, query in pairs(config or {}) do + if q == query and key:find("[%]%[][cC]") then + vim.cmd("normal! " .. key) + return + end + end + end + return fn(q, ...) + end + end + end + end, + }, + }, + cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, + opts = { + highlight = { enable = true }, + indent = { enable = true }, + ensure_installed = { + "bash", + "c", + "diff", + "html", + "javascript", + "jsdoc", + "json", + "jsonc", + "lua", + "luadoc", + "luap", + "markdown", + "markdown_inline", + "python", + "regex", + "toml", + "vim", + "vimdoc", + "yaml", + "org", + "dockerfile", + "go", + "haskell", + "rust", + }, + textobjects = { + move = { + enable = true, + goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" }, + goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" }, + goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" }, + goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" }, + }, + }, + }, + config = function(_, opts) + if type(opts.ensure_installed) == "table" then + local added = {} + opts.ensure_installed = vim.tbl_filter(function(lang) + if added[lang] then + return false + end + added[lang] = true + return true + end, opts.ensure_installed) + end + require("nvim-treesitter.configs").setup(opts) + end, + }, + { + "romgrk/nvim-treesitter-context", + config = function() + require("treesitter-context").setup({ + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + throttle = true, -- Throttles plugin updates (may improve performance) + max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + show_all_context = false, + patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. + -- For all filetypes + -- Note that setting an entry here replaces all other patterns for this entry. + -- By setting the 'default' entry below, you can control which nodes you want to + -- appear in the context window. + default = { + "function", + "method", + "for", + "while", + "if", + "switch", + "case", + }, + + rust = { + "loop_expression", + "impl_item", + }, + + typescript = { + "class_declaration", + "abstract_class_declaration", + "else_clause", + }, + }, + }) + end + } +} diff --git a/.config/nvim/tsousa/plugins/undotree.lua b/.config/nvim/lua/tsousa/plugins/undotree.lua similarity index 100% rename from .config/nvim/tsousa/plugins/undotree.lua rename to .config/nvim/lua/tsousa/plugins/undotree.lua diff --git a/.config/nvim/lua/tsousa/remap.lua b/.config/nvim/lua/tsousa/remap.lua index 3388279..60c8fde 100644 --- a/.config/nvim/lua/tsousa/remap.lua +++ b/.config/nvim/lua/tsousa/remap.lua @@ -25,3 +25,4 @@ vim.keymap.set("v", "d", "\"_d") vim.keymap.set("n", "Q", "") vim.keymap.set("n", "s", ":%s/\\<\\>//gI") + diff --git a/.config/nvim/lua/tsousa/set.lua b/.config/nvim/lua/tsousa/set.lua index fc64b2c..c167b8c 100644 --- a/.config/nvim/lua/tsousa/set.lua +++ b/.config/nvim/lua/tsousa/set.lua @@ -18,7 +18,7 @@ vim.opt.swapfile = false vim.opt.backup = false vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" vim.opt.undofile = true -vim.opt.showmode = false +vim.opt.showmode = false vim.opt.hlsearch = false vim.opt.incsearch = true @@ -42,3 +42,4 @@ vim.opt.shortmess:append("c") vim.opt.colorcolumn="80" vim.g.mapleader = " " + diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua index bfae29f..d8de6f4 100644 --- a/.config/nvim/plugin/packer_compiled.lua +++ b/.config/nvim/plugin/packer_compiled.lua @@ -49,8 +49,8 @@ local function save_profiles(threshold) end time([[Luarocks path setup]], true) -local package_path_str = "/home/tsousa/.cache/nvim/packer_hererocks/2.1.1699392533/share/lua/5.1/?.lua;/home/tsousa/.cache/nvim/packer_hererocks/2.1.1699392533/share/lua/5.1/?/init.lua;/home/tsousa/.cache/nvim/packer_hererocks/2.1.1699392533/lib/luarocks/rocks-5.1/?.lua;/home/tsousa/.cache/nvim/packer_hererocks/2.1.1699392533/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/home/tsousa/.cache/nvim/packer_hererocks/2.1.1699392533/lib/lua/5.1/?.so" +local package_path_str = "/home/tsousa/.cache/nvim/packer_hererocks/2.1.1702233742/share/lua/5.1/?.lua;/home/tsousa/.cache/nvim/packer_hererocks/2.1.1702233742/share/lua/5.1/?/init.lua;/home/tsousa/.cache/nvim/packer_hererocks/2.1.1702233742/lib/luarocks/rocks-5.1/?.lua;/home/tsousa/.cache/nvim/packer_hererocks/2.1.1702233742/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/tsousa/.cache/nvim/packer_hererocks/2.1.1702233742/lib/lua/5.1/?.so" if not string.find(package.path, package_path_str, 1, true) then package.path = package.path .. ';' .. package_path_str end @@ -224,6 +224,11 @@ _G.packer_plugins = { path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/telescope.nvim", url = "https://github.com/nvim-telescope/telescope.nvim" }, + ["todo-comments.nvim"] = { + loaded = true, + path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/todo-comments.nvim", + url = "https://github.com/folke/todo-comments.nvim" + }, undotree = { loaded = true, path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/undotree", diff --git a/.config/nvim/tsousa/packer.lua b/.config/nvim/tsousa/packer.lua deleted file mode 100644 index 62d2fc4..0000000 --- a/.config/nvim/tsousa/packer.lua +++ /dev/null @@ -1,49 +0,0 @@ -return require('packer').startup(function(use) - -- Packer can manage itself - use("nvim-lua/plenary.nvim") - use("nvim-lua/popup.nvim") - use("nvim-telescope/telescope.nvim") - use("tpope/vim-surround") - use("stevearc/dressing.nvim") - use("mbbill/undotree") - - -- fidget change when rewrite version comes out - use { - 'j-hui/fidget.nvim', - tag = 'legacy', - config = function() - require("fidget").setup { - -- options - } - end, - } - - use("norcalli/nvim-colorizer.lua") - - use("lervag/vimtex") - - - use("williamboman/mason.nvim") - use("williamboman/mason-lspconfig.nvim") - use("hrsh7th/cmp-nvim-lsp") - use("neovim/nvim-lspconfig") - use("mfussenegger/nvim-jdtls") - use("jose-elias-alvarez/null-ls.nvim") - use({ - "L3MON4D3/LuaSnip", - requires = { - "saadparwaiz1/cmp_luasnip" - }, - }) - - use("nvim-treesitter/nvim-treesitter", { - run = ":TSUpdate" - }) - - use("nvim-treesitter/playground") - use("romgrk/nvim-treesitter-context") - - -- Colorscheme section - use("catppuccin/nvim") - use("ellisonleao/gruvbox.nvim") -end) diff --git a/.config/nvim/tsousa/plugins/cmp.lua b/.config/nvim/tsousa/plugins/cmp.lua deleted file mode 100644 index d2759e3..0000000 --- a/.config/nvim/tsousa/plugins/cmp.lua +++ /dev/null @@ -1,199 +0,0 @@ -return { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - 'hrsh7th/cmp-nvim-lsp', -- lsp - 'hrsh7th/cmp-nvim-lua', -- Nvim API completions - 'hrsh7th/cmp-nvim-lsp-signature-help', -- Show function signatures - 'hrsh7th/cmp-buffer', --buffer completions - 'hrsh7th/cmp-path', --path completions - 'hrsh7th/cmp-cmdline', --cmdline completions - 'L3MON4D3/LuaSnip', - 'rafamadriz/friendly-snippets', - 'saadparwaiz1/cmp_luasnip', - }, - config = function() - local cmp_status_ok, cmp = pcall(require, "cmp") - if not cmp_status_ok then - return - end - - local snip_status_ok, luasnip = pcall(require, "luasnip") - if not snip_status_ok then - return - end - - require("luasnip/loaders/from_vscode").lazy_load() - - local check_backspace = function() - local col = vim.fn.col "." - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" - end - - -- 󰃐 󰆩 󰙅 󰛡  󰅲 some other good icons - local kind_icons = { - Text = "󰉿", - Method = "m", - Function = "󰊕", - Constructor = "", - Field = "", - Variable = "󰆧", - Class = "󰌗", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "󰎠", - Enum = "", - Keyword = "󰌋", - Snippet = "", - Color = "󰏘", - File = "󰈙", - Reference = "", - Folder = "󰉋", - EnumMember = "", - Constant = "󰇽", - Struct = "", - Event = "", - Operator = "󰆕", - TypeParameter = "󰊄", - } - -- FIND MORE HERE: HTTPS://WWW.NERDFONTS.COM/CHEAT-SHEET - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) -- For `luasnip` users. - end, - }, - mapping = { - [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. - [""] = cmp.mapping { - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }, - -- Accept currently selected item. If none selected, do nothing. - [""] = cmp.mapping.confirm { select = false }, - [""] = cmp.mapping(function(fallback) - if luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif check_backspace() then - fallback() - else - fallback() - end - end), - [""] = cmp.mapping(function(fallback) - if luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end - ), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, { - "i", - "s", - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, { - "i", - "s", - }), - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - -- Kind icons - vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) - -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind - vim_item.menu = ({ - nvim_lsp = "(LSP)", - luasnip = "(Snippet)", - buffer = "(Text)", - nvim_lsp_signature_help = "(Signature)", - nvim_lua = "(Nvim LSP)", - path = "(Path)", - })[entry.source.name] - return vim_item - end, - }, - sorting = { - comparators = { - cmp.config.compare.exact, - cmp.config.compare.offset, - cmp.config.compare.recently_used, - } - }, - sources = cmp.config.sources( - { - { - name = "nvim_lsp", - entry_filter = function(entry, context) - local kind = entry:get_kind() - local line = context.cursor_line - local col = context.cursor.col - local char_before_cursor = string.sub(line, col - 1, col - 1) - - if char_before_cursor == "." then - if kind == 2 or kind == 5 then - return true - else - return false - end - elseif string.match(line, "^%s*%w*$") then - if kind == 3 or kind == 6 then - return true - else - return false - end - end - return true - end - - }, - { name = 'nvim_lua' }, - { name = 'luasnip' }, - { name = 'nvim_lsp_signature_help' }, - { name = 'path' }, - { name = 'orgmode' } - }, - { - --This sources will only show up if there aren't any sources from the other list - { name = "buffer", keyword_length = 5 }, - } - ), - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - window = { - documentation = cmp.config.window.bordered(), - completion = cmp.config.window.bordered({ - winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None" - }) - - }, - experimental = { - ghost_text = true, - native_menu = false, - }, - } - end, -} diff --git a/.config/nvim/tsousa/plugins/colorscheme.lua b/.config/nvim/tsousa/plugins/colorscheme.lua deleted file mode 100644 index 4614ad6..0000000 --- a/.config/nvim/tsousa/plugins/colorscheme.lua +++ /dev/null @@ -1,54 +0,0 @@ -require("catppuccin").setup({ - flavour = "macchiato", -- latte, frappe, macchiato, mocha - transparent_background = false, - term_colors = false, - - no_italic = false, -- Force no italic - no_bold = false, -- Force no bold - styles = { - comments = {"italic"}, - conditionals = {"italic"}, - loops = {}, - functions = {}, - keywords = {}, - strings = {}, - variables = {}, - numbers = {}, - booleans = {}, - properties = {}, - types = {}, - operators = {}, - }, - integrations = { - cmp = true, - gitsigns = true, - telescope = true, - }, -}) - -require("gruvbox").setup({ - undercurl = true, - underline = true, - bold = true, - italic = { - strings = false, - comments = true, - operators = false, - folds = true, - }, - strikethrough = true, - invert_selection = false, - invert_signs = false, - invert_tabline = false, - invert_intend_guides = false, - inverse = true, -- invert background for search, diffs, statuslines and errors - contrast = "", -- can be "hard", "soft" or empty string - palette_overrides = {}, - overrides = {}, - dim_inactive = false, - transparent_mode = false, -}) - -vim.o.background = "dark" -vim.cmd.colorscheme("catppuccin") - diff --git a/.config/nvim/tsousa/plugins/fidget.lua b/.config/nvim/tsousa/plugins/fidget.lua deleted file mode 100644 index 32e8b71..0000000 --- a/.config/nvim/tsousa/plugins/fidget.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - "j-hui/fidget.nvim", - config = true -} diff --git a/.config/nvim/tsousa/plugins/lspconfig.lua b/.config/nvim/tsousa/plugins/lspconfig.lua deleted file mode 100644 index c917295..0000000 --- a/.config/nvim/tsousa/plugins/lspconfig.lua +++ /dev/null @@ -1,72 +0,0 @@ -return { - "neovim/nvim-lspconfig", - dependencies = "williamboman/mason-lspconfig.nvim", - config = function() - local mason_lspconfig = require "mason-lspconfig" - - mason_lspconfig.setup({ - ensure_installed = {}, - automatic_installation = true - }) - - - local opts = { noremap = true, silent = true } - vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) - vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) - vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) - vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) - - -- Use an on_attach function to only map the following keys - -- after the language server attaches to the current buffer - local on_attach = function(client, bufnr) - -- Enable completion triggered by - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - -- vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'ge', function() vim.diagnostic.goto_next() end, bufopts) - vim.keymap.set('n', 'gE', function() vim.diagnostic.goto_prev() end, bufopts) - vim.keymap.set('n', 'fo', function() vim.lsp.buf.format { async = true } end, bufopts) - end - - local lspconfig = require "lspconfig" - - -- ADD NVIM CMP AS A CAPABILITY - local lsp_defaults = lspconfig.util.default_config - - local capabilities = vim.tbl_deep_extend( - 'force', - lsp_defaults.capabilities, - require('cmp_nvim_lsp').default_capabilities() - ) - - - mason_lspconfig.setup_handlers { - - -- This is a default handler that will be called for each installed server (also for new servers that are installed during a session) - function(server_name) - lspconfig[server_name].setup { - on_attach = on_attach, - on_init = on_init, - flags = lsp_flags, - capabilities = capabilities, - } - end, - } - end -} diff --git a/.config/nvim/tsousa/plugins/mason.lua b/.config/nvim/tsousa/plugins/mason.lua deleted file mode 100644 index 2eddcf1..0000000 --- a/.config/nvim/tsousa/plugins/mason.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - "williamboman/mason.nvim", - config = function() - local present, mason = pcall(require, "mason") - vim.api.nvim_create_augroup("_mason", { clear = true }) - options = { - PATH = "skip", - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗" - }, - }, - max_concurrent_installers = 10, - } - mason.setup(options) - end -} diff --git a/.config/nvim/tsousa/plugins/null-ls.lua b/.config/nvim/tsousa/plugins/null-ls.lua deleted file mode 100644 index 54db889..0000000 --- a/.config/nvim/tsousa/plugins/null-ls.lua +++ /dev/null @@ -1,12 +0,0 @@ -local null_ls = require("null-ls") - -null_ls.setup({ - sources = { - null_ls.builtins.formatting.rustfmt, - null_ls.builtins.formatting.black, - null_ls.builtins.formatting.shfmt, - null_ls.builtins.formatting.prettierd.with({ - filetypes = { "html", "json", "yaml", "markdown" }, - }), - } -}) diff --git a/.config/nvim/tsousa/plugins/telescope.lua b/.config/nvim/tsousa/plugins/telescope.lua deleted file mode 100644 index d4f1f71..0000000 --- a/.config/nvim/tsousa/plugins/telescope.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - "nvim-telescope/telescope.nvim", - dependencies = { - "nvim-lua/plenary.nvim" - }, - config = function() - local builtin = require('telescope.builtin') - vim.keymap.set('n', 'sf', builtin.find_files, {}) - vim.keymap.set('n', 'sg', builtin.live_grep, {}) - vim.keymap.set('n', 'sb', builtin.buffers, {}) - vim.keymap.set('n', 'sh', builtin.help_tags, {}) - end -} diff --git a/.config/nvim/tsousa/plugins/treesitter-context.lua b/.config/nvim/tsousa/plugins/treesitter-context.lua deleted file mode 100644 index 0f4d23d..0000000 --- a/.config/nvim/tsousa/plugins/treesitter-context.lua +++ /dev/null @@ -1,37 +0,0 @@ -return { - "romgrk/nvim-treesitter-context", - config = function() - require("treesitter-context").setup({ - enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) - throttle = true, -- Throttles plugin updates (may improve performance) - max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. - show_all_context = false, - patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. - -- For all filetypes - -- Note that setting an entry here replaces all other patterns for this entry. - -- By setting the 'default' entry below, you can control which nodes you want to - -- appear in the context window. - default = { - "function", - "method", - "for", - "while", - "if", - "switch", - "case", - }, - - rust = { - "loop_expression", - "impl_item", - }, - - typescript = { - "class_declaration", - "abstract_class_declaration", - "else_clause", - }, - }, - }) - end -} diff --git a/.config/nvim/tsousa/plugins/treesitter.lua b/.config/nvim/tsousa/plugins/treesitter.lua deleted file mode 100644 index 9fc225b..0000000 --- a/.config/nvim/tsousa/plugins/treesitter.lua +++ /dev/null @@ -1,112 +0,0 @@ -return { - "nvim-treesitter/nvim-treesitter", - version = false, -- last release is way too old and doesn't work on Windows - build = ":TSUpdate", - event = { "LazyFile", "VeryLazy" }, - init = function(plugin) - -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early - -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which - -- no longer trigger the **nvim-treeitter** module to be loaded in time. - -- Luckily, the only thins that those plugins need are the custom queries, which we make available - -- during startup. - require("lazy.core.loader").add_to_rtp(plugin) - require("nvim-treesitter.query_predicates") - end, - dependencies = { - { - "nvim-treesitter/nvim-treesitter-textobjects", - config = function() - -- When in diff mode, we want to use the default - -- vim text objects c & C instead of the treesitter ones. - local move = require("nvim-treesitter.textobjects.move") ---@type table - local configs = require("nvim-treesitter.configs") - for name, fn in pairs(move) do - if name:find("goto") == 1 then - move[name] = function(q, ...) - if vim.wo.diff then - local config = configs.get_module("textobjects.move")[name] ---@type table - for key, query in pairs(config or {}) do - if q == query and key:find("[%]%[][cC]") then - vim.cmd("normal! " .. key) - return - end - end - end - return fn(q, ...) - end - end - end - end, - }, - }, - cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, - keys = { - { "", desc = "Increment selection" }, - { "", desc = "Decrement selection", mode = "x" }, - }, - ---@type TSConfig - ---@diagnostic disable-next-line: missing-fields - opts = { - highlight = { enable = true }, - indent = { enable = true }, - ensure_installed = { - "bash", - "c", - "diff", - "html", - "javascript", - "jsdoc", - "json", - "jsonc", - "lua", - "luadoc", - "luap", - "markdown", - "markdown_inline", - "python", - "regex", - "toml", - "vim", - "vimdoc", - "yaml", - "org", - "dockerfile", - "go", - "haskell", - "rust", - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - textobjects = { - move = { - enable = true, - goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer" }, - goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer" }, - goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer" }, - goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer" }, - }, - }, - }, - ---@param opts TSConfig - config = function(_, opts) - if type(opts.ensure_installed) == "table" then - ---@type table - local added = {} - opts.ensure_installed = vim.tbl_filter(function(lang) - if added[lang] then - return false - end - added[lang] = true - return true - end, opts.ensure_installed) - end - require("nvim-treesitter.configs").setup(opts) - end, -}