Add LSP configurations to neovim. Add conform/telescope plugins.
This commit is contained in:
28
config/nvim/lua/config/lsp.lua
Normal file
28
config/nvim/lua/config/lsp.lua
Normal 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,
|
||||
},
|
||||
})
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
15
config/nvim/lua/plugins/conform.lua
Normal file
15
config/nvim/lua/plugins/conform.lua
Normal 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',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user