nvim: misc
This commit is contained in:
parent
e1a597ec12
commit
5797583939
4 changed files with 37 additions and 3 deletions
|
@ -60,6 +60,7 @@ function M.setup()
|
||||||
.. '%( │ %{get(b:,"gitsigns_head","")}%)' -- branch
|
.. '%( │ %{get(b:,"gitsigns_head","")}%)' -- branch
|
||||||
.. ' │ %<%f%( [%M%R%W]%)' -- filename and modification flags
|
.. ' │ %<%f%( [%M%R%W]%)' -- filename and modification flags
|
||||||
.. '%=' -- rest is right
|
.. '%=' -- rest is right
|
||||||
|
.. '%( [%{get(b:,"attached_lsps","")}] | %)' -- branch
|
||||||
.. '%y ' -- filetype
|
.. '%y ' -- filetype
|
||||||
.. '%-7.(%3.l:%-3.(%c%V%)%) %P' -- ruler
|
.. '%-7.(%3.l:%-3.(%c%V%)%) %P' -- ruler
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
local server_configs = function()
|
local server_configs = function()
|
||||||
return {
|
return {
|
||||||
|
ansiblels = {},
|
||||||
powershell_es = {},
|
powershell_es = {},
|
||||||
gopls = {},
|
gopls = {},
|
||||||
clangd = {},
|
clangd = {},
|
||||||
|
@ -7,7 +8,6 @@ local server_configs = function()
|
||||||
-- hls = {},
|
-- hls = {},
|
||||||
tsserver = {},
|
tsserver = {},
|
||||||
-- perlls = {},
|
-- perlls = {},
|
||||||
rust_analyzer = {},
|
|
||||||
cssls = {},
|
cssls = {},
|
||||||
html = {},
|
html = {},
|
||||||
lemminx = {
|
lemminx = {
|
||||||
|
@ -130,6 +130,15 @@ local function navic_attach(client, bufnr)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function update_attached(bufnr)
|
||||||
|
local attached = '';
|
||||||
|
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = bufnr })) do
|
||||||
|
attached = attached .. ',' .. client.name
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.b[bufnr].attached_lsps = attached
|
||||||
|
end
|
||||||
|
|
||||||
local function on_attach(args) -- {{{
|
local function on_attach(args) -- {{{
|
||||||
local bufnr = args.buf
|
local bufnr = args.buf
|
||||||
|
|
||||||
|
@ -283,6 +292,9 @@ local function on_attach(args) -- {{{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
update_attached(bufnr)
|
||||||
end -- }}}
|
end -- }}}
|
||||||
|
|
||||||
local function make_client_capabilities()
|
local function make_client_capabilities()
|
||||||
|
@ -297,6 +309,12 @@ local function config()
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
callback = on_attach,
|
callback = on_attach,
|
||||||
})
|
})
|
||||||
|
vim.api.nvim_create_autocmd('LspDetach', {
|
||||||
|
callback = function(ev)
|
||||||
|
vim.print(ev)
|
||||||
|
update_attached(ev.buf)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
local capabilities = make_client_capabilities()
|
local capabilities = make_client_capabilities()
|
||||||
|
|
||||||
|
@ -305,7 +323,7 @@ local function config()
|
||||||
nvim_lsp.util.default_config = vim.tbl_extend('force',
|
nvim_lsp.util.default_config = vim.tbl_extend('force',
|
||||||
nvim_lsp.util.default_config,
|
nvim_lsp.util.default_config,
|
||||||
{
|
{
|
||||||
capabilities = capabilities
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -352,6 +370,11 @@ return {
|
||||||
dependencies = { 'williamboman/mason.nvim' },
|
dependencies = { 'williamboman/mason.nvim' },
|
||||||
config = config_mason_lsp,
|
config = config_mason_lsp,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'simrat39/rust-tools.nvim',
|
||||||
|
build = ':MasonInstall rust-analyzer',
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ '<leader>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
|
{ '<leader>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
|
||||||
|
|
|
@ -236,7 +236,7 @@ return {
|
||||||
{ '<Leader>tt', '<Cmd>TroubleToggle<CR>', desc = 'Trouble toggle' },
|
{ '<Leader>tt', '<Cmd>TroubleToggle<CR>', desc = 'Trouble toggle' },
|
||||||
{ '<Leader>td', '<Cmd>Trouble document_diagnostics<CR>', desc = 'Trouble toggle' },
|
{ '<Leader>td', '<Cmd>Trouble document_diagnostics<CR>', desc = 'Trouble toggle' },
|
||||||
},
|
},
|
||||||
config = {
|
opts = {
|
||||||
mode = 'document_diagnostics',
|
mode = 'document_diagnostics',
|
||||||
signs = {
|
signs = {
|
||||||
-- icons / text used for a diagnostic
|
-- icons / text used for a diagnostic
|
||||||
|
|
|
@ -50,6 +50,15 @@ local M = {
|
||||||
-- }}}
|
-- }}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function M.init()
|
||||||
|
local aug = vim.api.nvim_create_augroup('treesitterUpdate', { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd('User', {
|
||||||
|
pattern = { 'LazySync' },
|
||||||
|
group = aug,
|
||||||
|
command = 'TSUpdate',
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
function M.config()
|
function M.config()
|
||||||
local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
|
local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
|
||||||
ts_parsers.xml = {
|
ts_parsers.xml = {
|
||||||
|
@ -72,6 +81,7 @@ function M.config()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
require 'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue