add devops and development profile
This commit is contained in:
1 parent
a0d2bcdfb0
commit
ab80f0d763
9 files changed
+128
-140
No files matched your search
@@ -10,7 +10,7 @@ do
|
||||
vim.pack.add { { src = gh 'L3MON4D3/LuaSnip', version = vim.version.range '2.*' } }
|
||||
safe_require('luasnip', {}, function(luasnip)
|
||||
luasnip.config.setup { enable_autosnippets = true }
|
||||
require('luasnip.loaders.from_lua').lazy_load { paths = { '~/.config/nvim/lua/snippets/' } }
|
||||
require('luasnip.loaders.from_lua').lazy_load { paths = { vim.fn.stdpath 'config' .. '/lua/snippets/' } }
|
||||
end)
|
||||
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
|
||||
+2
-5
@@ -96,11 +96,8 @@ do
|
||||
|
||||
-- You'll need to check that you have the required things installed
|
||||
-- online, please don't ask me how to install them :)
|
||||
ensure_installed = {
|
||||
-- Update this to ensure that you have the debuggers for the langs you want
|
||||
'python',
|
||||
'kotlin',
|
||||
},
|
||||
-- Debuggers only make sense with the development profile enabled
|
||||
ensure_installed = vim.g.load_development and { 'python', 'kotlin' } or {},
|
||||
})
|
||||
|
||||
-- Change breakpoint icons
|
||||
|
||||
+23
-13
@@ -5,6 +5,28 @@
|
||||
do
|
||||
-- [[ Formatting ]]
|
||||
vim.pack.add { gh 'stevearc/conform.nvim' }
|
||||
|
||||
-- Formatters are grouped by profile; see the switches in init.lua
|
||||
local formatters_by_ft = {
|
||||
bash = { 'shfmt' },
|
||||
sh = { 'shfmt' },
|
||||
zsh = { 'shfmt' },
|
||||
lua = { 'stylua' },
|
||||
}
|
||||
|
||||
if vim.g.load_devops then
|
||||
formatters_by_ft.nix = { 'nixfmt' }
|
||||
formatters_by_ft.terraform = { 'terraform_fmt' }
|
||||
formatters_by_ft.yaml = { 'yamlfmt' }
|
||||
end
|
||||
|
||||
if vim.g.load_development then
|
||||
formatters_by_ft.python = { 'black', 'isort' }
|
||||
formatters_by_ft.c = { 'clang-format' }
|
||||
formatters_by_ft.cpp = { 'clang-format' }
|
||||
formatters_by_ft.kotlin = { 'ktfmt' }
|
||||
end
|
||||
|
||||
safe_require('conform', {
|
||||
notify_on_error = true,
|
||||
format_after_save = {
|
||||
@@ -27,19 +49,7 @@ do
|
||||
lsp_format = 'fallback', -- Use external formatters if configured below, otherwise use LSP formatting. Set to `false` to disable LSP formatting entirely.
|
||||
},
|
||||
-- You can also specify external formatters in here.
|
||||
formatters_by_ft = {
|
||||
bash = { 'shfmt' },
|
||||
sh = { 'shfmt' },
|
||||
zsh = { 'shfmt' },
|
||||
python = { 'black', 'isort' },
|
||||
lua = { 'stylua' },
|
||||
c = { 'clang-format' },
|
||||
cpp = { 'clang-format' },
|
||||
kotlin = { 'ktfmt' },
|
||||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
formatters_by_ft = formatters_by_ft,
|
||||
}, function()
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>f', function() require('conform').format { async = true } end, { desc = '[F]ormat buffer' })
|
||||
end)
|
||||
|
||||
+8
-3
@@ -13,7 +13,7 @@ do
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = false
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.o`
|
||||
@@ -34,9 +34,14 @@ do
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- Only enable it when a clipboard tool exists (WSL needs win32yank.exe;
|
||||
-- bare SSH sessions and containers usually have none).
|
||||
-- See `:help 'clipboard'`
|
||||
vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)
|
||||
vim.schedule(function()
|
||||
local tools = { 'win32yank.exe', 'wl-copy', 'xclip', 'xsel' }
|
||||
local has_tool = vim.iter(tools):any(function(tool) return vim.fn.executable(tool) == 1 end)
|
||||
vim.o.clipboard = has_tool and 'unnamedplus' or ''
|
||||
end)
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
+65
-86
@@ -114,98 +114,23 @@ do
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
-- See `:help lsp-config` for information about keys and how to configure
|
||||
local formatters_and_tools = {
|
||||
'clang-format', -- Using the correct hyphen!
|
||||
'isort',
|
||||
'ktfmt',
|
||||
'nixfmt',
|
||||
'shfmt',
|
||||
'stylua',
|
||||
'black',
|
||||
}
|
||||
|
||||
if vim.g.load_devops then vim.list_extend(formatters_and_tools, { 'nixfmt', 'terraform', 'yamlfmt' }) end
|
||||
|
||||
if vim.g.load_development then vim.list_extend(formatters_and_tools, { 'black', 'isort', 'clang-format', 'ktfmt' }) end
|
||||
|
||||
-- Servers that apply regardless of profile
|
||||
---@type table<string, vim.lsp.Config>
|
||||
local servers = {
|
||||
-- json
|
||||
jsonls = {},
|
||||
-- terraform
|
||||
terraformls = {},
|
||||
-- c
|
||||
clangd = {
|
||||
cmd = {
|
||||
'clangd',
|
||||
'--background-index',
|
||||
'--clang-tidy',
|
||||
'--query-driver=/nix/store/*/bin/*gcc*',
|
||||
},
|
||||
},
|
||||
neocmake = {},
|
||||
-- nix
|
||||
nil_ls = {},
|
||||
-- python
|
||||
-- pylsp = {
|
||||
-- -- plugins = {
|
||||
-- -- -- formatter options
|
||||
-- -- black = { enabled = true },
|
||||
-- -- autopep8 = { enabled = false },
|
||||
-- -- yapf = { enabled = false },
|
||||
-- -- -- linter options
|
||||
-- -- pylint = { enabled = true, executable = 'pylint' },
|
||||
-- -- pyflakes = { enabled = false },
|
||||
-- -- pycodestyle = { enabled = false },
|
||||
-- -- -- type checker
|
||||
-- -- pylsp_mypy = { enabled = true },
|
||||
-- -- -- auto-completion options
|
||||
-- -- jedi_completion = { fuzzy = true },
|
||||
-- -- -- import sorting
|
||||
-- -- pyls_isort = { enabled = true },
|
||||
-- -- },
|
||||
-- },
|
||||
pyright = {},
|
||||
ruff = {},
|
||||
isort = {},
|
||||
-- kotlin
|
||||
kotlin_lsp = {},
|
||||
-- latex
|
||||
texlab = {},
|
||||
-- bash
|
||||
-- bash / sh
|
||||
bashls = {},
|
||||
-- markdown
|
||||
-- markdown / prose
|
||||
markdown_oxide = {},
|
||||
kakehashi = {
|
||||
filetypes = { 'markdown' },
|
||||
init_options = {
|
||||
languageServers = {
|
||||
['texlab'] = {
|
||||
cmd = { 'texlab' },
|
||||
languages = { 'latex' },
|
||||
},
|
||||
['lua_ls'] = {
|
||||
cmd = { 'lua-language-server' },
|
||||
languages = { 'lua' },
|
||||
},
|
||||
},
|
||||
languages = {
|
||||
_ = {
|
||||
autoInstall = true,
|
||||
},
|
||||
markdown = {
|
||||
bridge = {
|
||||
texlab = { enabled = true },
|
||||
lua_ls = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
--
|
||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||
-- https://github.com/pmizio/typescript-tools.nvim
|
||||
--
|
||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||
-- ts_ls = {},
|
||||
|
||||
-- Special Lua Config, as recommended by neovim help docs
|
||||
lua_ls = {
|
||||
@@ -242,6 +167,62 @@ do
|
||||
},
|
||||
}
|
||||
|
||||
-- Infrastructure / DevOps profile
|
||||
if vim.g.load_devops then
|
||||
-- terraform
|
||||
servers.terraformls = {}
|
||||
-- nix
|
||||
servers.nil_ls = {}
|
||||
-- yaml
|
||||
servers.yamlls = {
|
||||
settings = {
|
||||
yaml = {
|
||||
schemaStore = { enable = true },
|
||||
validate = true,
|
||||
format = { enable = false }, -- formatting is handled by conform
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
-- General development profile
|
||||
if vim.g.load_development then
|
||||
servers.clangd = {
|
||||
cmd = { 'clangd', '--background-index', '--clang-tidy' },
|
||||
}
|
||||
servers.neocmake = {}
|
||||
servers.pyright = {}
|
||||
servers.ruff = {}
|
||||
servers.kotlin_lsp = {}
|
||||
servers.texlab = {}
|
||||
servers.kakehashi = {
|
||||
filetypes = { 'markdown' },
|
||||
init_options = {
|
||||
languageServers = {
|
||||
['texlab'] = {
|
||||
cmd = { 'texlab' },
|
||||
languages = { 'latex' },
|
||||
},
|
||||
['lua_ls'] = {
|
||||
cmd = { 'lua-language-server' },
|
||||
languages = { 'lua' },
|
||||
},
|
||||
},
|
||||
languages = {
|
||||
_ = {
|
||||
autoInstall = true,
|
||||
},
|
||||
markdown = {
|
||||
bridge = {
|
||||
texlab = { enabled = true },
|
||||
lua_ls = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
vim.pack.add {
|
||||
gh 'neovim/nvim-lspconfig',
|
||||
gh 'mason-org/mason.nvim',
|
||||
@@ -262,7 +243,7 @@ do
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, formatters_and_tools)
|
||||
|
||||
safe_require('mason-tool-installer', { ensure_installed = ensure_installed, auto_update = true, run_on_start = true }, function(_)
|
||||
safe_require('mason-tool-installer', { ensure_installed = ensure_installed, auto_update = false, run_on_start = true }, function(_)
|
||||
-- for name in ensure_installed do
|
||||
-- vim.lsp.enable(name)
|
||||
-- end
|
||||
@@ -272,6 +253,4 @@ do
|
||||
vim.lsp.enable(name)
|
||||
end
|
||||
end)
|
||||
|
||||
vim.diagnostic.config { update_in_insert = true }
|
||||
end
|
||||
@@ -54,12 +54,6 @@ do
|
||||
if vim.fn.has 'win32' ~= 1 and vim.fn.executable 'make' == 1 then run_build(name, { 'make', 'install_jsregexp' }, ev.data.path) end
|
||||
return
|
||||
end
|
||||
|
||||
if name == 'nvim-treesitter' then
|
||||
if not ev.data.active then vim.cmd.packadd 'nvim-treesitter' end
|
||||
vim.cmd 'TSUpdate'
|
||||
return
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
+21
-24
@@ -4,31 +4,28 @@
|
||||
-- ============================================================
|
||||
do
|
||||
vim.pack.add { { src = gh 'romus204/tree-sitter-manager.nvim' } }
|
||||
|
||||
-- Parsers are grouped by profile; see the switches in init.lua
|
||||
local parsers = {
|
||||
'bash',
|
||||
'dockerfile',
|
||||
'gitignore',
|
||||
'json',
|
||||
'lua',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'query',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'yaml',
|
||||
}
|
||||
|
||||
if vim.g.load_devops then vim.list_extend(parsers, { 'hcl', 'nix' }) end
|
||||
|
||||
if vim.g.load_development then vim.list_extend(parsers, { 'c', 'css', 'go', 'html', 'java', 'javascript', 'kotlin', 'latex', 'python', 'sql', 'typst' }) end
|
||||
|
||||
safe_require('tree-sitter-manager', {
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'c',
|
||||
'css',
|
||||
'dockerfile',
|
||||
'gitignore',
|
||||
'go',
|
||||
'html',
|
||||
'java',
|
||||
'javascript',
|
||||
'json',
|
||||
'kotlin',
|
||||
'latex',
|
||||
'lua',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'python',
|
||||
'query',
|
||||
'sql',
|
||||
'typst',
|
||||
'yaml',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
},
|
||||
ensure_installed = parsers,
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ do
|
||||
})
|
||||
|
||||
-- Useful plugin to show you pending keybinds.
|
||||
vim.pack.add { gh 'nvim-tree/nvim-web-devicons' }
|
||||
vim.pack.add { gh 'folke/which-key.nvim' }
|
||||
safe_require('which-key', {
|
||||
-- Delay between pressing a key and opening which-key (milliseconds)
|
||||
|
||||
Reference in new issue
Block a user