From 7b821a02d359a744ddaf48e2508da324e0c7bf65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0mundur=20Bjarki=20Sigur=C3=B0sson?= Date: Fri, 29 Mar 2024 03:07:42 +0000 Subject: [PATCH] add many plugins --- lua/custom/plugins/autopairs.lua | 5 +++ lua/custom/plugins/codeium.lua | 7 ++++ lua/custom/plugins/conform.lua | 3 +- lua/custom/plugins/flash.lua | 15 ++++++++ lua/custom/plugins/harpoon2.lua | 61 ++++++++++++++++++++++++++++++++ lua/custom/plugins/lint.lua | 1 + lua/custom/plugins/lspconfig.lua | 17 ++++++++- lua/custom/plugins/lualines.lua | 20 +++++++++++ lua/custom/plugins/mini.lua | 11 +++--- lua/custom/plugins/none-ls.lua | 14 ++++++++ lua/custom/plugins/nvim-cmp.lua | 10 +++++- 11 files changed, 156 insertions(+), 8 deletions(-) create mode 100644 lua/custom/plugins/autopairs.lua create mode 100644 lua/custom/plugins/codeium.lua create mode 100644 lua/custom/plugins/flash.lua create mode 100644 lua/custom/plugins/harpoon2.lua create mode 100644 lua/custom/plugins/lualines.lua create mode 100644 lua/custom/plugins/none-ls.lua diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 00000000..39fbce8b --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,5 @@ +return { + enable = false, + 'windwp/nvim-autopairs', + -- Optional dependency +} diff --git a/lua/custom/plugins/codeium.lua b/lua/custom/plugins/codeium.lua new file mode 100644 index 00000000..432a35e2 --- /dev/null +++ b/lua/custom/plugins/codeium.lua @@ -0,0 +1,7 @@ +return { + 'Exafunction/codeium.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + opts = {}, +} diff --git a/lua/custom/plugins/conform.lua b/lua/custom/plugins/conform.lua index 86ab6687..31cbffd8 100644 --- a/lua/custom/plugins/conform.lua +++ b/lua/custom/plugins/conform.lua @@ -1,4 +1,5 @@ return { -- Autoformat + enable = false, 'stevearc/conform.nvim', opts = { notify_on_error = false, @@ -15,7 +16,7 @@ return { -- Autoformat formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially - python = { "isort", "black" }, + python = { 'black' }, -- -- You can use a sub-list to tell conform to run *until* a formatter -- is found. diff --git a/lua/custom/plugins/flash.lua b/lua/custom/plugins/flash.lua new file mode 100644 index 00000000..94e9f169 --- /dev/null +++ b/lua/custom/plugins/flash.lua @@ -0,0 +1,15 @@ +return { + 'folke/flash.nvim', + event = 'VeryLazy', + vscode = true, + ---@type Flash.Config + opts = {}, + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, +} diff --git a/lua/custom/plugins/harpoon2.lua b/lua/custom/plugins/harpoon2.lua new file mode 100644 index 00000000..9d0e22e5 --- /dev/null +++ b/lua/custom/plugins/harpoon2.lua @@ -0,0 +1,61 @@ +return { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + opts = { + menu = { + width = vim.api.nvim_win_get_width(0) - 4, + }, + }, + keys = { + { + 'H', + function() + require('harpoon'):list():append() + end, + desc = 'Harpoon File', + }, + { + 'h', + function() + local harpoon = require 'harpoon' + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, + desc = 'Harpoon Quick Menu', + }, + { + '1', + function() + require('harpoon'):list():select(1) + end, + desc = 'Harpoon to File 1', + }, + { + '2', + function() + require('harpoon'):list():select(2) + end, + desc = 'Harpoon to File 2', + }, + { + '3', + function() + require('harpoon'):list():select(3) + end, + desc = 'Harpoon to File 3', + }, + { + '4', + function() + require('harpoon'):list():select(4) + end, + desc = 'Harpoon to File 4', + }, + { + '5', + function() + require('harpoon'):list():select(5) + end, + desc = 'Harpoon to File 5', + }, + }, +} diff --git a/lua/custom/plugins/lint.lua b/lua/custom/plugins/lint.lua index 7f0dc42f..98f3de8d 100644 --- a/lua/custom/plugins/lint.lua +++ b/lua/custom/plugins/lint.lua @@ -7,6 +7,7 @@ return { local lint = require 'lint' lint.linters_by_ft = { markdown = { 'markdownlint' }, + python = { 'ruff' }, } -- To allow other plugins to add linters to require('lint').linters_by_ft, diff --git a/lua/custom/plugins/lspconfig.lua b/lua/custom/plugins/lspconfig.lua index 5a97b49f..a3d3bb12 100644 --- a/lua/custom/plugins/lspconfig.lua +++ b/lua/custom/plugins/lspconfig.lua @@ -73,6 +73,9 @@ return { -- LSP Configuration & Plugins -- the definition of its *type*, not where it was *defined*. map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + -- Show signature help + -- vim.keymap.set('i', '', require 'telescope.builtin', { buffer = event.buf, desc = 'LSP: signature help' }) + -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') @@ -136,7 +139,19 @@ return { -- LSP Configuration & Plugins local servers = { -- clangd = {}, -- gopls = {}, - pyright = {}, + pyright = { + settings = { + python = { + analysis = { + useLibraryCodeForTypes = true, + diagnosticSeverityOverrides = { + reportUnusedVariable = 'warning', -- or anything + }, + typeCheckingMode = 'off', + }, + }, + }, + }, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- diff --git a/lua/custom/plugins/lualines.lua b/lua/custom/plugins/lualines.lua new file mode 100644 index 00000000..5689cc2a --- /dev/null +++ b/lua/custom/plugins/lualines.lua @@ -0,0 +1,20 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + opts = { + options = { theme = 'gruvbox_dark' }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { + 'filename', + function() + return vim.fn['nvim_treesitter#statusline'](180) + end, + }, + lualine_x = { 'encoding', 'fileformat', 'filetype' }, + lualine_y = { 'progress' }, + lualine_z = { 'location' }, + }, + }, +} diff --git a/lua/custom/plugins/mini.lua b/lua/custom/plugins/mini.lua index 5e7f743d..f1621646 100644 --- a/lua/custom/plugins/mini.lua +++ b/lua/custom/plugins/mini.lua @@ -16,20 +16,21 @@ return { -- Collection of various small independent plugins/modules -- - sr)' - [S]urround [R]eplace [)] ['] require('mini.surround').setup() + require('mini.pairs').setup() -- Simple and easy statusline. -- You could remove this setup call if you don't like it, -- and try some other statusline plugin - local statusline = require 'mini.statusline' + --local statusline = require 'mini.statusline' -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } + -- statusline.setup { use_icons = vim.g.have_nerd_font } -- You can configure sections in the statusline by overriding their -- default behavior. For example, here we set the section for -- cursor location to LINE:COLUMN ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() - return '%2l:%-2v' - end + --statusline.section_location = function() + -- return '%2l:%-2v' + --end -- ... and there is more! -- Check out: https://github.com/echasnovski/mini.nvim diff --git a/lua/custom/plugins/none-ls.lua b/lua/custom/plugins/none-ls.lua new file mode 100644 index 00000000..c630b352 --- /dev/null +++ b/lua/custom/plugins/none-ls.lua @@ -0,0 +1,14 @@ +return { + 'nvimtools/none-ls.nvim', + config = function() + local null_ls = require 'null-ls' + + null_ls.setup { + sources = { + null_ls.builtins.formatting.black, + null_ls.builtins.diagnostics.mypy, + null_ls.builtins.formatting.ruff, + }, + } + end, +} diff --git a/lua/custom/plugins/nvim-cmp.lua b/lua/custom/plugins/nvim-cmp.lua index 89c21a24..4d3ec949 100644 --- a/lua/custom/plugins/nvim-cmp.lua +++ b/lua/custom/plugins/nvim-cmp.lua @@ -33,6 +33,12 @@ return { -- Autocompletion -- into multiple repos for maintenance purposes. 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', + { + 'Exafunction/codeium.nvim', + cmd = 'Codeium', + build = ':Codeium Auth', + opts = {}, + }, }, config = function() -- See `:help cmp` @@ -65,7 +71,8 @@ return { -- Autocompletion -- Accept ([y]es) the completion. -- This will auto-import if your LSP supports it. -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, + + [''] = cmp.mapping.confirm { select = true }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display @@ -98,6 +105,7 @@ return { -- Autocompletion { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, + { name = 'codeium' }, }, } end,