From 11f51974ae5c78a39da79b9426af51dcd9a7a642 Mon Sep 17 00:00:00 2001 From: ZachHunn Date: Wed, 25 Oct 2023 21:56:34 -1000 Subject: [PATCH] added nvim-tree, autosave, and autopair plugins --- README.md | 2 +- init.lua | 45 +++++++++++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4d27756c..433a51de 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Neovim's configurations are located under the following paths, depending on your | OS | PATH | | :- | :--- | | Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| MacOS | `$XDG_CONFIG_HOME/nvim`, '~/.config/nvim` | +| MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | | Windows | `%userprofile%\AppData\Local\nvim\` | Clone kickstart.nvim: diff --git a/init.lua b/init.lua index 42485cca..de47e7d9 100644 --- a/init.lua +++ b/init.lua @@ -84,7 +84,7 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim - { 'williamboman/mason.nvim', config = true }, + 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', -- Useful status updates for LSP @@ -132,6 +132,7 @@ require('lazy').setup({ -- don't override the built-in and fugitive keymaps local gs = package.loaded.gitsigns vim.keymap.set({ 'n', 'v' }, ']c', function() +<<<<<<< HEAD if vim.wo.diff then return ']c' end vim.schedule(function() gs.next_hunk() end) return '' @@ -141,6 +142,25 @@ require('lazy').setup({ vim.schedule(function() gs.prev_hunk() end) return '' end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" }) +======= + if vim.wo.diff then + return ']c' + end + vim.schedule(function() + gs.next_hunk() + end) + return '' + end, { expr = true, buffer = bufnr, desc = 'Jump to next hunk' }) + vim.keymap.set({ 'n', 'v' }, '[c', function() + if vim.wo.diff then + return '[c' + end + vim.schedule(function() + gs.prev_hunk() + end) + return '' + end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' }) +>>>>>>> refs/remotes/origin/master end, }, }, @@ -172,8 +192,8 @@ require('lazy').setup({ -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help indent_blankline.txt` - main = "ibl", + -- See `:help ibl` + main = 'ibl', opts = {}, }, @@ -328,7 +348,11 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = vim.defer_fn(function() require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter +<<<<<<< HEAD ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' }, +======= + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, +>>>>>>> refs/remotes/origin/master -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, @@ -438,10 +462,10 @@ local on_attach = function(_, bufnr) nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') + nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') + nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') @@ -464,7 +488,7 @@ local on_attach = function(_, bufnr) end -- document existing key chains -require('which-key').register({ +require('which-key').register { ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, @@ -472,7 +496,12 @@ require('which-key').register({ ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -}) +} + +-- mason-lspconfig requires that these setup functions are called in this order +-- before setting up the servers. +require('mason').setup() +require('mason-lspconfig').setup() -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. @@ -520,7 +549,7 @@ mason_lspconfig.setup_handlers { settings = servers[server_name], filetypes = (servers[server_name] or {}).filetypes, } - end + end, } -- [[ Configure nvim-cmp ]]