From 3cff31086370efdb182f745daeb76009c131930a Mon Sep 17 00:00:00 2001 From: Christian Nieves Date: Fri, 20 Oct 2023 14:55:50 -0500 Subject: [PATCH] personal changes --- vim/.vim/lua/plugins/formatting.lua | 67 +++++++++++++++++++++++++++++ vim/.vim/lua/plugins/go.lua | 24 ----------- vim/.vim/lua/plugins/lsp.lua | 19 +++++++- vim/.vim/lua/plugins/tmux.lua | 13 +++--- 4 files changed, 92 insertions(+), 31 deletions(-) create mode 100644 vim/.vim/lua/plugins/formatting.lua delete mode 100644 vim/.vim/lua/plugins/go.lua diff --git a/vim/.vim/lua/plugins/formatting.lua b/vim/.vim/lua/plugins/formatting.lua new file mode 100644 index 0000000..1bde10e --- /dev/null +++ b/vim/.vim/lua/plugins/formatting.lua @@ -0,0 +1,67 @@ +return { + "mhartington/formatter.nvim", + config = function() + -- Utilities for creating configurations + local util = require("formatter.util") + vim.cmd([[ + augroup FormatAutogroup + autocmd! + autocmd BufWritePost * FormatWrite + augroup END + ]]) + + -- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands + require("formatter").setup({ + -- Enable or disable logging + logging = true, + -- Set the log level + log_level = vim.log.levels.WARN, + -- All formatter configurations are opt-in + filetype = { + -- Formatter configurations for filetype "lua" go here + -- and will be executed in order + lua = { + -- "formatter.filetypes.lua" defines default configurations for the + -- "lua" filetype + require("formatter.filetypes.lua").stylua, + }, + xml = { + function() + return { + exe = "tidy", + args = { + "-xml", + "-quiet", + "-wrap", + "--tidy-mark", + "no", + "--indent", + "yes", + "--indent-spaces", + "2", + "--indent-attributes", + "yes", + "--sort-attributes", + "alpha", + "--wrap-attributes", + "yes", + "--vertical-space", + "yes", + "-", + }, + stdin = true, + } + end, + }, + + -- Use the special "*" filetype for defining formatter configurations on + -- any filetype + ["*"] = { + -- "formatter.filetypes.any" defines default configurations for any + -- filetype + require("formatter.filetypes.any").remove_trailing_whitespace, + }, + }, + }) + end, +} diff --git a/vim/.vim/lua/plugins/go.lua b/vim/.vim/lua/plugins/go.lua deleted file mode 100644 index ff20f75..0000000 --- a/vim/.vim/lua/plugins/go.lua +++ /dev/null @@ -1,24 +0,0 @@ -return { - { - "ray-x/go.nvim", - dependencies = { -- optional packages - "ray-x/guihua.lua", - "neovim/nvim-lspconfig", - "nvim-treesitter/nvim-treesitter", - }, - config = function() - require("go").setup() - local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {}) - vim.api.nvim_create_autocmd("BufWritePre", { - pattern = "*.go", - callback = function() - require("go.format").goimport() - end, - group = format_sync_grp, - }) - end, - event = { "CmdlineEnter" }, - ft = { "go", "gomod" }, - build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries - }, -} diff --git a/vim/.vim/lua/plugins/lsp.lua b/vim/.vim/lua/plugins/lsp.lua index 4b66b44..7e2b52c 100644 --- a/vim/.vim/lua/plugins/lsp.lua +++ b/vim/.vim/lua/plugins/lsp.lua @@ -1,12 +1,15 @@ +local use_google = require("utils").use_google + return { { "neovim/nvim-lspconfig", - -- event = "VimEnter", dependencies = { "hrsh7th/nvim-cmp", "nvim-lua/lsp-status.nvim", "VonHeikemen/lsp-zero.nvim", "rcarriga/nvim-notify", + "ray-x/go.nvim", + "ray-x/guihua.lua", }, keys = { { "rn", "lua vim.lsp.buf.rename()" }, @@ -173,6 +176,20 @@ return { capabilities.workspace.codeLens = { refreshSupport = true } capabilities.workspace.diagnostics = { refreshSupport = true } + require("go").setup({ + lsp_cfg = { + capabilities = capabilities, + }, + }) + local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {}) + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*.go", + callback = function() + require("go.format").goimport() + end, + group = format_sync_grp, + }) + lspconfig.ciderlsp.setup({ capabilities = capabilities, on_attach = cider_on_attach, diff --git a/vim/.vim/lua/plugins/tmux.lua b/vim/.vim/lua/plugins/tmux.lua index 6f2decf..d1f342d 100644 --- a/vim/.vim/lua/plugins/tmux.lua +++ b/vim/.vim/lua/plugins/tmux.lua @@ -1,8 +1,9 @@ return { - "preservim/vimux", - "tmux-plugins/vim-tmux", - "christoomey/vim-tmux-navigator", - "whatyouhide/vim-tmux-syntax", - "tmux-plugins/vim-tmux-focus-events", - "skywind3000/asyncrun.vim", + "preservim/vimux", + "tmux-plugins/vim-tmux", + "christoomey/vim-tmux-navigator", + "whatyouhide/vim-tmux-syntax", + "tmux-plugins/vim-tmux-focus-events", + -- 'jabirali/vim-tmux-yank', + "skywind3000/asyncrun.vim", }