From a27ec9c950730b2d20d660bb490c18aaa63c141f Mon Sep 17 00:00:00 2001 From: mightypanders Date: Wed, 31 Aug 2022 21:53:08 +0200 Subject: [PATCH] null-ls, formatting --- nvim/lua/globals_opts.lua | 47 ++++++++++---------- nvim/lua/new_lsp_conf.lua | 69 ++++++++++++++++-------------- nvim/lua/null-ls_config.lua | 12 +++--- nvim/lua/nvim-lightbulb_config.lua | 2 +- 4 files changed, 66 insertions(+), 64 deletions(-) diff --git a/nvim/lua/globals_opts.lua b/nvim/lua/globals_opts.lua index 78f8043..cb19730 100644 --- a/nvim/lua/globals_opts.lua +++ b/nvim/lua/globals_opts.lua @@ -1,26 +1,25 @@ - local set = vim.opt -set.modelines=0 -set.hidden=true -set.number=true -set.ruler=true -set.visualbell=true -set.textwidth=120 -set.cursorline=true -set.tabstop=2 -set.shiftwidth=2 -set.showmode=true -set.showcmd=true -set.showmatch=true -set.hlsearch=true -set.ignorecase=true -set.smartcase=true -set.incsearch=true -set.wrapscan=true -set.scrolloff=999 -set.backspace="indent,eol,start" -set.mouse="nicr" -set.termguicolors=true +set.modelines = 0 +set.hidden = true +set.number = true +set.ruler = true +set.visualbell = true +set.textwidth = 120 +set.cursorline = true +set.tabstop = 2 +set.shiftwidth = 2 +set.showmode = true +set.showcmd = true +set.showmatch = true +set.hlsearch = true +set.ignorecase = true +set.smartcase = true +set.incsearch = true +set.wrapscan = true +set.scrolloff = 999 +set.backspace = "indent,eol,start" +set.mouse = "nicr" +set.termguicolors = true set.matchpairs:append("<:>") -set.completeopt="menuone,noselect,preview" -set.expandtab=true +set.completeopt = "menuone,noselect,preview" +set.expandtab = true diff --git a/nvim/lua/new_lsp_conf.lua b/nvim/lua/new_lsp_conf.lua index cc8ff06..d3161f6 100644 --- a/nvim/lua/new_lsp_conf.lua +++ b/nvim/lua/new_lsp_conf.lua @@ -1,6 +1,6 @@ -- Mappings. -- 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', 'e', vim.diagnostic.open_float, opts) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) @@ -14,7 +14,7 @@ local on_attach = function(client, bufnr) -- Mappings. -- 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', 'gD', vim.lsp.buf.declaration, bufopts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) @@ -29,42 +29,45 @@ local on_attach = function(client, bufnr) vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'f',function() vim.lsp.buf.format { async = true } end, bufopts) + vim.keymap.set('n', 'f', vim.lsp.buf.formatting, bufopts) end local lsp_flags = { -- This is the default in Nvim 0.7+ debounce_text_changes = 150, } -require('mason-lspconfig').setup_handlers{ - function(server_name) - require('lspconfig')[server_name].setup{ - on_attach = on_attach, - 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"] = {} +require('mason-lspconfig').setup_handlers { + function(server_name) + require('lspconfig')[server_name].setup { + on_attach = on_attach, + flags = lsp_flags, } + 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"] = {} + } } diff --git a/nvim/lua/null-ls_config.lua b/nvim/lua/null-ls_config.lua index 28fe85d..64cda5d 100644 --- a/nvim/lua/null-ls_config.lua +++ b/nvim/lua/null-ls_config.lua @@ -1,8 +1,8 @@ - require("null-ls").setup({ - sources = { - require("null-ls").builtins.formatting.stylua, - require("null-ls").builtins.diagnostics.eslint, - require("null-ls").builtins.completion.spell, - }, + sources = { + --require("null-ls").builtins.formatting.stylua, + + require("null-ls").builtins.diagnostics.eslint, + -- require("null-ls").builtins.completion.spell, + }, }) diff --git a/nvim/lua/nvim-lightbulb_config.lua b/nvim/lua/nvim-lightbulb_config.lua index b4cdd06..a7a9204 100644 --- a/nvim/lua/nvim-lightbulb_config.lua +++ b/nvim/lua/nvim-lightbulb_config.lua @@ -1 +1 @@ -require('nvim-lightbulb').setup({autocmd = {enabled = true}}) +require('nvim-lightbulb').setup({ autocmd = { enabled = true } })