You've already forked dotfiles
in LSP definitions for servers that are used, adding in a script to check for LSPs, removing some extraneous items in the tmux conf, moving autopairs to its own file
72 lines
2.3 KiB
Lua
72 lines
2.3 KiB
Lua
-- Treesitter
|
|
local rocks_path = os.getenv('HOME') .. "/.luarocks/lib/luarocks/rocks-5.1"
|
|
|
|
-- Pick up the installed parsers in the install dir
|
|
for _, parser_dir in ipairs(vim.fn.glob(rocks_path .. '/tree-sitter-*/*/', true, true)) do
|
|
vim.opt.runtimepath:prepend(parser_dir)
|
|
end
|
|
|
|
-- Start treesitter parsing on the current buffer
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
callback = function(ev)
|
|
pcall(vim.treesitter.start, ev.buf)
|
|
end
|
|
})
|
|
|
|
vim.diagnostic.config({
|
|
underline = true,
|
|
virtual_text = {
|
|
prefix = "●",
|
|
source = true,
|
|
},
|
|
severity_sort = true,
|
|
float = {
|
|
source = true
|
|
}
|
|
})
|
|
|
|
-- Install and enable the language server settings from nvim-lspconfig
|
|
-- vim.pack.add({
|
|
-- 'https://github.com/neovim/nvim-lspconfig',
|
|
-- })
|
|
|
|
-- Auto set keymaps and other settings on LSP attach
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
|
callback = function(args)
|
|
local bufnr = args.buf
|
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
|
|
|
vim.keymap.set('i', '<c-space>', vim.lsp.completion.get, bufopts)
|
|
vim.keymap.set('n', '<C-[>', function() vim.diagnostic.jump({ count = -1, float = true }) end, bufopts)
|
|
vim.keymap.set('n', '<C-]>', function() vim.diagnostic.jump({ count = 1, float = true }) end, bufopts)
|
|
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
|
vim.keymap.set('n', '<leader>for', function() vim.lsp.buf.format { async = true } end, bufopts)
|
|
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, bufopts)
|
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
|
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
|
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
|
vim.keymap.set('n', 'gs', vim.lsp.buf.signature_help, bufopts)
|
|
end,
|
|
})
|
|
|
|
-- Enable LSP engines
|
|
local enabled_lsps = {
|
|
'clangd',
|
|
'bashls',
|
|
'gdscript',
|
|
'jinja_lsp',
|
|
'lua_ls',
|
|
'pylsp',
|
|
'r_language_server',
|
|
'rust_analyzer',
|
|
'yamlls',
|
|
}
|
|
|
|
for _, lsp in pairs(enabled_lsps) do
|
|
vim.lsp.enable(lsp)
|
|
end
|