You've already forked dotfiles
configurations and using newer built-in functionality in the 0.12.x versions of Neovim. Further work is needed for treesitter updates, cleanup of the conversion work and testing to verify old functionality isn't lessened to get the benefits of a cleaner config and vastly faster load times.
78 lines
2.8 KiB
Lua
78 lines
2.8 KiB
Lua
-- Treesitter
|
|
-- def tsi [parser: string] {
|
|
-- let tree = $"($env.HOME)/.local/share/nvim/site"
|
|
-- luarocks $"--tree=($tree)" install $"tree-sitter-($parser)"
|
|
-- }
|
|
|
|
local rocks_path = vim.fn.stdpath("data") .. "/site/lib/luarocks/rocks-5.1"
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
callback = function (args)
|
|
pcall(vim.treesitter.start, args.buf)
|
|
end
|
|
})
|
|
|
|
vim.diagnostic.config({
|
|
underline = true,
|
|
virtual_text = {
|
|
prefix = "●",
|
|
source = 'always',
|
|
},
|
|
-- signs = true,
|
|
severity_sort = true,
|
|
-- update_in_insert = true,
|
|
float = {
|
|
source = 'always'
|
|
}
|
|
})
|
|
|
|
-- LSP
|
|
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)
|
|
-- Native completion
|
|
-- local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
|
-- local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end
|
|
-- client.server_capabilities.completionProvider.triggerCharacters = chars
|
|
--
|
|
-- vim.lsp.completion.enable(true, args.data.client_id, args.buf, {
|
|
-- autotrigger = true,
|
|
-- convert = function(item)
|
|
-- local abbr = item.label
|
|
-- abbr = abbr:gsub("%b()", ""):gsub("%b{}", "")
|
|
-- abbr = abbr:match("[%w_.]+.*") or abbr
|
|
-- abbr = #abbr > 20 and abbr:sub(1, 19) .. "..." or abbr
|
|
--
|
|
-- return { abbr = abbr }
|
|
-- end,
|
|
-- })
|
|
|
|
-- Keyboard Mappings
|
|
local bufnr = args.buf
|
|
|
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
|
vim.keymap.set('n', '<C-[>', vim.diagnostic.goto_prev, bufopts)
|
|
vim.keymap.set('n', '<C-]>', vim.diagnostic.goto_next, bufopts)
|
|
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
|
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
|
vim.keymap.set('n', 'gs', vim.lsp.buf.signature_help, bufopts)
|
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
|
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
|
vim.keymap.set('n', '<leader><leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
|
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, bufopts)
|
|
vim.keymap.set('i', '<c-space>', vim.lsp.completion.get, bufopts)
|
|
end,
|
|
})
|
|
|
|
-- Enable LSP engines
|
|
-- vim.lsp.enable('clangd')
|
|
vim.lsp.enable('gdscript')
|