fix: Actually correcting the on_attach settings and moved them to an LspAttach event autocommand. Slight cleanup as well.
This commit is contained in:
parent
70c7a97484
commit
a31d423095
0
nvim/after/lsp/ts_ls.lua
Normal file
0
nvim/after/lsp/ts_ls.lua
Normal file
@ -1,34 +1,9 @@
|
|||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
-- lazy = false,
|
|
||||||
config = function ()
|
config = function ()
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
-- All functions and keymaps contained here are universal to LSPs
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
|
|
||||||
-- Keyboard Mappings
|
|
||||||
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', 'gl', vim.diagnostic.open_float, 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', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
|
||||||
vim.keymap.set('n', '<leader><leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
|
||||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Kick the logging to debug level
|
|
||||||
-- vim.lsp.set_log_level("debug")
|
|
||||||
|
|
||||||
vim.diagnostic.config ({
|
vim.diagnostic.config ({
|
||||||
virtual_text = {
|
virtual_text = {
|
||||||
source = 'always',
|
source = 'always',
|
||||||
@ -40,11 +15,36 @@ return {
|
|||||||
})
|
})
|
||||||
|
|
||||||
vim.lsp.config('*', {
|
vim.lsp.config('*', {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities, -- TODO: Does this do anything?
|
||||||
on_attach = on_attach,
|
})
|
||||||
|
|
||||||
|
-- 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
|
||||||
|
|
||||||
|
-- TODO: Does this do anything?
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
|
-- Keyboard Mappings
|
||||||
|
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', 'gl', vim.diagnostic.open_float, 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', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||||
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, 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)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.lsp.config('gdscript', {})
|
|
||||||
vim.lsp.enable('gdscript')
|
vim.lsp.enable('gdscript')
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,8 +46,5 @@ set -g @plugin 'tmux-plugins/tmux-sensible'
|
|||||||
set -g @plugin 'tmux-plugins/tmux-yank'
|
set -g @plugin 'tmux-plugins/tmux-yank'
|
||||||
set -g @plugin 'egel/tmux-gruvbox'
|
set -g @plugin 'egel/tmux-gruvbox'
|
||||||
|
|
||||||
# Plugin settings
|
|
||||||
# set -g @tmux-gruvbox 'dark-transparent'
|
|
||||||
|
|
||||||
## Required for TPM plugins
|
## Required for TPM plugins
|
||||||
run '~/.tmux/plugins/tpm/tpm'
|
run '~/.tmux/plugins/tpm/tpm'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user