Add LSP configurations to neovim. Add conform/telescope plugins.

This commit is contained in:
2025-10-10 23:35:14 -07:00
parent e16aac3dfa
commit 1a02c0e649
10 changed files with 101 additions and 21 deletions

View File

@@ -0,0 +1,28 @@
-- enables LSPs and configures useful bindings
vim.lsp.enable('lua_ls')
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(ev)
local client = vim.lsp.get_client_by_id(ev.data.client_id)
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_completion) then
vim.opt.completeopt = { 'menu', 'menuone', 'noinsert', 'fuzzy', 'popup' }
vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
vim.keymap.set('i', '<C-Space>', function()
vim.lsp.completion.get()
end)
end
end
})
-- Diagnostics
vim.diagnostic.config({
-- Use the default configuration
-- virtual_lines = true
-- Alternatively, customize specific options
virtual_lines = {
-- Only show virtual line diagnostics for the current cursor line
current_line = true,
},
})

View File

@@ -16,5 +16,3 @@ vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left wind
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -2,7 +2,7 @@
-- See `:help vim.o`
-- Make line numbers default
vim.o.number = true
vim.o.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.o.mouse = 'a'
@@ -58,3 +58,10 @@ vim.o.scrolloff = 10
-- instead raise a dialog asking if you wish to save the current file(s)
-- See `:help 'confirm'`
vim.o.confirm = true
-- default tab/space configuration
vim.o.tabstop = 2
vim.o.softtabstop = 2
vim.o.shiftwidth = 2
vim.o.expandtab = true

View File

@@ -0,0 +1,15 @@
return {
{
'stevearc/conform.nvim',
opts = {
formatters_by_ft = {
lua = { 'stylua' },
javascript = { 'prettier' },
},
format_on_save = {
timeout_ms = 500,
lsp_format = 'fallback',
},
},
},
}

View File

@@ -1,4 +1,8 @@
return {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim' }
{
'nvim-telescope/telescope.nvim',
tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim', { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' } },
config = function() end,
},
}