qol
This commit is contained in:
parent
8931468772
commit
d02e16803e
2 changed files with 91 additions and 78 deletions
9
init.lua
9
init.lua
|
@ -1,5 +1,10 @@
|
||||||
vim.cmd("nnoremap <Space> <Nop>")
|
vim.cmd("nnoremap <Space> <Nop>")
|
||||||
|
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.cmd("set shiftwidth=4")
|
|
||||||
vim.cmd("set nu")
|
vim.cmd("set tabstop=4")
|
||||||
|
vim.cmd("set softtabstop=0")
|
||||||
|
vim.cmd("set shiftwidth=0")
|
||||||
|
|
||||||
|
vim.opt.nu = true
|
||||||
require("Dario48/lazy")
|
require("Dario48/lazy")
|
||||||
|
|
|
@ -1,82 +1,90 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
branch = 'v3.x',
|
branch = 'v3.x',
|
||||||
lazy = true,
|
lazy = true,
|
||||||
config = false,
|
config = false,
|
||||||
init = function()
|
init = function()
|
||||||
-- Disable automatic setup, we are doing it manually
|
-- Disable automatic setup, we are doing it manually
|
||||||
vim.g.lsp_zero_extend_cmp = 0
|
vim.g.lsp_zero_extend_cmp = 0
|
||||||
vim.g.lsp_zero_extend_lspconfig = 0
|
vim.g.lsp_zero_extend_lspconfig = 0
|
||||||
end,
|
end,
|
||||||
},
|
|
||||||
{
|
|
||||||
'williamboman/mason.nvim',
|
|
||||||
lazy = false,
|
|
||||||
config = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Autocompletion
|
|
||||||
{
|
|
||||||
'hrsh7th/nvim-cmp',
|
|
||||||
event = 'InsertEnter',
|
|
||||||
dependencies = {
|
|
||||||
{'L3MON4D3/LuaSnip'},
|
|
||||||
},
|
},
|
||||||
config = function()
|
{
|
||||||
-- Here is where you configure the autocompletion settings.
|
'williamboman/mason.nvim',
|
||||||
local lsp_zero = require('lsp-zero')
|
lazy = false,
|
||||||
lsp_zero.extend_cmp()
|
config = function ()
|
||||||
|
require("mason").setup()
|
||||||
-- And you can configure cmp even more, if you want to.
|
vim.keymap.set("n", "<leader>m", ":Mason <CR>")
|
||||||
local cmp = require('cmp')
|
end
|
||||||
local cmp_action = lsp_zero.cmp_action()
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
formatting = lsp_zero.cmp_format(),
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
[' '] = cmp.mapping.confirm({select = true}),
|
|
||||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
['<C-f>'] = cmp_action.luasnip_jump_forward(),
|
|
||||||
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
end
|
|
||||||
},
|
|
||||||
|
|
||||||
-- LSP
|
|
||||||
{
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
cmd = {'LspInfo', 'LspInstall', 'LspStart'},
|
|
||||||
event = {'BufReadPre', 'BufNewFile'},
|
|
||||||
dependencies = {
|
|
||||||
{'hrsh7th/cmp-nvim-lsp'},
|
|
||||||
{'williamboman/mason-lspconfig.nvim'},
|
|
||||||
},
|
},
|
||||||
config = function()
|
|
||||||
-- This is where all the LSP shenanigans will live
|
|
||||||
local lsp_zero = require('lsp-zero')
|
|
||||||
lsp_zero.extend_lspconfig()
|
|
||||||
|
|
||||||
lsp_zero.on_attach(function(client, bufnr)
|
-- Autocompletion
|
||||||
-- see :help lsp-zero-keybindings
|
{
|
||||||
-- to learn the available actions
|
'hrsh7th/nvim-cmp',
|
||||||
lsp_zero.default_keymaps({buffer = bufnr})
|
event = 'InsertEnter',
|
||||||
end)
|
dependencies = {
|
||||||
|
{'L3MON4D3/LuaSnip'},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- Here is where you configure the autocompletion settings.
|
||||||
|
local lsp_zero = require('lsp-zero')
|
||||||
|
lsp_zero.extend_cmp()
|
||||||
|
|
||||||
require('mason-lspconfig').setup({
|
-- And you can configure cmp even more, if you want to.
|
||||||
ensure_installed = {},
|
local cmp = require('cmp')
|
||||||
handlers = {
|
local cmp_action = lsp_zero.cmp_action()
|
||||||
lsp_zero.default_setup,
|
|
||||||
lua_ls = function()
|
cmp.setup({
|
||||||
-- (Optional) Configure lua language server for neovim
|
sources = {
|
||||||
local lua_opts = lsp_zero.nvim_lua_ls()
|
{name = 'nvim_lsp'},
|
||||||
require('lspconfig').lua_ls.setup(lua_opts)
|
{name = 'nvim_lua'},
|
||||||
end,
|
},
|
||||||
}
|
formatting = lsp_zero.cmp_format(),
|
||||||
})
|
mapping = cmp.mapping.preset.insert({
|
||||||
end
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
}
|
[' '] = cmp.mapping.confirm({select = true}),
|
||||||
|
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-f>'] = cmp_action.luasnip_jump_forward(),
|
||||||
|
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
{
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
cmd = {'LspInfo', 'LspInstall', 'LspStart'},
|
||||||
|
event = {'BufReadPre', 'BufNewFile'},
|
||||||
|
dependencies = {
|
||||||
|
{'hrsh7th/cmp-nvim-lsp'},
|
||||||
|
{'williamboman/mason-lspconfig.nvim'},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- This is where all the LSP shenanigans will live
|
||||||
|
local lsp_zero = require('lsp-zero')
|
||||||
|
lsp_zero.extend_lspconfig()
|
||||||
|
|
||||||
|
lsp_zero.on_attach(function(client, bufnr)
|
||||||
|
-- see :help lsp-zero-keybindings
|
||||||
|
-- to learn the available actions
|
||||||
|
vim.keymap.set("n", "gd", function () vim.lsp.buf.definition() end, {buffer = bufnr, remap = false})
|
||||||
|
lsp_zero.default_keymaps({buffer = bufnr})
|
||||||
|
end)
|
||||||
|
|
||||||
|
require('mason-lspconfig').setup({
|
||||||
|
ensure_installed = {},
|
||||||
|
handlers = {
|
||||||
|
lsp_zero.default_setup,
|
||||||
|
lua_ls = function()
|
||||||
|
-- (Optional) Configure lua language server for neovim
|
||||||
|
local lua_opts = lsp_zero.nvim_lua_ls()
|
||||||
|
require('lspconfig').lua_ls.setup(lua_opts)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue