Compare commits

..

No commits in common. "89bca77ef481eed5ea255261544012c070fbb1d6" and "e64316e3363d8ed0768a9f0cf30f740cf6e22362" have entirely different histories.

2 changed files with 19 additions and 63 deletions

View File

@ -35,27 +35,18 @@ return {
config = function() config = function()
require('mason').setup() require('mason').setup()
require('mason-lspconfig').setup({ require('mason-lspconfig').setup({
automatic_installation = false,
ensure_installed = { ensure_installed = {
'ansiblels', -- Ansible 'clangd',
'bashls', -- Bash 'cmake',
'clangd', -- C/C++ 'jsonls',
'cmake', -- Cmake 'lemminx',
'docker_compose_language_service', -- Docker Compose 'lua_ls',
'dockerls', -- Dockerfile 'pyright',
'esbonio', -- Sphinx 'ruff_lsp',
'html', -- HTML 'vimls',
'jsonls', -- JSON 'yamlls',
'lemminx', -- XML
'lua_ls', -- Lua
'opencl_ls', -- OpenCL
'powershell_es', -- Powershell
'pyright', -- Python
'ruff_lsp', -- Python
'vimls', -- VimScript
'yamlls', -- YAML
}, },
automatic_installation = false,
handlers = { handlers = {
-- Default handler, sets up everything unless a custom language server -- Default handler, sets up everything unless a custom language server
-- setup handler is defined below -- setup handler is defined below
@ -98,62 +89,30 @@ return {
require('luasnip').lsp_expand(args.body) require('luasnip').lsp_expand(args.body)
end end
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
-- Open completion menu/confirm completion
['<C-Space>'] = cmp.mapping.complete(),
['<C-l>'] = cmp.mapping.confirm({ select = true }),
-- Select completion from menu
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(), ['<C-p>'] = cmp.mapping.select_prev_item(),
-- Scroll documentation of selected completion item ['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(4), ['<C-l>'] = cmp.mapping.confirm({ select = true }),
['<C-u>'] = cmp.mapping.scroll_docs(-4),
}), }),
sources = { sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'nvim_lsp' },
-- { name = 'buffer' }, -- { name = 'buffer' },
{ name = 'path' }, { name = 'path' },
-- { name = 'cmdline' }, -- { name = 'cmdline' },
}, },
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
}) })
-- Customise LSP UI -- Disable displaying diagnostics as virtual text
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( vim.diagnostic.config({ virtual_text = false })
vim.lsp.handlers.hover, {
border = 'rounded',
title = 'Hover',
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = 'rounded',
title = 'Signature Help'
}
)
-- Customise diagnostics UI -- Diagnostic mappings
vim.diagnostic.config({
float = {
border = 'rounded', -- Enable rounded border on floats
},
virtual_text = false, -- Disable trailing virtual text
})
-- Diagnostics mappings
-- TODO: trouble.nvim mappings instead? https://youtu.be/MuUrCcvE-Yw?t=631 -- TODO: trouble.nvim mappings instead? https://youtu.be/MuUrCcvE-Yw?t=631
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { remap = false }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { remap = false })
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { remap = false }) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { remap = false })
vim.keymap.set('n', '<leader>sd', vim.diagnostic.open_float, { remap = false }) vim.keymap.set('n', '<leader>sd', vim.diagnostic.open_float, { remap = false })
-- Mappings created when LSP is attached to a buffer -- LSP mappings created when attached to a buffer
local augroup = vim.api.nvim_create_augroup('lsp', { clear = true }) local augroup = vim.api.nvim_create_augroup('lsp', { clear = true })
vim.api.nvim_create_autocmd('LspAttach', { vim.api.nvim_create_autocmd('LspAttach', {
pattern = '*', pattern = '*',

View File

@ -60,9 +60,6 @@ local function get_mode()
return current_mode.name return current_mode.name
end end
-- Display cusor line/total and column
local position = '# ☰ %l/%L 󰠷 %2c '
-- Construct a statusline for special buffer types. -- Construct a statusline for special buffer types.
local function special(group, name, title) local function special(group, name, title)
-- Display current mode with dynamic highlights. -- Display current mode with dynamic highlights.
@ -70,7 +67,7 @@ local function special(group, name, title)
-- Display filename with dark highlights. -- Display filename with dark highlights.
line = line .. '%#StatusLineDark# ' .. title line = line .. '%#StatusLineDark# ' .. title
-- Display current/total lines and column with dynamic highlights. -- Display current/total lines and column with dynamic highlights.
line = line .. '%=' .. '%#' .. group .. position line = line .. '%=' .. '%#' .. group .. '# ☰%l/%L ·%2c '
-- Combine the elements into a single string to be evaluated. -- Combine the elements into a single string to be evaluated.
return line return line
end end
@ -103,7 +100,7 @@ local function generic(group, name, show_lsp)
'%{&fileencoding ==# "utf-8" ? "" : &fileencoding}' .. '%{&fileencoding ==# "utf-8" ? "" : &fileencoding}' ..
'%{&fileformat ==# "unix" ? "" : "[".&fileformat."]"}' .. ' %)' '%{&fileformat ==# "unix" ? "" : "[".&fileformat."]"}' .. ' %)'
-- Display current/total lines and column with dynamic highlights. -- Display current/total lines and column with dynamic highlights.
line = line .. '%#' .. group .. position line = line .. '%#' .. group .. '# ☰ %l/%L 󰠷 %2c '
-- Combine the elements into a single string to be evaluated. -- Combine the elements into a single string to be evaluated.
return line return line
end end