4 Commits

6 changed files with 328 additions and 181 deletions

View File

@@ -22,11 +22,34 @@ return {
try_node_modules = true, try_node_modules = true,
} }
end, end,
swift = function()
return {
exe = "swiftformat",
}
end,
["*"] = { ["*"] = {
-- formatter for any / all file types. -- formatter for any / all file types.
require("formatter.filetypes.any").remove_trailing_whitespace require("formatter.filetypes.any").remove_trailing_whitespace
} }
} }
}) })
-- Keymaps
local wk = require('which-key')
wk.add({
{ "<space>f", ":Format", desc = "[F]ormat" },
{ "<space>F", ":FormateWrite", desc = "[F]ormat write" }
},
{ mode = 'n', silent = true }
)
local augroup = vim.api.nvim_create_augroup
local autocmd = vim.api.nvim_create_autocmd
augroup("__formatter__", { clear = true })
autocmd("BufWritePost", {
group = "__formatter__",
command = ":FormatWrite"
})
end end
} }

View File

@@ -34,190 +34,286 @@ return {
} }
} }
}, },
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
dependencies = { event = { "BufReadPost", "BufNewFile" },
"hrsh7th/cmp-nvim-lsp", cmd = { "LspInfo", "LspInstall", "LspUninstall", "LspStart", "LspStop", "LspRestart" },
},
config = function() config = function()
require('neodev').setup() require('neodev').setup()
require("mason").setup() require("mason").setup()
require("mason-lspconfig").setup() require("mason-lspconfig").setup()
local nvim_lsp = require("lspconfig") local lspconfig = require('lspconfig')
local telescope_builtin = require('telescope.builtin')
vim.api.nvim_create_autocmd('LspAttach', { lspconfig.bashls.setup {}
group = vim.api.nvim_create_augroup('my-lsp-attach', { clear = true }), lspconfig.clangd.setup {}
callback = function(event) lspconfig.dockerls.setup {}
-- Helper function to create a keymap. lspconfig.gopls.setup {}
local map = function(keys, func, desc) lspconfig.jsonls.setup {}
vim.keymap.set('n', keys, func, { buffer = true, desc = 'LSP: ' .. desc }) lspconfig.lua_ls.setup {}
end lspconfig.marksman.setup {}
lspconfig.yamlls.setup {}
-- Mappings. lspconfig.sourcekit.setup({
-- See `:help vim.lsp.*` for documentation on any of the below functions capabilities = {
workspace = {
map('[d', '<CMD>lua vim.lsp.diagnostic.goto_prev()<CR>', 'Goto previous') didChangeWatchedFiles = {
map(']d', '<CMD>lua vim.lsp.diagnostic.goto_next()<CR>', 'Goto next') dynamicRegistration = true,
map('<space>ca', vim.lsp.buf.code_action, '[C]ode [A]ction') },
map('<space>D', vim.lsp.buf.type_definition, 'Type [D]efinition') },
map('<space>f', vim.lsp.buf.format, '[F]ormat') },
map('<space>rn', vim.lsp.buf.rename, '[R]e[n]ame')
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
map('gd', telescope_builtin.lsp_definitions, '[G]oto [D]efinition')
map('gi', telescope_builtin.lsp_implementations, '[G]oto, [I]mplementation')
map('gr', telescope_builtin.lsp_references, '[G]oto [R]eferences')
map('gt', telescope_builtin.lsp_type_definitions, '[T]ype Definitions')
map('K', vim.lsp.buf.hover, 'Hover Documentation')
-- -- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
-- buf_set_keymap("n", "<space>wa",
-- "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
-- buf_set_keymap("n", "<space>wr",
-- "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
-- buf_set_keymap("n", "<space>wl",
-- "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>",
-- opts)
-- buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
-- buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
vim.api.nvim_buf_set_option(event.buf, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
end,
}) })
-- Use a loop to conveniently call 'setup' on multiple servers and vim.api.nvim_create_autocmd('LspAttach', {
-- map buffer local keybindings when the language server attaches desc = 'LSP Actions',
local capabilities = vim.lsp.protocol.make_client_capabilities() callback = function(args)
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) -- Configure keybindings once we've attached.
local wk = require('which-key')
local servers = { wk.add({
"bashls", { "K", vim.lsp.buf.hover, desc = "LSP hover info" },
"clangd", { "gd", vim.lsp.buf.definition, desc = "[G]oto [D]efinition" },
"dockerls", { "gD", vim.lsp.buf.declaration, desc = "[G]oto [D]eclaration" },
"gopls", { "gi", vim.lsp.buf.implementation, desc = "[G]oto [I]mplementation" },
"jsonls", { "gr", vim.lsp.buf.references, desc = "List [R]eferences" },
"jedi_language_server", {"gs", vim.lsp.buf.signature_help, desc = "[S]ignature help" },
"lua_ls", { "<space>rn", vim.lsp.buf.rename, desc = "[R]e[N]ame" },
"marksman", { "[d", vim.diagnostic.goto_prev, desc = "Go to previous diagnostic" },
"sourcekit", { "]d", vim.diagnostic.goto_prev, desc = "Go to next diagnostic" },
"terraformls", }, {
"ts_ls", mode = 'n',
"texlab", silent = true
"yamlls",
}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
capabilities = capabilities,
settings = {
gopls = {
experimentalPostfixCompletions = true,
analyses = {
unusedparams = true,
shadow = true
},
staticcheck = true
},
lua_ls = {
Lua = {
completion = {
callSnippet = "Replace"
},
workspace = { checkThirdParty = false },
telemetry = { enable = false },
}
},
json = {
format = {enabled = false},
schemas = {
{
description = "ESLint config",
fileMatch = {".eslintrc.json", ".eslintrc"},
url = "http://json.schemastore.org/eslintrc"
}, {
description = "Package config",
fileMatch = {"package.json"},
url = "https://json.schemastore.org/package"
}, {
description = "Packer config",
fileMatch = {"packer.json"},
url = "https://json.schemastore.org/packer"
}, {
description = "Renovate config",
fileMatch = {
"renovate.json", "renovate.json5",
".github/renovate.json", ".github/renovate.json5",
".renovaterc", ".renovaterc.json"
},
url = "https://docs.renovatebot.com/renovate-schema"
}, {
description = "OpenApi config",
fileMatch = {"*api*.json"},
url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"
}
}
},
redhat = {telemetry = {enabled = false}},
texlab = {
auxDirectory = ".",
bibtexFormatter = "texlab",
build = {
args = {
"--keep-intermediates", "--keep-logs", "--synctex", "%f"
},
executable = "tectonic",
forwardSearchAfter = false,
onSave = false
},
chktex = {onEdit = false, onOpenAndSave = false},
diagnosticsDelay = 300,
formatterLineLength = 80,
forwardSearch = {args = {}},
latexFormatter = "latexindent",
latexindent = {modifyLineBreaks = false}
},
yaml = {
schemaStore = {
enable = true,
url = "https://www.schemastore.org/api/json/catalog.json"
},
schemas = {
kubernetes = "/*.yaml",
["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}",
["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
["http://json.schemastore.org/prettierrc"] = ".prettierrc.{yml,yaml}",
["http://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}",
["http://json.schemastore.org/ansible-playbook"] = "*play*.{yml,yaml}",
["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}",
["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}",
["https://json.schemastore.org/gitlab-ci"] = "*gitlab-ci*.{yml,yaml}",
["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}",
["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose.{yml,yaml}",
["https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json"] = "*flow*.{yml,yaml}"
},
format = {enabled = false},
validate = false, -- TODO: conflicts between Kubernetes resources and kustomization.yaml
completion = true,
hover = true
}
},
flags = {debounce_text_changes = 150}
}
require"lsp_signature".setup({
bind = true, -- This is mandatory, otherwise border config won't get registered.
floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
doc_lines = 2, -- Set to 0 for not showing doc
hint_prefix = "🐼 ",
-- use_lspsaga = false, -- set to true if you want to use lspsaga popup
handler_opts = {
border = "shadow" -- double, single, shadow, none
}
}) })
end end,
})
-- Test source-kit
require('lspconfig').sourcekit.setup{}
end end
} }
} }
-- return {
-- {
-- "williamboman/nvim-lsp-installer",
-- config = function()
-- require("nvim-lsp-installer").setup({})
-- end
-- },
-- {
-- "williamboman/mason-lspconfig.nvim",
-- dependencies = {
-- "williamboman/mason.nvim",
-- "onsails/lspkind-nvim",
-- "famiu/bufdelete.nvim",
-- "ray-x/lsp_signature.nvim",
-- "neovim/nvim-lspconfig",
-- "folke/neodev.nvim",
-- "mhartington/formatter.nvim",
-- "ray-x/go.nvim",
-- },
-- opts = {
-- ensure_installed = {
-- "bashls",
-- "clangd",
-- "dockerls",
-- "gopls",
-- "jsonls",
-- "jedi_language_server",
-- "lua_ls",
-- "marksman",
-- "terraformls",
-- "ts_ls",
-- "texlab",
-- "yamlls",
-- }
-- }
-- },
-- {
-- "neovim/nvim-lspconfig",
-- dependencies = {
-- "hrsh7th/cmp-nvim-lsp",
-- },
-- config = function()
-- require('neodev').setup()
-- require("mason").setup()
-- require("mason-lspconfig").setup()
-- local nvim_lsp = require("lspconfig")
-- local telescope_builtin = require('telescope.builtin')
--
-- vim.api.nvim_create_autocmd('LspAttach', {
-- group = vim.api.nvim_create_augroup('my-lsp-attach', { clear = true }),
-- callback = function(event)
-- -- Helper function to create a keymap.
-- local map = function(keys, func, desc)
-- vim.keymap.set('n', keys, func, { buffer = true, desc = 'LSP: ' .. desc })
-- end
--
-- -- Mappings.
-- -- See `:help vim.lsp.*` for documentation on any of the below functions
--
-- map('[d', '<CMD>lua vim.lsp.diagnostic.goto_prev()<CR>', 'Goto previous')
-- map(']d', '<CMD>lua vim.lsp.diagnostic.goto_next()<CR>', 'Goto next')
-- map('<space>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
-- map('<space>rn', vim.lsp.buf.rename, '[R]e[n]ame')
-- map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-- map('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
-- map('gi', telescope_builtin.lsp_implementations, '[G]oto, [I]mplementation')
-- map('gr', telescope_builtin.lsp_references, '[G]oto [R]eferences')
-- map('gt', telescope_builtin.lsp_type_definitions, '[T]ype Definitions')
-- map('K', vim.lsp.buf.hover, 'Hover Documentation')
--
-- -- -- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
-- -- buf_set_keymap("n", "<space>wa",
-- -- "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
-- -- buf_set_keymap("n", "<space>wr",
-- -- "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
-- -- buf_set_keymap("n", "<space>wl",
-- -- "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>",
-- -- opts)
-- -- buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
-- -- buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
-- vim.api.nvim_buf_set_option(event.buf, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- end,
-- })
--
-- -- Use a loop to conveniently call 'setup' on multiple servers and
-- -- map buffer local keybindings when the language server attaches
-- local capabilities = vim.lsp.protocol.make_client_capabilities()
-- capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
--
-- local servers = {
-- "bashls",
-- "clangd",
-- "dockerls",
-- "gopls",
-- "jsonls",
-- "jedi_language_server",
-- "lua_ls",
-- "marksman",
-- "sourcekit",
-- "terraformls",
-- "ts_ls",
-- "texlab",
-- "yamlls",
-- }
--
-- for _, lsp in ipairs(servers) do
-- nvim_lsp[lsp].setup {
-- capabilities = capabilities,
-- settings = {
-- gopls = {
-- experimentalPostfixCompletions = true,
-- analyses = {
-- unusedparams = true,
-- shadow = true
-- },
-- staticcheck = true
-- },
-- lua_ls = {
-- Lua = {
-- completion = {
-- callSnippet = "Replace"
-- },
-- workspace = { checkThirdParty = false },
-- telemetry = { enable = false },
-- }
-- },
-- json = {
-- format = {enabled = false},
-- schemas = {
-- {
-- description = "ESLint config",
-- fileMatch = {".eslintrc.json", ".eslintrc"},
-- url = "http://json.schemastore.org/eslintrc"
-- }, {
-- description = "Package config",
-- fileMatch = {"package.json"},
-- url = "https://json.schemastore.org/package"
-- }, {
-- description = "Packer config",
-- fileMatch = {"packer.json"},
-- url = "https://json.schemastore.org/packer"
-- }, {
-- description = "Renovate config",
-- fileMatch = {
-- "renovate.json", "renovate.json5",
-- ".github/renovate.json", ".github/renovate.json5",
-- ".renovaterc", ".renovaterc.json"
-- },
-- url = "https://docs.renovatebot.com/renovate-schema"
-- }, {
-- description = "OpenApi config",
-- fileMatch = {"*api*.json"},
-- url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"
-- }
-- }
-- },
-- redhat = {telemetry = {enabled = false}},
-- texlab = {
-- auxDirectory = ".",
-- bibtexFormatter = "texlab",
-- build = {
-- args = {
-- "--keep-intermediates", "--keep-logs", "--synctex", "%f"
-- },
-- executable = "tectonic",
-- forwardSearchAfter = false,
-- onSave = false
-- },
-- chktex = {onEdit = false, onOpenAndSave = false},
-- diagnosticsDelay = 300,
-- formatterLineLength = 80,
-- forwardSearch = {args = {}},
-- latexFormatter = "latexindent",
-- latexindent = {modifyLineBreaks = false}
-- },
-- yaml = {
-- schemaStore = {
-- enable = true,
-- url = "https://www.schemastore.org/api/json/catalog.json"
-- },
-- schemas = {
-- kubernetes = "/*.yaml",
-- ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}",
-- ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
-- ["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
-- ["http://json.schemastore.org/prettierrc"] = ".prettierrc.{yml,yaml}",
-- ["http://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}",
-- ["http://json.schemastore.org/ansible-playbook"] = "*play*.{yml,yaml}",
-- ["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}",
-- ["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}",
-- ["https://json.schemastore.org/gitlab-ci"] = "*gitlab-ci*.{yml,yaml}",
-- ["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}",
-- ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose.{yml,yaml}",
-- ["https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json"] = "*flow*.{yml,yaml}"
-- },
-- format = {enabled = false},
-- validate = false, -- TODO: conflicts between Kubernetes resources and kustomization.yaml
-- completion = true,
-- hover = true
-- }
-- },
-- flags = {debounce_text_changes = 150}
-- }
-- require"lsp_signature".setup({
-- bind = true, -- This is mandatory, otherwise border config won't get registered.
-- floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
-- doc_lines = 2, -- Set to 0 for not showing doc
-- hint_prefix = "🐼 ",
-- -- use_lspsaga = false, -- set to true if you want to use lspsaga popup
-- handler_opts = {
-- border = "shadow" -- double, single, shadow, none
-- }
-- })
-- end
--
-- -- Test source-kit
-- require('lspconfig').sourcekit.setup{
-- capabilities = {
-- workspace = {
-- didChangeWatchedFiles = {
-- dynamicRegistration = true
-- }
-- }
-- }
-- }
--
-- end
-- }
-- }

View File

@@ -0,0 +1,24 @@
return {
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
local lint = require("lint")
lint.linters_by_ft = {
swift = { "swiftlint" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufWritePost", "BufReadPost", "InsertLeave", "TextChanged" }, {
group = lint_augroup,
callback = function()
require("lint").try_lint()
end,
})
vim.keymap.set("n", "<leader>ml", function()
require("lint").try_lint()
end, { desc = "Lint file" })
end,
}

View File

@@ -34,6 +34,7 @@ require("lazy").setup({
{ import = 'user.plugin.treesitter' }, { import = 'user.plugin.treesitter' },
{ import = 'user.plugin.formatter' }, { import = 'user.plugin.formatter' },
{ import = 'user.plugin.go' }, { import = 'user.plugin.go' },
{ import = 'user.plugin.nvim-lint' },
--{'fladson/vim-kitty', lazy=true, }, --{'fladson/vim-kitty', lazy=true, },
-- Navigation -- -- Navigation --

View File

@@ -1,5 +1,7 @@
"$schema" = 'https://starship.rs/config-schema.json' "$schema" = 'https://starship.rs/config-schema.json'
command_timeout = 1000
format = """ format = """
[](color_orange)\ [](color_orange)\
$os\ $os\

View File

@@ -28,15 +28,16 @@ export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
# Directories # Directories
export ARCHIVE="/Volumes/Archive" export ARCHIVE="/Volumes/Archive"
export BUCKET="/Volumes/Bucket" export BUCKET="/Volumes/Bucket"
export REPOS="$BUCKET/Repos" export REPOS="/Volumes/Bucket/Repos"
export GHREPOS="$REPOS/github.com/$GITUSER" export GHREPOS="$REPOS/github.com"
export HHEREPOS="$REPOS/github.com/hhe-dev" #export HHEREPOS="$REPOS/github.com/hhe-dev"
#export HVACIOTREPOS="$REPOS/github.com/hvac-iot"
export LOCAL_REPOS="$REPOS/local" export LOCAL_REPOS="$REPOS/local"
export LOCAL_ENV="$XDG_DATA_HOME/zsh/env.zsh" export LOCAL_ENV="$XDG_DATA_HOME/zsh/env.zsh"
export HCP_NOTES="$HHEREPOS/hcp-notes" #export HCP_NOTES="$HHEREPOS/hcp-notes"
export HXZET="$BUCKET/Repos/github.com/hvac-hx/hx-zets" #export HXZET="$BUCKET/Repos/github.com/hvac-hx/hx-zets"
export HAAS="$BUCKET/Repos/github.com/haas" #export HAAS="$BUCKET/Repos/github.com/haas"
export HAASZET="$HAAS/zets" #export HAASZET="$HAAS/zets"
export DOCUMENTS="$HOME/Documents" export DOCUMENTS="$HOME/Documents"
export DOWNLOADS="$HOME/Downloads" export DOWNLOADS="$HOME/Downloads"
export PDFS="$HOME/Library/Mobile Documents/com~apple~Preview/Documents" export PDFS="$HOME/Library/Mobile Documents/com~apple~Preview/Documents"
@@ -87,7 +88,7 @@ export ANSIBLE_VAULT_PASSWORD_FILE="$XDG_DATA_HOME/ansible/.vaultpwd"
export DEFAULT_VAULT_PASSWORD_FILE="$XDG_DATA_HOME/ansible/.vaultpwd" export DEFAULT_VAULT_PASSWORD_FILE="$XDG_DATA_HOME/ansible/.vaultpwd"
# Tmux-Sessionator path. # Tmux-Sessionator path.
export TMUX_SESSIONATOR_PATH="$HOME:$SCRIPTS:$LOCAL_REPOS:$REPOS:$ANSIBLE_LOCAL:$GHREPOS" export TMUX_SESSIONATOR_PATH="$HOME:$SCRIPTS:$LOCAL_REPOS:$REPOS:$ANSIBLE_LOCAL:$GHREPOS:$HVACIOTREPOS"
# Password-store # Password-store
export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store" export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store"