personal changes
This commit is contained in:
67
vim/.vim/lua/plugins/formatting.lua
Normal file
67
vim/.vim/lua/plugins/formatting.lua
Normal file
@ -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,
|
||||||
|
}
|
@ -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
|
|
||||||
},
|
|
||||||
}
|
|
@ -1,12 +1,15 @@
|
|||||||
|
local use_google = require("utils").use_google
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
-- event = "VimEnter",
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
"nvim-lua/lsp-status.nvim",
|
"nvim-lua/lsp-status.nvim",
|
||||||
"VonHeikemen/lsp-zero.nvim",
|
"VonHeikemen/lsp-zero.nvim",
|
||||||
"rcarriga/nvim-notify",
|
"rcarriga/nvim-notify",
|
||||||
|
"ray-x/go.nvim",
|
||||||
|
"ray-x/guihua.lua",
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>" },
|
{ "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>" },
|
||||||
@ -173,6 +176,20 @@ return {
|
|||||||
capabilities.workspace.codeLens = { refreshSupport = true }
|
capabilities.workspace.codeLens = { refreshSupport = true }
|
||||||
capabilities.workspace.diagnostics = { 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({
|
lspconfig.ciderlsp.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = cider_on_attach,
|
on_attach = cider_on_attach,
|
||||||
|
@ -4,5 +4,6 @@ return {
|
|||||||
"christoomey/vim-tmux-navigator",
|
"christoomey/vim-tmux-navigator",
|
||||||
"whatyouhide/vim-tmux-syntax",
|
"whatyouhide/vim-tmux-syntax",
|
||||||
"tmux-plugins/vim-tmux-focus-events",
|
"tmux-plugins/vim-tmux-focus-events",
|
||||||
|
-- 'jabirali/vim-tmux-yank',
|
||||||
"skywind3000/asyncrun.vim",
|
"skywind3000/asyncrun.vim",
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user