wip: starting from stream

This commit is contained in:
TJ DeVries 2024-02-21 09:40:30 -05:00
parent 1bc4bfc2fe
commit c0ccf101ad

View file

@ -150,11 +150,13 @@ require('lazy').setup({
-- Git related plugins -- Git related plugins
'tpope/vim-fugitive', 'tpope/vim-fugitive',
'tpope/vim-rhubarb',
-- Detect tabstop and shiftwidth automatically -- Detect tabstop and shiftwidth automatically
'tpope/vim-sleuth', '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. -- NOTE: This is where your plugins related to LSP can be installed.
-- The configuration is done below. Search for lspconfig to find it below. -- The configuration is done below. Search for lspconfig to find it below.
@ -162,6 +164,7 @@ require('lazy').setup({
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
dependencies = { dependencies = {
-- Automatically install LSPs to stdpath for neovim -- 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.nvim', opts = {} },
{ 'williamboman/mason-lspconfig.nvim', opts = {} }, { 'williamboman/mason-lspconfig.nvim', opts = {} },
@ -244,15 +247,13 @@ require('lazy').setup({
end, '[W]orkspace [L]ist Folders') end, '[W]orkspace [L]ist Folders')
end 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 -- 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()) local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
mason_lspconfig.setup_handlers {
-- Ensure the servers above are installed
require('mason-lspconfig').setup {
ensure_installed = vim.tbl_keys(servers),
handlers = {
function(server_name) function(server_name)
require('lspconfig')[server_name].setup { require('lspconfig')[server_name].setup {
capabilities = capabilities, capabilities = capabilities,
@ -261,6 +262,7 @@ require('lazy').setup({
filetypes = (servers[server_name] or {}).filetypes, filetypes = (servers[server_name] or {}).filetypes,
} }
end, end,
},
} }
end, end,
}, },
@ -398,66 +400,6 @@ require('lazy').setup({
topdelete = { text = '' }, topdelete = { text = '' },
changedelete = { 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 '<Ignore>'
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 '<Ignore>'
end, { expr = true, desc = 'Jump to previous hunk' })
-- Actions
-- visual mode
map('v', '<leader>hs', function()
gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'stage git hunk' })
map('v', '<leader>hr', function()
gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'reset git hunk' })
-- normal mode
map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
map('n', '<leader>hb', function()
gs.blame_line { full = false }
end, { desc = 'git blame line' })
map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
map('n', '<leader>hD', function()
gs.diffthis '~'
end, { desc = 'git diff against last commit' })
-- Toggles
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
-- Text object
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { 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 -- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} }, { 'numToStr/Comment.nvim', opts = {} },
@ -527,6 +461,8 @@ require('lazy').setup({
return vim.fn.executable 'make' == 1 return vim.fn.executable 'make' == 1
end, end,
}, },
{ 'nvim-telescope/telescope-ui-select.nvim' },
-- { 'nvim-tree/nvim-web-devicons' } -- Useful for getting pretty icons, but requires special font
}, },
config = function() config = function()
-- [[ Configure Telescope ]] -- [[ Configure Telescope ]]
@ -540,10 +476,16 @@ require('lazy').setup({
}, },
}, },
}, },
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
},
} }
-- Enable telescope fzf native, if installed -- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
-- See `:help telescope.builtin` -- See `:help telescope.builtin`
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
@ -590,14 +532,12 @@ require('lazy').setup({
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter -- 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!) -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false, auto_install = false,
-- Install languages synchronously (only applied to `ensure_installed`) -- Install languages synchronously (only applied to `ensure_installed`)
sync_install = false, sync_install = false,
-- List of parsers to ignore installing
ignore_install = {},
-- You can specify additional Treesitter modules here: -- For example: -- playground = {--enable = true,-- }, -- You can specify additional Treesitter modules here: -- For example: -- playground = {--enable = true,-- },
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },