diff options
Diffstat (limited to '.config/nvim/lua/plugins')
| -rw-r--r-- | .config/nvim/lua/plugins/catppuccin.lua | 19 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/cmp.lua | 95 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/editor.lua | 4 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/git.lua | 27 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lsp.lua | 64 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/telescope.lua | 17 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/treesitter.lua | 35 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/which-key.lua | 9 |
8 files changed, 270 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/catppuccin.lua b/.config/nvim/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..155f929 --- /dev/null +++ b/.config/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,19 @@ +return { + { "jpe90/export-colorscheme.nvim", name = "export-colorscheme.nvim" }, + { "kepano/flexoki-neovim", name = "flexoki" }, + { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + config = function() + require("catppuccin").setup({ + flavour = "mocha", + integrations = { + neogit = true, + which_key = true, + }, + }) + vim.cmd.colorscheme("catppuccin") + end, + }, +} diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..fc897eb --- /dev/null +++ b/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,95 @@ +return { + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "nvim-lua/plenary.nvim", + "hrsh7th/cmp-nvim-lsp", + "saadparwaiz1/cmp_luasnip", + { + "L3MON4D3/LuaSnip", + dependencies = { "rafamadriz/friendly-snippets" }, + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + }, + event = "InsertEnter", + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + + cmp.setup({ + mapping = cmp.mapping.preset.insert({ + ["<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 }), + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + ["<S-Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end + }, + sources = cmp.config.sources({ + { name = "luasnip" }, + { name = "nvim_lsp" }, + { name = "path" }, + }, { + { name = "buffer" }, + }), + }) + end, + }, + { + "hrsh7th/cmp-cmdline", + dependencies = { + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, + event = "CmdlineEnter", + config = function() + local cmp = require("cmp") + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "buffer" }, + }), + }) + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { + name = "cmdline", + option = { + ignore_cmds = { "Man", "!" }, + }, + }, + }) + }) + end, + }, +} diff --git a/.config/nvim/lua/plugins/editor.lua b/.config/nvim/lua/plugins/editor.lua new file mode 100644 index 0000000..7004143 --- /dev/null +++ b/.config/nvim/lua/plugins/editor.lua @@ -0,0 +1,4 @@ +return { + { "ap/vim-buftabline", event = "VeryLazy" }, + { "kylechui/nvim-surround", event = "VeryLazy", opts = {} }, +} diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..a435df7 --- /dev/null +++ b/.config/nvim/lua/plugins/git.lua @@ -0,0 +1,27 @@ +return { + { + "sindrets/diffview.nvim", + cmd = { + "DiffviewLog", + "DiffviewOpen", + "DiffviewClose", + "DiffviewRefresh", + "DiffviewFocusFiles", + "DiffviewFileHistory", + "DiffviewToggleFiles", + }, + }, + { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + }, + cmd = "Neogit", + opts = { + integrations = { + diffview = true, + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..7a67265 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,64 @@ +return { + { + "neovim/nvim-lspconfig", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + }, + event = { "BufReadPre", "BufNewFile" }, + config = function() + local lspconfig = require("lspconfig") + local capabilities = require("cmp_nvim_lsp").default_capabilities() + local common = { + capabilities = capabilities, + } + + local lsps = { + "gopls", + "lua_ls", + "pylsp", + "ts_ls", + "cssls", + "html", + } + + for _, lsp in ipairs(lsps) do + lspconfig[lsp].setup(common) + end + + local wk = require("which-key") + wk.register({ + { "[d", vim.diagnostic.goto_prev, desc = "Previous diagnostic" }, + { "]d", vim.diagnostic.goto_next, desc = "Next diagnostic" }, + }) + + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + wk.register({ + { "gD", vim.lsp.buf.declaration, desc = "Go to declaration" }, + { "gd", vim.lsp.buf.definition, desc = "Go to definition" }, + { "gr", vim.lsp.buf.references, desc = "Go to references" }, + { "gi", vim.lsp.buf.implementation, desc = "Go to implementation" }, + { "K", vim.lsp.buf.hover, desc = "Show LSP hover info" }, + { "<C-k>", vim.lsp.buf.signature_help, desc = "Show signature help" }, + { "<leader>D", vim.lsp.buf.type_definition, desc = "Type definition" }, + { "<leader>rn", vim.lsp.buf.rename, desc = "Rename" }, + { "<leader>ca", vim.lsp.buf.code_action, desc = "Code action" }, + { "<leader>F", function() vim.lsp.buf.format({ async = true }) end, desc = "Format buffer" }, + ["<leader>w"] = { + name = "+LSP workspace", + a = { vim.lsp.buf.add_workspace_folder, "Add workspace folder" }, + r = { vim.lsp.buf.remove_workspace_folder, "Remove workspace folder" }, + l = { + function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, + "List workspace folders", + }, + }, + }, {buffer=ev.buf}) + end, + }) + end, + }, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..8dfcce3 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,17 @@ +return { + { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + }, + keys = { + { "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find files" }, + { "<leader>fF", "<cmd>Telescope git_files<cr>", desc = "Find git files" }, + { "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live grep" }, + { "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Find buffers" }, + { "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help tags" }, + }, + cmd = "Telescope", + }, +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..fe48d9f --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,35 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("nvim-treesitter.configs").setup({ + auto_install = true, + ensure_installed = { + "bash", + "clojure", + "css", + "html", + "ini", + "javascript", + "json", + "kotlin", + "lua", + "markdown", + "perl", + "python", + "regex", + "rust", + "scss", + "sql", + "svelte", + "toml", + "tsx", + "typescript", + "yaml", + }, + highlight = { enable = true }, + }) + end, + }, +} diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..f636915 --- /dev/null +++ b/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,9 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + config = function() + require("which-key").register({ + { "<leader>f", group = "Telescope" }, + }) + end, +} |
