1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-23 00:18:00 +00:00

[neovim] Clean up

This commit is contained in:
Daniel Carrillo 2022-10-12 16:02:54 +02:00
parent adefa851d7
commit e6f3c13e25
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
9 changed files with 13 additions and 38 deletions

View File

@ -14,15 +14,6 @@ vim.api.nvim_create_autocmd({ "TextYankPost" }, {
end, 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 -- Set expandtab=true in several file types
vim.api.nvim_create_autocmd({ "FileType" }, { vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "go", "makefile", "lua" }, pattern = { "go", "makefile", "lua" },

View File

@ -5,7 +5,7 @@ if not status_ok then
end end
npairs.setup({ npairs.setup({
check_ts = true, -- treesitter integration check_ts = true,
disable_filetype = { "TelescopePrompt", "neo-tree" }, disable_filetype = { "TelescopePrompt", "neo-tree" },
ts_config = { ts_config = {
lua = { "string", "source" }, lua = { "string", "source" },
@ -14,7 +14,7 @@ npairs.setup({
map = "<M-e>", map = "<M-e>",
chars = { "{", "[", "(", '"', "'" }, chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, -- Offset from pattern match offset = 0,
end_key = "$", end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl", keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true, check_comma = true,

View File

@ -21,7 +21,7 @@ gitsigns.setup({
update_debounce = 100, update_debounce = 100,
status_formatter = nil, status_formatter = nil,
preview_config = { preview_config = {
border = "single", border = "rounded",
style = "minimal", style = "minimal",
relative = "cursor", relative = "cursor",
row = 0, row = 0,

View File

@ -62,11 +62,6 @@ local function lsp_keymaps(bufnr)
keymap(bufnr, "n", "<leader>lk", "<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>", opts) keymap(bufnr, "n", "<leader>lk", "<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>", opts)
keymap(bufnr, "n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<cr>", opts) keymap(bufnr, "n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<cr>", opts)
keymap(bufnr, "n", "<leader>ls", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) keymap(bufnr, "n", "<leader>ls", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
-- keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
-- keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
-- keymap(bufnr, "n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
-- keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
-- keymap(bufnr, "n", "<leader>lq", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
end end
M.on_attach = function(client, bufnr) M.on_attach = function(client, bufnr)

View File

@ -1,4 +1,4 @@
local status_ok, _ = pcall(require, "lspconfig") local status_ok, win = pcall(require, "lspconfig.ui.windows")
if not status_ok then if not status_ok then
return return
end end
@ -6,3 +6,5 @@ end
require("user.lsp.mason") require("user.lsp.mason")
require("user.lsp.handlers").setup() require("user.lsp.handlers").setup()
require("user.lsp.null-ls") require("user.lsp.null-ls")
win.default_options.border = 'rounded'

View File

@ -1,17 +1,16 @@
local servers = { local servers = {
"sumneko_lua", "sumneko_lua",
"cssls",
"html",
"gopls", "gopls",
"pyright", "pyright",
"bashls", "bashls",
"jsonls", "jsonls",
"yamlls", "yamlls",
"ansiblels",
} }
local settings = { local settings = {
ui = { ui = {
border = "none", border = "rounded",
icons = { icons = {
package_installed = "", package_installed = "",
package_pending = "", package_pending = "",

View File

@ -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 -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
local diagnostics = null_ls.builtins.diagnostics local diagnostics = null_ls.builtins.diagnostics
-- https://github.com/prettier-solidity/prettier-plugin-solidity
null_ls.setup({ null_ls.setup({
debug = false, debug = false,
sources = { sources = {
formatting.prettier.with({
extra_filetypes = { "toml" },
extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" },
}),
formatting.black.with({ extra_args = { "--fast" } }), formatting.black.with({ extra_args = { "--fast" } }),
formatting.stylua, formatting.stylua,
diagnostics.golangci_lint.with({ extra_args = { "--fast" } }), diagnostics.golangci_lint.with({ extra_args = { "--fast" } }),
diagnostics.flake8.with({
extra_args = { "--max-line-length=120" },
}),
diagnostics.cfn_lint, diagnostics.cfn_lint,
diagnostics.shellcheck,
diagnostics.hadolint, diagnostics.hadolint,
diagnostics.markdownlint,
}, },
}) })

View File

@ -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.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.cursorline = true -- highlight the current line
vim.opt.number = true -- set numbered lines 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.showcmd = false
vim.opt.ruler = false vim.opt.ruler = false
-- vim.opt.cc = "80" -- vim.opt.cc = "80"
@ -32,7 +32,6 @@ vim.opt.list = true
vim.opt.expandtab = true -- convert tabs to spaces vim.opt.expandtab = true -- convert tabs to spaces
vim.opt.shiftwidth = 4 -- the number of spaces inserted for each indentation vim.opt.shiftwidth = 4 -- the number of spaces inserted for each indentation
vim.opt.tabstop = 4 -- insert 4 spaces for a tab 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.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.wrap = false -- display lines as one long line
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8

View File

@ -22,13 +22,11 @@ end
-- augroup end -- augroup end
-- ]]) -- ]])
-- Use a protected call so we don't error out on first use
local status_ok, packer = pcall(require, "packer") local status_ok, packer = pcall(require, "packer")
if not status_ok then if not status_ok then
return return
end end
-- Have packer use a popup window
packer.init({ packer.init({
display = { display = {
open_fn = function() open_fn = function()
@ -37,7 +35,6 @@ packer.init({
}, },
}) })
-- Install your plugins here
return packer.startup(function(use) return packer.startup(function(use)
-- Plugins -- Plugins
use({ "wbthomason/packer.nvim", commit = "6afb67460283f0e990d35d229fd38fdc04063e0a" }) use({ "wbthomason/packer.nvim", commit = "6afb67460283f0e990d35d229fd38fdc04063e0a" })
@ -75,7 +72,7 @@ return packer.startup(function(use)
use({ "saadparwaiz1/cmp_luasnip", commit = "a9de941bcbda508d0a45d28ae366bb3f08db2e36" }) use({ "saadparwaiz1/cmp_luasnip", commit = "a9de941bcbda508d0a45d28ae366bb3f08db2e36" })
use({ "hrsh7th/cmp-nvim-lsp", commit = "affe808a5c56b71630f17aa7c38e15c59fd648a8" }) use({ "hrsh7th/cmp-nvim-lsp", commit = "affe808a5c56b71630f17aa7c38e15c59fd648a8" })
-- snippets -- Snippets
use({ "L3MON4D3/LuaSnip", tag = "v1.*" }) use({ "L3MON4D3/LuaSnip", tag = "v1.*" })
use({ "rafamadriz/friendly-snippets", commit = "6cd7469403fd06a3840a1065728d1affe1c23ec8" }) use({ "rafamadriz/friendly-snippets", commit = "6cd7469403fd06a3840a1065728d1affe1c23ec8" })
@ -107,7 +104,7 @@ return packer.startup(function(use)
use({ "ravenxrz/DAPInstall.nvim", commit = "8798b4c36d33723e7bba6ed6e2c202f84bb300de" }) use({ "ravenxrz/DAPInstall.nvim", commit = "8798b4c36d33723e7bba6ed6e2c202f84bb300de" })
use({ "theHamsta/nvim-dap-virtual-text", commit = "2971ce3e89b1711cc26e27f73d3f854b559a77d4" }) use({ "theHamsta/nvim-dap-virtual-text", commit = "2971ce3e89b1711cc26e27f73d3f854b559a77d4" })
-- golang -- Go
use({ "ray-x/go.nvim", commit = "1aef2d60bd220a8d58a0b5fed6af696b6244ce1d" }) use({ "ray-x/go.nvim", commit = "1aef2d60bd220a8d58a0b5fed6af696b6244ce1d" })
use({ use({
"ray-x/guihua.lua", "ray-x/guihua.lua",
@ -121,7 +118,7 @@ return packer.startup(function(use)
end, end,
}) })
-- markdown -- Markdown
use({ "mzlogin/vim-markdown-toc", commit = "7ec05df27b4922830ace2246de36ac7e53bea1db" }) use({ "mzlogin/vim-markdown-toc", commit = "7ec05df27b4922830ace2246de36ac7e53bea1db" })
use({ use({
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",