From 55c959d4dabdbbf637d4190b6da58e9041d57a82 Mon Sep 17 00:00:00 2001 From: pc Date: Thu, 27 Jun 2024 13:43:59 -0500 Subject: [PATCH] add plugins --- init.lua | 114 +++++++++++++++++++++++++---- lua/kickstart/plugins/neo-tree.lua | 2 +- 2 files changed, 101 insertions(+), 15 deletions(-) diff --git a/init.lua b/init.lua index 88658ef3..18939e4f 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,6 @@ --[[ -===================================================================== +=================================================================== ==================== READ THIS BEFORE CONTINUING ==================== ===================================================================== ======== .-----. ======== @@ -160,19 +160,17 @@ vim.opt.scrolloff = 10 -- Set highlight on search, but clear on pressing in normal mode vim.opt.hlsearch = true vim.keymap.set('n', '', 'nohlsearch') - -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) - -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- for people to discover. Otherwise, you normally need to press , which -- is not what someone will guess without a bit more experience. -- -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping --- or just use to exit terminal mode +-- or just use to exit terminal modej vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode @@ -237,8 +235,93 @@ require('lazy').setup({ -- This is equivalent to: -- require('Comment').setup({}) + -- { 'nvim-tree/nvim-web-devicons', lazy = true, enabled = true, opts = { + -- enabled = true, + -- } }, + -- "gc" to comment visual regions/lines { 'numToStr/Comment.nvim', opts = {} }, + -- + -- Copilot plugin + { + 'zbirenbaum/copilot.lua', + opts = { suggestion = { enabled = false }, panel = { enabled = false } }, + cmd = 'Copilot', + event = 'InsertEnter', + build = ':Copilot auth', + }, + { + 'zbirenbaum/copilot-cmp', + config = function() + require('copilot_cmp').setup() + end, + }, + + -- autopairs plugin + { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = true, + opts = {}, + -- use opts = {} for passing setup options + -- this is equalent to setup({}) function + }, + -- auto closing tags + { + 'windwp/nvim-ts-autotag', + opts = { + enable_close = true, + enable_rename = true, + enable_close_on_slash = true, + }, + }, + + { + 'nvim-neo-tree/neo-tree.nvim', + branch = 'v3.x', + dependencies = { + 'nvim-lua/plenary.nvim', + { 'nvim-tree/nvim-web-devicons', enabled = true, opts = { enabled = true } }, + -- not strictly required, but recommended + 'MunifTanjim/nui.nvim', + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + }, + keys = { + { + 'fe', + function() + require('neo-tree.command').execute { toggle = true, dir = vim.fn.getcwd() } + end, + desc = 'Explorer NeoTree (Root Dir)', + }, + { + 'fE', + function() + require('neo-tree.command').execute { toggle = true, dir = vim.uv.cwd() } + end, + desc = 'Explorer NeoTree (cwd)', + }, + { 'e', 'fe', desc = 'Explorer NeoTree (Root Dir)', remap = true }, + { 'E', 'fE', desc = 'Explorer NeoTree (cwd)', remap = true }, + { + 'ge', + function() + require('neo-tree.command').execute { source = 'git_status', toggle = true } + end, + desc = 'Git Explorer', + }, + { + 'be', + function() + require('neo-tree.command').execute { source = 'buffers', toggle = true } + end, + desc = 'Buffer Explorer', + }, + }, + deactivate = function() + vim.cmd [[Neotree close]] + end, + }, -- Here is a more advanced example where we pass configuration -- options to `gitsigns.nvim`. This is equivalent to the following Lua: @@ -325,7 +408,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons' }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -565,19 +648,18 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, + clangd = {}, + gopls = {}, + pyright = {}, + rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`tsserver`) will work just fine - -- tsserver = {}, + tsserver = {}, -- - lua_ls = { -- cmd = {...}, -- filetypes = { ...}, @@ -607,6 +689,7 @@ require('lazy').setup({ local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code + 'prismals', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -653,11 +736,12 @@ require('lazy').setup({ formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, + python = { 'isort', 'black' }, -- -- You can use a sub-list to tell conform to run *until* a formatter -- is found. - -- javascript = { { "prettierd", "prettier" } }, + javascript = { { 'prettierd', 'prettier' } }, + prisma = { { 'prettierd', 'prettier' } }, }, }, }, @@ -768,6 +852,8 @@ require('lazy').setup({ { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'path' }, + -- Copilot Source + { name = 'copilot', group_index = 2 }, }, } end, @@ -807,7 +893,7 @@ require('lazy').setup({ -- Add/delete/replace surroundings (brackets, quotes, etc.) -- - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - saiw) - Surround [A]dd [I]nner [W]ord [)]Paren -- - sd' - [S]urround [D]elete [']quotes -- - sr)' - [S]urround [R]eplace [)] ['] require('mini.surround').setup() diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index c793b885..9e736dcc 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -6,7 +6,7 @@ return { version = '*', dependencies = { 'nvim-lua/plenary.nvim', - 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + 'nvim-tree/nvim-web-devicons', 'MunifTanjim/nui.nvim', }, cmd = 'Neotree',