From e6f3c13e2541ab130329b140bc5acd0fb1ea6c97 Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Wed, 12 Oct 2022 16:02:54 +0200 Subject: [PATCH] [neovim] Clean up --- .config/nvim/lua/user/autocommands.lua | 9 --------- .config/nvim/lua/user/autopairs.lua | 4 ++-- .config/nvim/lua/user/gitsigns.lua | 2 +- .config/nvim/lua/user/lsp/handlers.lua | 5 ----- .config/nvim/lua/user/lsp/init.lua | 4 +++- .config/nvim/lua/user/lsp/mason.lua | 5 ++--- .config/nvim/lua/user/lsp/null-ls.lua | 10 +--------- .config/nvim/lua/user/options.lua | 3 +-- .config/nvim/lua/user/plugins.lua | 9 +++------ 9 files changed, 13 insertions(+), 38 deletions(-) diff --git a/.config/nvim/lua/user/autocommands.lua b/.config/nvim/lua/user/autocommands.lua index 3727d13..fc5c024 100644 --- a/.config/nvim/lua/user/autocommands.lua +++ b/.config/nvim/lua/user/autocommands.lua @@ -14,15 +14,6 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, { end, }) --- Set wrap and spell in markdown and gitcommit -vim.api.nvim_create_autocmd({ "FileType" }, { - pattern = { "gitcommit", "markdown" }, - callback = function() - vim.opt_local.wrap = true - vim.opt_local.spell = true - end, -}) - -- Set expandtab=true in several file types vim.api.nvim_create_autocmd({ "FileType" }, { pattern = { "go", "makefile", "lua" }, diff --git a/.config/nvim/lua/user/autopairs.lua b/.config/nvim/lua/user/autopairs.lua index 3ac48b2..3c0b09b 100644 --- a/.config/nvim/lua/user/autopairs.lua +++ b/.config/nvim/lua/user/autopairs.lua @@ -5,7 +5,7 @@ if not status_ok then end npairs.setup({ - check_ts = true, -- treesitter integration + check_ts = true, disable_filetype = { "TelescopePrompt", "neo-tree" }, ts_config = { lua = { "string", "source" }, @@ -14,7 +14,7 @@ npairs.setup({ map = "", chars = { "{", "[", "(", '"', "'" }, pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), - offset = 0, -- Offset from pattern match + offset = 0, end_key = "$", keys = "qwertyuiopzxcvbnmasdfghjkl", check_comma = true, diff --git a/.config/nvim/lua/user/gitsigns.lua b/.config/nvim/lua/user/gitsigns.lua index 43c7b3f..cbdb5d7 100644 --- a/.config/nvim/lua/user/gitsigns.lua +++ b/.config/nvim/lua/user/gitsigns.lua @@ -21,7 +21,7 @@ gitsigns.setup({ update_debounce = 100, status_formatter = nil, preview_config = { - border = "single", + border = "rounded", style = "minimal", relative = "cursor", row = 0, diff --git a/.config/nvim/lua/user/lsp/handlers.lua b/.config/nvim/lua/user/lsp/handlers.lua index 0ea1235..ba544dc 100644 --- a/.config/nvim/lua/user/lsp/handlers.lua +++ b/.config/nvim/lua/user/lsp/handlers.lua @@ -62,11 +62,6 @@ local function lsp_keymaps(bufnr) keymap(bufnr, "n", "lk", "lua vim.diagnostic.goto_prev({buffer=0})", opts) keymap(bufnr, "n", "lr", "lua vim.lsp.buf.rename()", opts) keymap(bufnr, "n", "ls", "lua vim.lsp.buf.signature_help()", opts) - -- keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) - -- keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) - -- keymap(bufnr, "n", "gI", "lua vim.lsp.buf.implementation()", opts) - -- keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) - -- keymap(bufnr, "n", "lq", "lua vim.diagnostic.setloclist()", opts) end M.on_attach = function(client, bufnr) diff --git a/.config/nvim/lua/user/lsp/init.lua b/.config/nvim/lua/user/lsp/init.lua index 5bc22c4..f0553b1 100644 --- a/.config/nvim/lua/user/lsp/init.lua +++ b/.config/nvim/lua/user/lsp/init.lua @@ -1,4 +1,4 @@ -local status_ok, _ = pcall(require, "lspconfig") +local status_ok, win = pcall(require, "lspconfig.ui.windows") if not status_ok then return end @@ -6,3 +6,5 @@ end require("user.lsp.mason") require("user.lsp.handlers").setup() require("user.lsp.null-ls") + +win.default_options.border = 'rounded' diff --git a/.config/nvim/lua/user/lsp/mason.lua b/.config/nvim/lua/user/lsp/mason.lua index 5b47c36..3376b94 100644 --- a/.config/nvim/lua/user/lsp/mason.lua +++ b/.config/nvim/lua/user/lsp/mason.lua @@ -1,17 +1,16 @@ local servers = { "sumneko_lua", - "cssls", - "html", "gopls", "pyright", "bashls", "jsonls", "yamlls", + "ansiblels", } local settings = { ui = { - border = "none", + border = "rounded", icons = { package_installed = "◍", package_pending = "◍", diff --git a/.config/nvim/lua/user/lsp/null-ls.lua b/.config/nvim/lua/user/lsp/null-ls.lua index fb56b76..9d15bc9 100644 --- a/.config/nvim/lua/user/lsp/null-ls.lua +++ b/.config/nvim/lua/user/lsp/null-ls.lua @@ -8,22 +8,14 @@ local formatting = null_ls.builtins.formatting -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics local diagnostics = null_ls.builtins.diagnostics --- https://github.com/prettier-solidity/prettier-plugin-solidity null_ls.setup({ debug = false, sources = { - formatting.prettier.with({ - extra_filetypes = { "toml" }, - extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" }, - }), formatting.black.with({ extra_args = { "--fast" } }), formatting.stylua, diagnostics.golangci_lint.with({ extra_args = { "--fast" } }), - diagnostics.flake8.with({ - extra_args = { "--max-line-length=120" }, - }), diagnostics.cfn_lint, - diagnostics.shellcheck, diagnostics.hadolint, + diagnostics.markdownlint, }, }) diff --git a/.config/nvim/lua/user/options.lua b/.config/nvim/lua/user/options.lua index e5c18ec..ad9f934 100644 --- a/.config/nvim/lua/user/options.lua +++ b/.config/nvim/lua/user/options.lua @@ -23,7 +23,7 @@ vim.opt.updatetime = 300 -- faster completion (4000ms default) vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited vim.opt.cursorline = true -- highlight the current line vim.opt.number = true -- set numbered lines -vim.opt.laststatus = 3 +vim.opt.laststatus = 3 -- the last window will have a status line always and ONLY the last window vim.opt.showcmd = false vim.opt.ruler = false -- vim.opt.cc = "80" @@ -32,7 +32,6 @@ vim.opt.list = true vim.opt.expandtab = true -- convert tabs to spaces vim.opt.shiftwidth = 4 -- the number of spaces inserted for each indentation vim.opt.tabstop = 4 -- insert 4 spaces for a tab -vim.opt.numberwidth = 4 -- set number column width to 2 {default 4} vim.opt.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time vim.opt.wrap = false -- display lines as one long line vim.opt.scrolloff = 8 diff --git a/.config/nvim/lua/user/plugins.lua b/.config/nvim/lua/user/plugins.lua index 15f28de..54d3fe6 100644 --- a/.config/nvim/lua/user/plugins.lua +++ b/.config/nvim/lua/user/plugins.lua @@ -22,13 +22,11 @@ end -- augroup end -- ]]) --- Use a protected call so we don't error out on first use local status_ok, packer = pcall(require, "packer") if not status_ok then return end --- Have packer use a popup window packer.init({ display = { open_fn = function() @@ -37,7 +35,6 @@ packer.init({ }, }) --- Install your plugins here return packer.startup(function(use) -- Plugins use({ "wbthomason/packer.nvim", commit = "6afb67460283f0e990d35d229fd38fdc04063e0a" }) @@ -75,7 +72,7 @@ return packer.startup(function(use) use({ "saadparwaiz1/cmp_luasnip", commit = "a9de941bcbda508d0a45d28ae366bb3f08db2e36" }) use({ "hrsh7th/cmp-nvim-lsp", commit = "affe808a5c56b71630f17aa7c38e15c59fd648a8" }) - -- snippets + -- Snippets use({ "L3MON4D3/LuaSnip", tag = "v1.*" }) use({ "rafamadriz/friendly-snippets", commit = "6cd7469403fd06a3840a1065728d1affe1c23ec8" }) @@ -107,7 +104,7 @@ return packer.startup(function(use) use({ "ravenxrz/DAPInstall.nvim", commit = "8798b4c36d33723e7bba6ed6e2c202f84bb300de" }) use({ "theHamsta/nvim-dap-virtual-text", commit = "2971ce3e89b1711cc26e27f73d3f854b559a77d4" }) - -- golang + -- Go use({ "ray-x/go.nvim", commit = "1aef2d60bd220a8d58a0b5fed6af696b6244ce1d" }) use({ "ray-x/guihua.lua", @@ -121,7 +118,7 @@ return packer.startup(function(use) end, }) - -- markdown + -- Markdown use({ "mzlogin/vim-markdown-toc", commit = "7ec05df27b4922830ace2246de36ac7e53bea1db" }) use({ "iamcco/markdown-preview.nvim",