null-ls, formatting
This commit is contained in:
parent
68fd48afed
commit
a27ec9c950
|
@ -1,26 +1,25 @@
|
||||||
|
|
||||||
local set = vim.opt
|
local set = vim.opt
|
||||||
set.modelines=0
|
set.modelines = 0
|
||||||
set.hidden=true
|
set.hidden = true
|
||||||
set.number=true
|
set.number = true
|
||||||
set.ruler=true
|
set.ruler = true
|
||||||
set.visualbell=true
|
set.visualbell = true
|
||||||
set.textwidth=120
|
set.textwidth = 120
|
||||||
set.cursorline=true
|
set.cursorline = true
|
||||||
set.tabstop=2
|
set.tabstop = 2
|
||||||
set.shiftwidth=2
|
set.shiftwidth = 2
|
||||||
set.showmode=true
|
set.showmode = true
|
||||||
set.showcmd=true
|
set.showcmd = true
|
||||||
set.showmatch=true
|
set.showmatch = true
|
||||||
set.hlsearch=true
|
set.hlsearch = true
|
||||||
set.ignorecase=true
|
set.ignorecase = true
|
||||||
set.smartcase=true
|
set.smartcase = true
|
||||||
set.incsearch=true
|
set.incsearch = true
|
||||||
set.wrapscan=true
|
set.wrapscan = true
|
||||||
set.scrolloff=999
|
set.scrolloff = 999
|
||||||
set.backspace="indent,eol,start"
|
set.backspace = "indent,eol,start"
|
||||||
set.mouse="nicr"
|
set.mouse = "nicr"
|
||||||
set.termguicolors=true
|
set.termguicolors = true
|
||||||
set.matchpairs:append("<:>")
|
set.matchpairs:append("<:>")
|
||||||
set.completeopt="menuone,noselect,preview"
|
set.completeopt = "menuone,noselect,preview"
|
||||||
set.expandtab=true
|
set.expandtab = true
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
local opts = { noremap=true, silent=true }
|
local opts = { noremap = true, silent = true }
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||||
|
@ -14,7 +14,7 @@ local on_attach = function(client, bufnr)
|
||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
vim.keymap.set('n', '<leader>gD', vim.lsp.buf.declaration, bufopts)
|
vim.keymap.set('n', '<leader>gD', vim.lsp.buf.declaration, bufopts)
|
||||||
vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition, bufopts)
|
vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition, bufopts)
|
||||||
vim.keymap.set('n', '<leader>K', vim.lsp.buf.hover, bufopts)
|
vim.keymap.set('n', '<leader>K', vim.lsp.buf.hover, bufopts)
|
||||||
|
@ -29,42 +29,45 @@ local on_attach = function(client, bufnr)
|
||||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
||||||
vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references, bufopts)
|
vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references, bufopts)
|
||||||
vim.keymap.set('n', '<leader>f',function() vim.lsp.buf.format { async = true } end, bufopts)
|
vim.keymap.set('n', '<leader>f', vim.lsp.buf.formatting, bufopts)
|
||||||
end
|
end
|
||||||
|
|
||||||
local lsp_flags = {
|
local lsp_flags = {
|
||||||
-- This is the default in Nvim 0.7+
|
-- This is the default in Nvim 0.7+
|
||||||
debounce_text_changes = 150,
|
debounce_text_changes = 150,
|
||||||
}
|
}
|
||||||
require('mason-lspconfig').setup_handlers{
|
require('mason-lspconfig').setup_handlers {
|
||||||
function(server_name)
|
function(server_name)
|
||||||
require('lspconfig')[server_name].setup{
|
require('lspconfig')[server_name].setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
}
|
|
||||||
end,
|
|
||||||
['rust_analyzer'] = function()
|
|
||||||
require('rust-tools').setup {}
|
|
||||||
end,
|
|
||||||
['sumneko_lua'] = function()
|
|
||||||
require('lspconfig')["sumneko_lua"].setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
flags = lsp_flags,
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
require('lspconfig')['rust_analyzer'].setup{
|
|
||||||
on_attach = on_attach,
|
|
||||||
flags = lsp_flags,
|
|
||||||
-- Server-specific settings...
|
|
||||||
settings = {
|
|
||||||
["rust-analyzer"] = {}
|
|
||||||
}
|
}
|
||||||
|
end,
|
||||||
|
['rust_analyzer'] = function()
|
||||||
|
require('rust-tools').setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
flags = lsp_flags,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
['sumneko_lua'] = function()
|
||||||
|
require('lspconfig')["sumneko_lua"].setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
flags = lsp_flags,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
require('lspconfig')['rust_analyzer'].setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
flags = lsp_flags,
|
||||||
|
-- Server-specific settings...
|
||||||
|
settings = {
|
||||||
|
["rust-analyzer"] = {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
require("null-ls").setup({
|
require("null-ls").setup({
|
||||||
sources = {
|
sources = {
|
||||||
require("null-ls").builtins.formatting.stylua,
|
--require("null-ls").builtins.formatting.stylua,
|
||||||
require("null-ls").builtins.diagnostics.eslint,
|
|
||||||
require("null-ls").builtins.completion.spell,
|
require("null-ls").builtins.diagnostics.eslint,
|
||||||
},
|
-- require("null-ls").builtins.completion.spell,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
require('nvim-lightbulb').setup({autocmd = {enabled = true}})
|
require('nvim-lightbulb').setup({ autocmd = { enabled = true } })
|
||||||
|
|
Loading…
Reference in New Issue