From c0ccf101ad520e1ee726cec853b996d03ab9925f Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Wed, 21 Feb 2024 09:40:30 -0500 Subject: [PATCH] wip: starting from stream --- init.lua | 114 +++++++++++++------------------------------------------ 1 file changed, 27 insertions(+), 87 deletions(-) diff --git a/init.lua b/init.lua index 52edd0e..5fc400d 100644 --- a/init.lua +++ b/init.lua @@ -150,11 +150,13 @@ require('lazy').setup({ -- Git related plugins 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', + -- Surrounding motions, like "ysiw" (TODO: Write a description for this) + 'tpope/vim-surround', + -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. @@ -162,6 +164,7 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim + -- TODO: It seems that there is some confusion w/ the setup here, so i need to check it out some more { 'williamboman/mason.nvim', opts = {} }, { 'williamboman/mason-lspconfig.nvim', opts = {} }, @@ -244,23 +247,22 @@ require('lazy').setup({ end, '[W]orkspace [L]ist Folders') end - -- Ensure the servers above are installed - local mason_lspconfig = require 'mason-lspconfig' - mason_lspconfig.setup { - ensure_installed = vim.tbl_keys(servers), - } - -- nvim-cmp supports additional completion capabilities, so broadcast that to servers local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()) - mason_lspconfig.setup_handlers { - function(server_name) - require('lspconfig')[server_name].setup { - capabilities = capabilities, - on_attach = on_attach, - settings = servers[server_name], - filetypes = (servers[server_name] or {}).filetypes, - } - end, + + -- Ensure the servers above are installed + require('mason-lspconfig').setup { + ensure_installed = vim.tbl_keys(servers), + handlers = { + function(server_name) + require('lspconfig')[server_name].setup { + capabilities = capabilities, + on_attach = on_attach, + settings = servers[server_name], + filetypes = (servers[server_name] or {}).filetypes, + } + end, + }, } end, }, @@ -398,66 +400,6 @@ require('lazy').setup({ topdelete = { text = '‾' }, changedelete = { text = '~' }, }, - on_attach = function(bufnr) - local gs = package.loaded.gitsigns - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map({ 'n', 'v' }, ']c', function() - if vim.wo.diff then - return ']c' - end - vim.schedule(function() - gs.next_hunk() - end) - return '' - end, { expr = true, desc = 'Jump to next hunk' }) - - map({ 'n', 'v' }, '[c', function() - if vim.wo.diff then - return '[c' - end - vim.schedule(function() - gs.prev_hunk() - end) - return '' - end, { expr = true, desc = 'Jump to previous hunk' }) - - -- Actions - -- visual mode - map('v', 'hs', function() - gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'stage git hunk' }) - map('v', 'hr', function() - gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'reset git hunk' }) - -- normal mode - map('n', 'hs', gs.stage_hunk, { desc = 'git stage hunk' }) - map('n', 'hr', gs.reset_hunk, { desc = 'git reset hunk' }) - map('n', 'hS', gs.stage_buffer, { desc = 'git Stage buffer' }) - map('n', 'hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) - map('n', 'hR', gs.reset_buffer, { desc = 'git Reset buffer' }) - map('n', 'hp', gs.preview_hunk, { desc = 'preview git hunk' }) - map('n', 'hb', function() - gs.blame_line { full = false } - end, { desc = 'git blame line' }) - map('n', 'hd', gs.diffthis, { desc = 'git diff against index' }) - map('n', 'hD', function() - gs.diffthis '~' - end, { desc = 'git diff against last commit' }) - - -- Toggles - map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) - map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) - - -- Text object - map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) - end, }, }, @@ -499,14 +441,6 @@ require('lazy').setup({ }, }, - { -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help ibl` - main = 'ibl', - opts = {}, - }, - -- "gc" to comment visual regions/lines { 'numToStr/Comment.nvim', opts = {} }, @@ -527,6 +461,8 @@ require('lazy').setup({ return vim.fn.executable 'make' == 1 end, }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + -- { 'nvim-tree/nvim-web-devicons' } -- Useful for getting pretty icons, but requires special font }, config = function() -- [[ Configure Telescope ]] @@ -540,10 +476,16 @@ require('lazy').setup({ }, }, }, + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + }, } -- Enable telescope fzf native, if installed pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'ui-select') -- See `:help telescope.builtin` vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) @@ -590,14 +532,12 @@ require('lazy').setup({ ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, + ensure_installed = { 'c', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, -- Install languages synchronously (only applied to `ensure_installed`) sync_install = false, - -- List of parsers to ignore installing - ignore_install = {}, -- You can specify additional Treesitter modules here: -- For example: -- playground = {--enable = true,-- }, highlight = { enable = true }, indent = { enable = true },