Compare commits

...

3 Commits

Author SHA1 Message Date
6c0c906cb2 Fix Quickfix/Location List statusmenu mode string 2024-03-14 23:36:23 +00:00
378c8b0be4 Improve LSP configuration
* Add more recommended mappings
* Add Python LSP support with PyRight and Ruff
2024-03-14 23:35:35 +00:00
4072fd3ccf Add a couple of plugins to pretty up the place 2024-03-14 23:34:09 +00:00
4 changed files with 32 additions and 15 deletions

View File

@ -38,8 +38,10 @@ return {
'clangd', 'clangd',
'cmake', 'cmake',
'jsonls', 'jsonls',
'lua_ls',
'lemminx', 'lemminx',
'lua_ls',
'pyright',
'ruff_lsp',
'vimls', 'vimls',
'yamlls', 'yamlls',
}, },
@ -53,8 +55,7 @@ return {
['lua_ls'] = function() ['lua_ls'] = function()
require('neodev').setup() require('neodev').setup()
local lspconfig = require('lspconfig') require('lspconfig').lua_ls.setup({
lspconfig.lua_ls.setup({
settings = { settings = {
Lua = { Lua = {
diagnostics = { diagnostics = {
@ -64,7 +65,19 @@ return {
} }
} }
}) })
end end,
['pyright'] = function()
require('lspconfig').pyright.setup({
settings = {
pyright = {
-- Using Ruff's import organizer
disableOrganizeImports = true,
},
}
})
end,
}, },
}) })
@ -110,13 +123,14 @@ return {
vim.keymap.set('n', '<leader>fi', vim.keymap.set('n', '<leader>fi',
require("actions-preview").code_actions, opts) require("actions-preview").code_actions, opts)
-- Goto definition mapping -- Goto mappings
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
-- TODO: nnoremap <silent> <leader>gt <Plug>(coc-type-definition) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
-- TODO: nnoremap <silent> <leader>gu <Plug>(coc-references-used) vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
-- Get references to symbol under cursor, store in quickfix window -- Get references to symbol under cursor, store in quickfix window
vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references, opts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
-- Refactoring mappings -- Refactoring mappings
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts) vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)

View File

@ -1,6 +0,0 @@
return {
'tummetott/unimpaired.nvim',
config = function()
require('unimpaired').setup({})
end
}

View File

@ -0,0 +1,5 @@
return {
{ 'tummetott/unimpaired.nvim' },
{ 'stevearc/dressing.nvim' },
{ 'kevinhwang91/nvim-bqf' },
}

View File

@ -121,7 +121,11 @@ function statusline.active()
-- loclist flag, query the window info. -- loclist flag, query the window info.
local info = vim.fn.getwininfo(vim.fn.win_getid())[1] local info = vim.fn.getwininfo(vim.fn.win_getid())[1]
if mode == 'Normal' then if mode == 'Normal' then
if info.loclist then mode = 'Location' else mode = 'Quickfix' end if info.loclist == 1 then
mode = 'Location'
else
mode = 'Quickfix'
end
end end
local title = info.variables.quickfix_title local title = info.variables.quickfix_title
return special('StatusLineLight', mode, title) return special('StatusLineLight', mode, title)