This commit is contained in:
Tyler Ryan 2023-05-02 11:21:02 -07:00
parent 0470d07c8c
commit e0bcaab64b
5 changed files with 84 additions and 47 deletions

View file

@ -79,7 +79,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
@ -93,7 +93,7 @@ require('lazy').setup({
{ -- Autocompletion
'hrsh7th/nvim-cmp',
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lsp-signature-help' },
},
-- Useful plugin to show you pending keybinds.
@ -167,7 +167,9 @@ require('lazy').setup({
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
},
build = ":TSUpdate",
config = function()
pcall(require('nvim-treesitter.install').update { with_sync = true })
end,
},
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
@ -234,6 +236,11 @@ vim.o.termguicolors = true
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Maps for buffer movements
vim.keymap.set({ 'n', 'v', 'i' }, '<C-h>', '<Esc>:bp<CR>', { silent = true })
vim.keymap.set({ 'n', 'v', 'i' }, '<C-l>', '<Esc>:bn<CR>', { silent = true })
vim.keymap.set({ 'n', 'v', 'i' }, '<C-j>', '<Esc>:bd<CR>', { silent = true })
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
@ -276,7 +283,6 @@ vim.keymap.set('n', '<leader>/', function()
})
end, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
@ -287,7 +293,7 @@ vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { de
-- See `:help nvim-treesitter`
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', 'typescript', 'vimdoc', 'vim' },
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'help', 'vim' },
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false,
@ -406,12 +412,16 @@ end
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
local servers = {
-- clangd = {},
-- gopls = {},
bashls = {},
cssls = {},
dockerls = {},
html = {},
jsonls = {},
gopls = {},
pylsp = {},
ruff_lsp = {},
-- pyright = {},
-- rust_analyzer = {},
-- tsserver = {},
yamlls = {},
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
@ -427,6 +437,9 @@ require('neodev').setup()
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- Setup mason so it can manage external tooling
require('mason').setup()
-- Ensure the servers above are installed
local mason_lspconfig = require 'mason-lspconfig'
@ -457,8 +470,6 @@ cmp.setup {
end,
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
@ -488,6 +499,7 @@ cmp.setup {
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = "nvim_lsp_signature_help" },
},
}