chore: remove nvim lua config (separate flake now)
This commit is contained in:
parent
2b7e623b1f
commit
0d2d83c167
41 changed files with 0 additions and 2591 deletions
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"Lua.runtime.version": "Lua 5.1",
|
||||
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||
"workspace.checkThirdParty": false
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
vim.bo.commentstring = "//%s"
|
|
@ -1 +0,0 @@
|
|||
require("config")
|
|
@ -1,87 +0,0 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "5f211a1597b06be24b1600d72a62b94cab1e2df9" },
|
||||
"asyncrun.vim": { "branch": "master", "commit": "42385d54b8546c163b946fd50eed2103ef7993c9" },
|
||||
"asynctasks.vim": { "branch": "master", "commit": "8bd5e987c84ed6a16b9fd4ca96ed54f05bb45662" },
|
||||
"auto-dark-mode.nvim": { "branch": "master", "commit": "7cbf30c95c793e06c7df2dbfe6713cf3205c4b59" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "9961d87bb3ec008213c46ba14b3f384a5f520eb5" },
|
||||
"catppuccin": { "branch": "main", "commit": "81096cabe67f360acb06d64c0f7db8dd840afeba" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-git": { "branch": "main", "commit": "f900a4cf117300fdc3ba31d26f8b6223ccd9c574" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"color-picker.nvim": { "branch": "master", "commit": "06cb5f853535dea529a523e9a0e8884cdf9eba4d" },
|
||||
"comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"copilot.lua": { "branch": "master", "commit": "0fa30d6846aae1af1c94a9ead93fa7dcf8affbe6" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "7e5a85c186027cab1e825d018f07c350177077fc" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "b1c7b70e1e0875243ed38f51fe7a61d08e11607e" },
|
||||
"editorconfig.nvim": { "branch": "master", "commit": "5b9e303e1d6f7abfe616ce4cc8d3fffc554790bf" },
|
||||
"fidget.nvim": { "branch": "legacy", "commit": "90c22e47be057562ee9566bad313ad42d622c1d3" },
|
||||
"flash.nvim": { "branch": "main", "commit": "8a8e74922a383c253b7f92e042b749150140c8d1" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "d927caa075df63bf301d92f874efb72fd22fd3b4" },
|
||||
"glance.nvim": { "branch": "master", "commit": "8ed5cf3b3b1231ea696d88c9efd977027429d869" },
|
||||
"go.nvim": { "branch": "master", "commit": "c9acdf488d324ac5d86febe522a5d3a0310a4c76" },
|
||||
"guihua.lua": { "branch": "master", "commit": "5ad8dba19ce9b9fd8965598984dfdc9c119f97e4" },
|
||||
"headlines.nvim": { "branch": "master", "commit": "74a083a3c32a08be24f7dfcc6f448ecf47857f46" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
|
||||
"lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||
"ltex-extra.nvim": { "branch": "master", "commit": "9bed99b2b8488cc2daf66c76d2e0cf051ee80d13" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "183f5a7357397260b631d6cccceccc3621b50f78" },
|
||||
"neogit": { "branch": "master", "commit": "08d23c7ae1e7c3c66802990d5aa16269bdd996a7" },
|
||||
"neorg": { "branch": "main", "commit": "20502e50e9087248f6f8ed8d29fae9c849c1c77f" },
|
||||
"neovim-session-manager": { "branch": "master", "commit": "1ad2587db606f974ef2eadf03fdff12bdf3384e4" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "a52fc6eeec116746110b703381777c46d89d9e27" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
|
||||
"nvim-dap": { "branch": "master", "commit": "31e1ece773e10448dcb616d5144290946a6264b7" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a27356f1ef9c11e1f459cc96a3fcac5c265e72d6" },
|
||||
"nvim-navic": { "branch": "master", "commit": "9c89730da6a05acfeb6a197e212dfadf5aa60ca0" },
|
||||
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
|
||||
"nvim-spectre": { "branch": "master", "commit": "411cee67fe3f8242023eb8d9edafefbbfb2d06f1" },
|
||||
"nvim-surround": { "branch": "main", "commit": "1c2ef599abeeb98e40706830bcd27e90e259367a" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "5897b3622f033b1f3ea6adf8eb1c165e9f20554f" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "9d637b7ae8fa17cea8600e91d1145e2095c2a15d" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "bc11ee2498de2310de5776477dd9dce65d03b464" },
|
||||
"octo.nvim": { "branch": "master", "commit": "d1e52f9b3c755fcebb93d635821663a2c0f53281" },
|
||||
"playground": { "branch": "master", "commit": "429f3e76cbb1c59fe000b690f7a5bea617b890c0" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "0dbe561ae023f02c2fb772b879e905055b939ce3" },
|
||||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||
"py_lsp.nvim": { "branch": "main", "commit": "5b2bd6433a2dbab76d54d58ccc1d1e89b220091c" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "9cbd3dc409af1f5531778ccd1ea6bce668241f39" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "d7aa3b9720d383b19ecd5397d9d4a3371b2c4e9c" },
|
||||
"tagalong.vim": { "branch": "main", "commit": "d12622b866c9eea5204a792517d11586c51715a2" },
|
||||
"telescope-asynctasks.nvim": { "branch": "main", "commit": "065300fb0a8ba6a1c81991da1873c73e136dcdc0" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "ad7b637c72549713b9aaed7c4f9c79c62bcbdff0" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
|
||||
"telescope-project.nvim": { "branch": "master", "commit": "7c64b181dd4e72deddcf6f319e3bf1e95b2a2f30" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "6b79d7a6a45adc1508a7afee5bc973173ec22f59" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "3094ead8edfa9040de2421deddec55d3762f64d1" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "b90a1381e9b5b8596f49070ee86c71db267ac868" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" },
|
||||
"true-zen.nvim": { "branch": "main", "commit": "2b9e210e0d1a735e1fa85ec22190115dffd963aa" },
|
||||
"typescript-tools.nvim": { "branch": "master", "commit": "98165e3cd9d8b1cd0aa7635f1d81a337ae780b55" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "7d80bbd11c407a09e0f7b869c38f3dec3902805f" },
|
||||
"vim-dadbod-completion": { "branch": "master", "commit": "fc7321a17f4c55db11fae89a884ddf4724020bae" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "200aebf70e6fc4b0eb1d3ecf0d57028e198d8dc6" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "572c8510123cbde02e8a1dafcd376c98e1e13f43" },
|
||||
"vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" },
|
||||
"vim-helm": { "branch": "master", "commit": "c2e7b85711d410e1d73e64eb5df7b70b1c4c10eb" },
|
||||
"vim-just": { "branch": "main", "commit": "927b41825b9cd07a40fc15b4c68635c4b36fa923" },
|
||||
"vim-table-mode": { "branch": "master", "commit": "9555a3e6e5bcf285ec181b7fc983eea90500feb4" },
|
||||
"vim-wakatime": { "branch": "master", "commit": "0d2efa2daff34b27b0d227d4c3b136811c93db93" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
vim.api.nvim_create_autocmd("VimResized", {
|
||||
pattern = "*",
|
||||
command = "wincmd =",
|
||||
desc = "Automatically resize windows when the host window size changes.",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 200 })
|
||||
end,
|
||||
desc = "Highlight yanked text",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "RecordingEnter", "RecordingLeave" }, {
|
||||
callback = function(data)
|
||||
local msg = data.event == "RecordingEnter" and "Recording macro..."
|
||||
or "Macro recorded"
|
||||
vim.notify(msg, vim.log.levels.INFO, { title = "Macro" })
|
||||
end,
|
||||
desc = "Notify when recording macro",
|
||||
})
|
||||
|
||||
local numbertoggle = vim.api.nvim_create_augroup("numbertoggle", {})
|
||||
local ignore_ft = {
|
||||
"",
|
||||
"alpha",
|
||||
"fugitive",
|
||||
"help",
|
||||
"lazy",
|
||||
"NeogitCommitView",
|
||||
"NeogitConsole",
|
||||
"NeogitStatus",
|
||||
"NvimTree",
|
||||
"TelescopePrompt",
|
||||
"toggleterm",
|
||||
"Trouble",
|
||||
}
|
||||
---@param callback fun(): nil
|
||||
local ft_guard = function(callback)
|
||||
if not vim.tbl_contains(ignore_ft, vim.bo.filetype) then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "InsertEnter", "BufLeave", "WinLeave", "FocusLost" },
|
||||
{
|
||||
callback = function()
|
||||
ft_guard(function()
|
||||
vim.opt_local.rnu = false
|
||||
end)
|
||||
end,
|
||||
group = numbertoggle,
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "InsertLeave", "BufEnter", "WinEnter", "FocusGained" },
|
||||
{
|
||||
callback = function()
|
||||
ft_guard(function()
|
||||
vim.opt_local.rnu = true
|
||||
end)
|
||||
end,
|
||||
group = numbertoggle,
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd({ "CmdlineEnter", "CmdlineLeave" }, {
|
||||
callback = function(data)
|
||||
ft_guard(function()
|
||||
vim.opt.rnu = data.event == "CmdlineLeave"
|
||||
vim.cmd("redraw")
|
||||
end)
|
||||
end,
|
||||
group = numbertoggle,
|
||||
})
|
|
@ -1,4 +0,0 @@
|
|||
require("config.autocmds")
|
||||
require("config.mappings")
|
||||
require("config.options")
|
||||
require("config.plugins").setup({ { import = "plugins" } })
|
|
@ -1,27 +0,0 @@
|
|||
local map = function(mode, shortcut, command, opt)
|
||||
opt = opt or { noremap = true, silent = true }
|
||||
vim.keymap.set(mode, shortcut, command, opt)
|
||||
end
|
||||
|
||||
-- easier split navigation
|
||||
map("n", "<C-J>", "<C-W>j")
|
||||
map("n", "<C-K>", "<C-W>k")
|
||||
map("n", "<C-L>", "<C-W>l")
|
||||
map("n", "<C-H>", "<C-W>h")
|
||||
map("n", "<C-W>\\", ":vsplit<CR>")
|
||||
map("n", "<C-W>-", ":split<CR>")
|
||||
map("n", "<C-W>x", ":q<CR>")
|
||||
-- merge conflicts
|
||||
map("n", "gd", ":diffget")
|
||||
map("n", "gdh", ":diffget //2<CR>")
|
||||
map("n", "gdl", ":diffget //3<CR>")
|
||||
-- escape :terminal easier
|
||||
map("t", "<Esc>", "<C-\\><C-n>")
|
||||
-- keep cursor in the middle when scrolling and searching
|
||||
map("n", "<C-d>", "<C-d>zz")
|
||||
map("n", "<C-u>", "<C-u>zz")
|
||||
map("n", "n", "nzzzv")
|
||||
map("n", "N", "Nzzzv")
|
||||
|
||||
-- NvimTree
|
||||
map("n", "<C-N>", ":NvimTreeToggle<CR>")
|
|
@ -1,79 +0,0 @@
|
|||
vim.g.mapleader = " "
|
||||
-- netrw is handled by nvim-tree
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
-- true colors
|
||||
vim.o.termguicolors = true
|
||||
vim.o.cmdheight = 0
|
||||
-- line numbers
|
||||
vim.o.mouse = "nv"
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
-- scroll offsets
|
||||
vim.o.scrolloff = 5
|
||||
vim.o.sidescrolloff = 15
|
||||
-- always show status
|
||||
vim.o.laststatus = 3
|
||||
-- hide tab line
|
||||
vim.o.showtabline = 0
|
||||
vim.g.termguicolors = false
|
||||
-- completion height
|
||||
vim.o.pumheight = 15
|
||||
-- split directions
|
||||
vim.o.splitbelow = true
|
||||
vim.o.splitright = true
|
||||
vim.o.wrap = false
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
-- redefine word boundaries - '_' is a word separator, this helps with snake_case
|
||||
vim.opt.iskeyword:remove("_")
|
||||
-- indentations settings
|
||||
vim.o.shiftwidth = 2
|
||||
vim.o.tabstop = 2
|
||||
vim.o.softtabstop = 0
|
||||
vim.o.expandtab = true
|
||||
-- always show 1 column of sign column (gitsigns, etc.)
|
||||
vim.o.signcolumn = "yes:1"
|
||||
-- hide search notices, intro
|
||||
vim.opt.shortmess:append("sI")
|
||||
|
||||
-- stylua: ignore
|
||||
local borderchars = {
|
||||
single = {
|
||||
style = "single",
|
||||
vert = "│", vertleft = "┤", vertright = "├", horiz = "─", horizup = "┴", horizdown = "┬", verthoriz = "┼", topleft = "┌", topright = "┐", botleft = "└", botright = "┘"
|
||||
},
|
||||
double = {
|
||||
style = "double",
|
||||
vert = "║", vertleft = "╣", vertright = "╠", horiz = "═", horizup = "╩", horizdown = "╦", verthoriz = "╬", topleft = "╔", topright = "╗", botleft = "╚", botright = "╝"
|
||||
},
|
||||
rounded = {
|
||||
style = "rounded",
|
||||
vert = "│", vertleft = "┤", vertright = "├", horiz = "─", horizup = "┴", horizdown = "┬", verthoriz = "┼", topleft = "╭", topright = "╮", botleft = "╰", botright = "╯"
|
||||
},
|
||||
}
|
||||
|
||||
-- my custom borderchars
|
||||
vim.g.bc = borderchars.rounded
|
||||
|
||||
-- stylua: ignore
|
||||
vim.opt.fillchars:append({ horiz = vim.g.bc.horiz, horizup = vim.g.bc.horizup, horizdown = vim.g.bc.horizdown, vert = vim.g.bc.vert, vertright = vim.g.bc.vertright, vertleft = vim.g.bc.vertleft, verthoriz = vim.g.bc.verthoriz })
|
||||
|
||||
if vim.g.neovide then
|
||||
vim.g.neovide_refresh_rate = 60
|
||||
vim.g.neovide_refresh_rate_idle = 5
|
||||
vim.g.neovide_cursor_vfx_mode = "ripple"
|
||||
vim.g.neovide_scroll_animation_length = 0.3
|
||||
vim.g.neovide_input_macos_alt_is_meta = true
|
||||
vim.g.neovide_hide_mouse_when_typing = true
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<M-CR>",
|
||||
":let g:neovide_fullscreen = !g:neovide_fullscreen<CR>",
|
||||
{
|
||||
noremap = true,
|
||||
silent = true,
|
||||
}
|
||||
)
|
||||
vim.opt.guifont = { "BerkeleyMono Nerd Font", "h14", "#e-subpixelantialias" }
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
M.setup = function(plugins)
|
||||
require("lazy").setup(plugins, {
|
||||
install = { colorscheme = { "catppuccin" } },
|
||||
ui = { border = vim.g.bc.style },
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,52 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
M.setup = function(opts)
|
||||
require("go").setup({
|
||||
disable_defaults = true,
|
||||
fillstruct = "gopls",
|
||||
gofmt = "gofumpt",
|
||||
max_line_len = 120,
|
||||
tag_transform = false,
|
||||
icons = {
|
||||
breakpoint = " ",
|
||||
currentpos = " ",
|
||||
},
|
||||
lsp_cfg = opts,
|
||||
lsp_gofumpt = true,
|
||||
lsp_keymaps = false,
|
||||
lsp_codelens = true,
|
||||
lsp_diag_hdlr = true,
|
||||
lsp_diag_underline = true,
|
||||
lsp_diag_virtual_text = { space = 0, prefix = " " },
|
||||
lsp_diag_signs = true,
|
||||
lsp_diag_update_in_insert = false,
|
||||
lsp_document_formatting = false,
|
||||
lsp_inlay_hints = {
|
||||
enable = true,
|
||||
only_current_line = false,
|
||||
only_current_line_autocmd = "CursorHold",
|
||||
show_variable_name = true,
|
||||
parameter_hints_prefix = " ",
|
||||
show_parameter_hints = true,
|
||||
other_hints_prefix = "=> ",
|
||||
highlight = "InlayHint",
|
||||
},
|
||||
gopls_remote_auto = true,
|
||||
gocoverage_sign = "█",
|
||||
sign_priority = 5,
|
||||
dap_debug = true,
|
||||
dap_debug_keymap = true,
|
||||
dap_debug_gui = true,
|
||||
dap_debug_vt = true,
|
||||
build_tags = "",
|
||||
textobjects = true,
|
||||
test_runner = "go",
|
||||
verbose_tests = true,
|
||||
run_in_floaterm = false,
|
||||
trouble = true,
|
||||
test_efm = false,
|
||||
luasnip = false,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,14 +0,0 @@
|
|||
local configs = require("lspconfig.configs")
|
||||
local util = require("lspconfig.util")
|
||||
|
||||
if not configs.helm_ls then
|
||||
configs.helm_ls = {
|
||||
default_config = {
|
||||
cmd = { "helm-ls", "serve" },
|
||||
filetypes = { "helm" },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern("Chart.yaml")(fname)
|
||||
end,
|
||||
},
|
||||
}
|
||||
end
|
|
@ -1,223 +0,0 @@
|
|||
local lsp_present, lspconfig = pcall(require, "lspconfig")
|
||||
local cmp_present, cmp = pcall(require, "cmp")
|
||||
local navic_present, navic = pcall(require, "nvim-navic")
|
||||
local luasnip_present, luasnip = pcall(require, "luasnip")
|
||||
|
||||
if not (cmp_present and lsp_present and luasnip_present) then
|
||||
return
|
||||
end
|
||||
|
||||
vim.opt.completeopt = "menu,menuone,noselect"
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").load({
|
||||
path = { vim.fn.stdpath("config") .. "/snippets" },
|
||||
})
|
||||
vim.lsp.set_log_level("error")
|
||||
|
||||
-- border style
|
||||
require("lspconfig.ui.windows").default_options.border = "double"
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = vim.g.bc.style,
|
||||
})
|
||||
local cmp_borders = {
|
||||
border = {
|
||||
vim.g.bc.topleft,
|
||||
vim.g.bc.horiz,
|
||||
vim.g.bc.topright,
|
||||
vim.g.bc.vert,
|
||||
vim.g.bc.botright,
|
||||
vim.g.bc.horiz,
|
||||
vim.g.bc.botleft,
|
||||
vim.g.bc.vert,
|
||||
},
|
||||
winhighlight = "Normal:CmpPmenu,FloatBorder:CmpBorder,CursorLine:PmenuSel,Search:None",
|
||||
}
|
||||
|
||||
-- stylua: ignore
|
||||
local has_words_before = function()
|
||||
---@diagnostic disable-next-line: deprecated
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp_borders,
|
||||
documentation = cmp_borders,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "vim-dadbod-completion" },
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
formatting = {
|
||||
format = require("lspkind").cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufRead", {
|
||||
group = vim.api.nvim_create_augroup("CmpSourceCargo", { clear = true }),
|
||||
pattern = "Cargo.toml",
|
||||
callback = function()
|
||||
cmp.setup.buffer({ sources = { { name = "crates" } } })
|
||||
end,
|
||||
})
|
||||
|
||||
local git_ft = { "gitcommit", "NeogitCommitMessage", "Octo" }
|
||||
cmp.setup.filetype(git_ft, {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "git" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
require("cmp_git").setup({
|
||||
filetypes = git_ft,
|
||||
enableRemoteUrlRewrites = true,
|
||||
})
|
||||
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path", option = { trailing_slash = true } },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
if navic_present and client.server_capabilities.documentSymbolProvider then
|
||||
navic.attach(client, ev.buf)
|
||||
end
|
||||
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set("n", "<space>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||
vim.keymap.set("n", "<space>lr", "<cmd>LspRestart<CR>", opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "<space>fm", function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
-- register jq for jqls
|
||||
vim.cmd([[au BufRead,BufNewFile *.jq setfiletype jq]])
|
||||
|
||||
local common = { capabilities = capabilities }
|
||||
|
||||
require("lsp.go").setup(common)
|
||||
require("lsp.ltex").setup(common)
|
||||
require("lsp.helm-ls")
|
||||
require("lsp.null-ls")
|
||||
require("lsp.validation").setup(common)
|
||||
require("lsp.webdev").setup(common)
|
||||
-- external dependencies
|
||||
pcall(require("py_lsp").setup, common)
|
||||
pcall(require("rust-tools").setup, {
|
||||
server = {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
autoReload = true,
|
||||
target = "wasm32-unknown-unknown",
|
||||
},
|
||||
checkOnSave = {
|
||||
allTargets = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
tools = {
|
||||
executor = require("rust-tools.executors").toggleterm,
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig.nil_ls.setup(vim.tbl_extend("keep", {
|
||||
settings = {
|
||||
["nil"] = {
|
||||
formatting = { command = { "alejandra" } },
|
||||
nix = { maxMemoryMB = nil },
|
||||
},
|
||||
},
|
||||
}, common))
|
||||
|
||||
local servers = {
|
||||
"astro",
|
||||
"bashls",
|
||||
"dockerls",
|
||||
"helm_ls",
|
||||
"jqls",
|
||||
"lua_ls",
|
||||
"serve_d",
|
||||
"taplo",
|
||||
"teal_ls",
|
||||
}
|
||||
|
||||
for _, server in ipairs(servers) do
|
||||
lspconfig[server].setup(common)
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
local lsp_present, lspconfig = pcall(require, "lspconfig")
|
||||
|
||||
if not lsp_present then
|
||||
return
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(opts)
|
||||
lspconfig.ltex.setup({
|
||||
capabilities = opts.capabilities,
|
||||
on_attach = function()
|
||||
require("ltex_extra").setup({
|
||||
load_langs = { "en-US", "de-AT" },
|
||||
init_check = true,
|
||||
path = vim.fn.stdpath("data") .. "/dictionary",
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
ltex = {},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,61 +0,0 @@
|
|||
local null_present, null = pcall(require, "null-ls")
|
||||
|
||||
if not null_present then
|
||||
return
|
||||
end
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
null.setup({
|
||||
sources = {
|
||||
null.builtins.formatting.alejandra,
|
||||
null.builtins.formatting.black,
|
||||
null.builtins.formatting.dfmt,
|
||||
null.builtins.formatting.deno_fmt.with({
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
},
|
||||
}),
|
||||
null.builtins.formatting.gofumpt,
|
||||
null.builtins.formatting.isort,
|
||||
null.builtins.formatting.prettier.with({
|
||||
filetypes = {
|
||||
"astro",
|
||||
},
|
||||
}),
|
||||
null.builtins.formatting.rustfmt,
|
||||
null.builtins.formatting.shfmt,
|
||||
null.builtins.formatting.stylua,
|
||||
null.builtins.formatting.taplo,
|
||||
null.builtins.diagnostics.alex,
|
||||
null.builtins.diagnostics.proselint,
|
||||
null.builtins.hover.dictionary,
|
||||
null.builtins.hover.printenv,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({
|
||||
bufnr = bufnr,
|
||||
filter = function(c)
|
||||
return c.name == "null-ls"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local toggle_formatters = function()
|
||||
null.toggle({ methods = null.methods.FORMATTING })
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("ToggleFormatters", toggle_formatters, {})
|
|
@ -1,56 +0,0 @@
|
|||
local lsp_present, lspconfig = pcall(require, "lspconfig")
|
||||
|
||||
if not lsp_present then
|
||||
return
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(opts)
|
||||
lspconfig.jsonls.setup(vim.tbl_extend("keep", {
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require("schemastore").json.schemas(),
|
||||
validate = { enable = true },
|
||||
},
|
||||
},
|
||||
}, opts))
|
||||
lspconfig.yamlls.setup(vim.tbl_extend("keep", {
|
||||
settings = {
|
||||
yaml = {
|
||||
completion = true,
|
||||
validate = true,
|
||||
suggest = {
|
||||
parentSkeletonSelectedFirst = true,
|
||||
},
|
||||
schemas = {
|
||||
["https://json.schemastore.org/github-action"] = ".github/action.{yaml,yml}",
|
||||
["https://json.schemastore.org/github-workflow"] = ".github/workflows/*",
|
||||
["https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json"] = "*lab-ci.{yaml,yml}",
|
||||
["https://json.schemastore.org/helmfile"] = "helmfile.{yaml,yml}",
|
||||
["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose.yml.{yml,yaml}",
|
||||
-- stylua: ignore
|
||||
kubernetes = {
|
||||
'*-deployment.yaml', '*-deployment.yml', '*-service.yaml', '*-service.yml', 'clusterrole-contour.yaml',
|
||||
'clusterrole-contour.yml', 'clusterrole.yaml', 'clusterrole.yml', 'clusterrolebinding.yaml',
|
||||
'clusterrolebinding.yml', 'configmap.yaml', 'configmap.yml', 'cronjob.yaml', 'cronjob.yml', 'daemonset.yaml',
|
||||
'daemonset.yml', 'deployment-*.yaml', 'deployment-*.yml', 'deployment.yaml', 'deployment.yml', 'hpa.yaml',
|
||||
'hpa.yml', 'ingress.yaml', 'ingress.yml', 'job.yaml', 'job.yml', 'kubectl-edit-*.yaml', 'namespace.yaml',
|
||||
'namespace.yml', 'pvc.yaml', 'pvc.yml', 'rbac.yaml', 'rbac.yml', 'replicaset.yaml', 'replicaset.yml',
|
||||
'role.yaml', 'role.yml', 'rolebinding.yaml', 'rolebinding.yml', 'sa.yaml', 'sa.yml', 'secret.yaml',
|
||||
'secret.yml', 'service-*.yaml', 'service-*.yml', 'service-account.yaml', 'service-account.yml', 'service.yaml',
|
||||
'service.yml', 'serviceaccount.yaml', 'serviceaccount.yml', 'serviceaccounts.yaml', 'serviceaccounts.yml',
|
||||
'statefulset.yaml', 'statefulset.yml'
|
||||
},
|
||||
},
|
||||
},
|
||||
redhat = {
|
||||
telemetry = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}, opts))
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,68 +0,0 @@
|
|||
local lsp_present, lspconfig = pcall(require, "lspconfig")
|
||||
|
||||
if not lsp_present then
|
||||
return
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(opts)
|
||||
lspconfig.astro.setup(opts)
|
||||
lspconfig.cssls.setup(opts)
|
||||
lspconfig.emmet_ls.setup(opts)
|
||||
lspconfig.graphql.setup(vim.tbl_extend("keep", {
|
||||
filetypes = {
|
||||
"graphql",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
},
|
||||
}, opts))
|
||||
lspconfig.html.setup(opts)
|
||||
lspconfig.intelephense.setup(opts)
|
||||
lspconfig.tailwindcss.setup(vim.tbl_extend("keep", {
|
||||
filetypes = {
|
||||
"astro",
|
||||
"javascriptreact",
|
||||
"typescriptreact",
|
||||
"html",
|
||||
"css",
|
||||
},
|
||||
}, opts))
|
||||
|
||||
-- attach tsserver only when there's a 'package.json' file in the CWD
|
||||
require("typescript-tools").setup({
|
||||
single_file_support = false,
|
||||
root_dir = function(fname)
|
||||
local root_dir = lspconfig.util.root_pattern("tsconfig.json")(fname)
|
||||
|
||||
-- this is needed to make sure we don't pick up root_dir inside node_modules
|
||||
local node_modules_index = root_dir
|
||||
and root_dir:find("node_modules", 1, true)
|
||||
if node_modules_index and node_modules_index > 0 then
|
||||
---@diagnostic disable-next-line: need-check-nil
|
||||
root_dir = root_dir:sub(1, node_modules_index - 2)
|
||||
end
|
||||
|
||||
return root_dir
|
||||
end,
|
||||
settings = {
|
||||
expose_as_code_action = {
|
||||
"add_missing_imports",
|
||||
"fix_all",
|
||||
"remove_unused",
|
||||
},
|
||||
-- Nix silliness
|
||||
-- stylua: ignore
|
||||
tsserver_path = vim.fn.resolve(vim.fn.exepath("tsserver") .. "/../../lib/node_modules/typescript/bin/tsserver"),
|
||||
},
|
||||
})
|
||||
|
||||
-- attach deno only when there's a 'deps.ts' file in the CWD
|
||||
lspconfig.denols.setup(vim.tbl_extend("keep", {
|
||||
root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"),
|
||||
single_file_support = false,
|
||||
}, opts))
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,60 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"Shatur/neovim-session-manager",
|
||||
opts = { autoload_mode = "CurrentDir" },
|
||||
},
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
dashboard.section.header.val = {
|
||||
" ,-. _,---._ __ / \\ ",
|
||||
" / ) .-' `./ / \\ ",
|
||||
"( ( ,' `/ /|",
|
||||
" \\ `-\" \\'\\ / |",
|
||||
" `. , \\ \\ / |",
|
||||
" /`. ,'-`----Y |",
|
||||
" ( ; | '",
|
||||
" | ,-. ,-' | / ",
|
||||
" | | ( | | / ",
|
||||
" ) | \\ `.___________|/ ",
|
||||
" `--' `--' ",
|
||||
}
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("n", " New file", ":ene <bar> startinsert <cr>"),
|
||||
dashboard.button(
|
||||
"SPC fd",
|
||||
" Find file",
|
||||
":Telescope find_files<cr>"
|
||||
),
|
||||
dashboard.button(
|
||||
"SPC fg",
|
||||
" Live grep",
|
||||
":Telescope live_grep<cr>"
|
||||
),
|
||||
dashboard.button(
|
||||
"s",
|
||||
" Show sessions",
|
||||
":SessionManager load_session<cr>"
|
||||
),
|
||||
dashboard.button("SPC fp", " Projects", ":Telescope project<CR>"),
|
||||
dashboard.button("q", " Quit", ":qa<CR>"),
|
||||
}
|
||||
local version = vim.version()
|
||||
dashboard.section.footer.val = "neovim v"
|
||||
.. version.major
|
||||
.. "."
|
||||
.. version.minor
|
||||
.. "."
|
||||
.. version.patch
|
||||
.. " "
|
||||
.. require("lazy").stats().count
|
||||
.. " plugins"
|
||||
dashboard.config.opts.noautocmd = true
|
||||
alpha.setup(dashboard.config)
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
dependencies = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
},
|
||||
config = function()
|
||||
local ap = require("nvim-autopairs")
|
||||
local cmp = require("cmp")
|
||||
ap.setup()
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = {
|
||||
{ "catppuccin/nvim", name = "catppuccin" },
|
||||
},
|
||||
config = function()
|
||||
local bufferline = require("bufferline")
|
||||
local ctp = require("catppuccin.groups.integrations.bufferline").get()
|
||||
|
||||
local v = vim.version()
|
||||
local vStr = string.format("v%d.%d.%d", v.major, v.minor, v.patch)
|
||||
|
||||
bufferline.setup({
|
||||
highlights = ctp,
|
||||
options = {
|
||||
show_close_icon = false,
|
||||
show_buffer_close_icons = false,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = " neovim " .. vStr,
|
||||
text_align = "left",
|
||||
separator = vim.g.bc.vert,
|
||||
},
|
||||
},
|
||||
left_mouse_command = "buffer %d",
|
||||
middle_mouse_command = "bdelete! %d",
|
||||
right_mouse_command = nil,
|
||||
numbers = "ordinal",
|
||||
},
|
||||
})
|
||||
|
||||
local nmap = function(key, cmd)
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
key,
|
||||
cmd,
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
end
|
||||
|
||||
-- hop between buffers in order of the bar
|
||||
nmap("<A-,>", "<Cmd>BufferLineCyclePrev<CR>")
|
||||
nmap("<A-.>", "<Cmd>BufferLineCycleNext<CR>")
|
||||
-- Re-order to previous/next
|
||||
nmap("<A-<>", "<Cmd>BufferLineMovePrev<CR>")
|
||||
nmap("<A->>", "<Cmd>BufferLineMoveNext<CR>")
|
||||
-- Goto buffer in position...
|
||||
nmap("<A-1>", "<Cmd>BufferLineGoToBuffer 1<CR>")
|
||||
nmap("<A-2>", "<Cmd>BufferLineGoToBuffer 2<CR>")
|
||||
nmap("<A-3>", "<Cmd>BufferLineGoToBuffer 3<CR>")
|
||||
nmap("<A-4>", "<Cmd>BufferLineGoToBuffer 4<CR>")
|
||||
nmap("<A-5>", "<Cmd>BufferLineGoToBuffer 5<CR>")
|
||||
nmap("<A-6>", "<Cmd>BufferLineGoToBuffer 6<CR>")
|
||||
nmap("<A-7>", "<Cmd>BufferLineGoToBuffer 7<CR>")
|
||||
nmap("<A-8>", "<Cmd>BufferLineGoToBuffer 8<CR>")
|
||||
nmap("<A-9>", "<Cmd>BufferLineGoToBuffer 9<CR>")
|
||||
nmap("<A-0>", "<Cmd>BufferLineGoToBuffer -1<CR>")
|
||||
-- Pin/unpin buffer
|
||||
nmap("<A-p>", "<Cmd>BufferLineTogglePin<CR>")
|
||||
-- Close buffer
|
||||
nmap("<A-x>", "<Cmd>bdelete<CR>")
|
||||
nmap("<A-X>", "<Cmd>bdelete!<CR>")
|
||||
-- create new buffer
|
||||
nmap("<A-c>", "<Cmd>enew<CR>")
|
||||
-- pick buffer
|
||||
nmap("<A-space>", "<Cmd>BufferLinePick<CR>")
|
||||
-- Sort automatically by...
|
||||
nmap("<Space>bd", "<Cmd>BufferLineSortByDirectory<CR>")
|
||||
nmap("<Space>bl", "<Cmd>BufferLineSortByExtension<CR>")
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
---@type LazySpec[]
|
||||
return {
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
config = function()
|
||||
require("catppuccin").setup({
|
||||
transparent_background = not vim.g.neovide,
|
||||
dim_inactive = {
|
||||
enabled = false,
|
||||
shade = "dark",
|
||||
percentage = 0.15,
|
||||
},
|
||||
styles = {
|
||||
comments = { "italic" },
|
||||
conditionals = { "italic" },
|
||||
},
|
||||
term_colors = true,
|
||||
integrations = {
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
virtual_text = {
|
||||
errors = { "italic" },
|
||||
hints = { "italic" },
|
||||
warnings = { "italic" },
|
||||
information = { "italic" },
|
||||
},
|
||||
underlines = {
|
||||
errors = { "undercurl" },
|
||||
hints = { "undercurl" },
|
||||
warnings = { "undercurl" },
|
||||
information = { "undercurl" },
|
||||
},
|
||||
},
|
||||
cmp = true,
|
||||
lsp_trouble = true,
|
||||
nvimtree = true,
|
||||
which_key = true,
|
||||
indent_blankline = {
|
||||
enabled = true,
|
||||
colored_indent_levels = true,
|
||||
},
|
||||
navic = {
|
||||
enabled = true,
|
||||
custom_bg = "NONE",
|
||||
},
|
||||
gitsigns = true,
|
||||
lightspeed = true,
|
||||
markdown = true,
|
||||
neogit = true,
|
||||
symbols_outline = true,
|
||||
ts_rainbow = true,
|
||||
vimwiki = true,
|
||||
notify = true,
|
||||
},
|
||||
highlight_overrides = {
|
||||
all = function(colors)
|
||||
return {
|
||||
-- borders
|
||||
FloatBorder = { fg = colors.overlay0 },
|
||||
LspInfoBorder = { link = "FloatBorder" },
|
||||
NvimTreeWinSeparator = { link = "FloatBorder" },
|
||||
WhichKeyBorder = { link = "FloatBorder" },
|
||||
-- telescope
|
||||
TelescopeBorder = { link = "FloatBorder" },
|
||||
TelescopeTitle = { fg = colors.text },
|
||||
TelescopeSelection = { link = "Selection" },
|
||||
TelescopeSelectionCaret = { link = "Selection" },
|
||||
-- pmenu
|
||||
PmenuSel = { link = "Selection" },
|
||||
-- bufferline
|
||||
BufferLineTabSeparator = { link = "FloatBorder" },
|
||||
BufferLineSeparator = { link = "FloatBorder" },
|
||||
BufferLineOffsetSeparator = { link = "FloatBorder" },
|
||||
--
|
||||
FidgetTitle = { fg = colors.subtext1 },
|
||||
FidgetTask = { fg = colors.subtext0 },
|
||||
|
||||
NotifyBackground = { bg = colors.base },
|
||||
NotifyINFOBorder = { link = "NotifyInfoTitle" },
|
||||
NotifyINFOIcon = { link = "NotifyINFOTitle" },
|
||||
NotifyINFOTitle = { fg = colors.pink },
|
||||
}
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"f-person/auto-dark-mode.nvim",
|
||||
opts = true,
|
||||
},
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"nvchad/nvim-colorizer.lua",
|
||||
opts = {
|
||||
user_default_options = {
|
||||
RGB = true,
|
||||
RRGGBB = true,
|
||||
names = false,
|
||||
RRGGBBAA = true,
|
||||
AARRGGBB = false,
|
||||
rgb_fn = false,
|
||||
hsl_fn = false,
|
||||
css = false,
|
||||
css_fn = false,
|
||||
mode = "background",
|
||||
tailwind = "both",
|
||||
sass = { enable = true },
|
||||
virtualtext = " ",
|
||||
},
|
||||
buftypes = {
|
||||
"*",
|
||||
"!dashboard",
|
||||
"!lazy",
|
||||
"!popup",
|
||||
"!prompt",
|
||||
},
|
||||
},
|
||||
{ "ziontee113/color-picker.nvim", opts = {} },
|
||||
},
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
opts = {
|
||||
panel = {
|
||||
enabled = false,
|
||||
},
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
debounce = 75,
|
||||
keymap = {
|
||||
accept = "<C-J>",
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
yaml = true,
|
||||
markdown = false,
|
||||
help = false,
|
||||
gitcommit = false,
|
||||
gitrebase = false,
|
||||
hgcommit = false,
|
||||
svn = false,
|
||||
cvs = false,
|
||||
["."] = false,
|
||||
},
|
||||
copilot_node_command = "node",
|
||||
server_opts_overrides = {},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
"tpope/vim-dadbod",
|
||||
"kristijanhusak/vim-dadbod-completion",
|
||||
{
|
||||
"kristijanhusak/vim-dadbod-ui",
|
||||
config = function()
|
||||
vim.g.db_ui_use_nerd_fonts = true
|
||||
vim.g.db_ui_win_position = "right"
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
-- zen mode
|
||||
"pocco81/true-zen.nvim",
|
||||
-- respect project settings
|
||||
"gpanders/editorconfig.nvim",
|
||||
-- best hop
|
||||
{
|
||||
"folke/flash.nvim",
|
||||
opts = {},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{
|
||||
"s", mode = { "n", "x", "o" }, desc = "Flash",
|
||||
function() require("flash").jump() end,
|
||||
},
|
||||
{
|
||||
"S", mode = { "n", "o", "x" }, desc = "Flash Treesitter",
|
||||
function() require("flash").treesitter() end,
|
||||
},
|
||||
{
|
||||
"r", mode = "o", desc = "Remote Flash",
|
||||
function() require("flash").remote() end,
|
||||
},
|
||||
{
|
||||
"R", mode = { "o", "x" }, desc = "Treesitter Search",
|
||||
function() require("flash").treesitter_search() end,
|
||||
},
|
||||
{
|
||||
"<c-f>", mode = { "c" }, desc = "Toggle Flash Search",
|
||||
function() require("flash").toggle() end,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- run tasks
|
||||
"skywind3000/asyncrun.vim",
|
||||
"skywind3000/asynctasks.vim",
|
||||
-- ui
|
||||
"stevearc/dressing.nvim",
|
||||
-- highlight todo/fixme/etc
|
||||
{ "folke/todo-comments.nvim", opts = {} },
|
||||
-- pretty much default nvim at this point
|
||||
{ "kylechui/nvim-surround", opts = {} },
|
||||
{ "numtostr/comment.nvim", opts = {} },
|
||||
--
|
||||
{
|
||||
"AndrewRadev/tagalong.vim",
|
||||
config = function()
|
||||
vim.g.tagalong_filetypes = {
|
||||
"astro",
|
||||
"ejs",
|
||||
"html",
|
||||
"htmldjango",
|
||||
"javascriptreact",
|
||||
"jsx",
|
||||
"php",
|
||||
"typescriptreact",
|
||||
"xml",
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"lukas-reineke/headlines.nvim",
|
||||
dependencies = "nvim-treesitter/nvim-treesitter",
|
||||
opts = {},
|
||||
},
|
||||
{ "dnlhc/glance.nvim", opts = {} },
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
branch = "legacy",
|
||||
opts = {
|
||||
text = {
|
||||
spinner = "dots",
|
||||
done = "",
|
||||
commenced = "init",
|
||||
completed = "done",
|
||||
},
|
||||
window = { blend = 0 },
|
||||
sources = {
|
||||
["copilot"] = { ignore = true },
|
||||
["null-ls"] = { ignore = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
"tpope/vim-fugitive",
|
||||
{
|
||||
"NeogitOrg/neogit",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"sindrets/diffview.nvim",
|
||||
},
|
||||
opts = {
|
||||
integrations = {
|
||||
diffview = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
local present, wk = pcall(require, "which-key")
|
||||
|
||||
if not present then
|
||||
vim.notify("which-key not found")
|
||||
return
|
||||
end
|
||||
|
||||
local gs = require("gitsigns")
|
||||
|
||||
gs.setup({
|
||||
on_attach = function(_)
|
||||
-- Gitsigns
|
||||
wk.register({
|
||||
["<leader>h"] = {
|
||||
name = "+Gitsigns",
|
||||
s = { "<cmd>Gitsigns stage_hunk<CR>", "Stage Hunk" },
|
||||
r = { "<cmd>Gitsigns reset_hunk<CR>", "Reset Hunk" },
|
||||
},
|
||||
}, { mode = { "n", "v" } })
|
||||
|
||||
wk.register({
|
||||
["<leader>h"] = {
|
||||
name = "+Gitsigns",
|
||||
s = { gs.stage_buffer, "Stage Buffer" },
|
||||
u = { gs.undo_stage_hunk, "Undo Stage Hunk" },
|
||||
R = { gs.reset_buffer, "Reset Buffer" },
|
||||
p = { gs.preview_hunk, "Preview Hunk" },
|
||||
b = {
|
||||
function()
|
||||
gs.blame_line({ full = true })
|
||||
end,
|
||||
"Blame line",
|
||||
},
|
||||
d = { gs.diffthis, "Diff current buffer" },
|
||||
D = {
|
||||
function()
|
||||
gs.diffthis("~")
|
||||
end,
|
||||
"Diff against last commit",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
wk.register({
|
||||
["<leader>t"] = {
|
||||
name = "+Toggle settings",
|
||||
b = { gs.toggle_current_line_blame, "Toggle blame lines" },
|
||||
d = { gs.toggle_deleted, "Toggle deleted lines" },
|
||||
},
|
||||
})
|
||||
|
||||
wk.register({
|
||||
["[c"] = {
|
||||
function()
|
||||
if vim.wo.diff then
|
||||
return "[c"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end,
|
||||
"Go to previous hunk",
|
||||
},
|
||||
["]c"] = {
|
||||
function()
|
||||
if vim.wo.diff then
|
||||
return "]c"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end,
|
||||
"Go to next hunk",
|
||||
},
|
||||
}, { expr = true })
|
||||
|
||||
-- Text object
|
||||
wk.register({
|
||||
["ih"] = { ":<C-U>Gitsigns select_hunk<CR>", "Select inside Hunk" },
|
||||
}, { mode = { "o", "x" } })
|
||||
end,
|
||||
current_line_blame = true,
|
||||
current_line_blame_formatter = "<author>, <author_time:%R> - <summary> | <abbrev_sha>",
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
config = function()
|
||||
require("indent_blankline").setup({
|
||||
space_char_blankline = " ",
|
||||
})
|
||||
vim.g.indent_blankline_filetype_exclude = {
|
||||
"alpha",
|
||||
"fugitive",
|
||||
"help",
|
||||
"lazy",
|
||||
"NeogitCommitView",
|
||||
"NeogitConsole",
|
||||
"NeogitStatus",
|
||||
"NvimTree",
|
||||
"TelescopePrompt",
|
||||
"Trouble",
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- completion
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"petertriho/cmp-git",
|
||||
"onsails/lspkind.nvim",
|
||||
"rafamadriz/friendly-snippets",
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
opts = { padding = false },
|
||||
},
|
||||
{ "folke/neodev.nvim", opts = true },
|
||||
"nvim-lua/lsp-status.nvim",
|
||||
"barreiroleo/ltex-extra.nvim",
|
||||
"b0o/schemastore.nvim",
|
||||
"hallerpatrick/py_lsp.nvim",
|
||||
-- rust lsp, dap, dependency management
|
||||
{ "saecki/crates.nvim", opts = true },
|
||||
"simrat39/rust-tools.nvim",
|
||||
-- lua native typescript lsp plugin
|
||||
"pmizio/typescript-tools.nvim",
|
||||
{ "ray-x/go.nvim", dependencies = { "ray-x/guihua.lua" } },
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
{ "rcarriga/nvim-dap-ui" },
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
},
|
||||
config = function()
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("lsp")
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
{
|
||||
"SmiteshP/nvim-navic",
|
||||
dependencies = { "neovim/nvim-lspconfig" },
|
||||
opts = {
|
||||
highlight = true,
|
||||
separator = " ",
|
||||
icons = {
|
||||
File = " ",
|
||||
Module = " ",
|
||||
Namespace = " ",
|
||||
Package = " ",
|
||||
Class = " ",
|
||||
Method = " ",
|
||||
Property = " ",
|
||||
Field = " ",
|
||||
Constructor = " ",
|
||||
Enum = " ",
|
||||
Interface = " ",
|
||||
Function = " ",
|
||||
Variable = " ",
|
||||
Constant = " ",
|
||||
String = " ",
|
||||
Number = " ",
|
||||
Boolean = " ",
|
||||
Array = " ",
|
||||
Object = " ",
|
||||
Key = " ",
|
||||
Null = " ",
|
||||
EnumMember = " ",
|
||||
Struct = " ",
|
||||
Event = " ",
|
||||
Operator = " ",
|
||||
TypeParameter = " ",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local lualine = require("lualine")
|
||||
lualine.setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "catppuccin",
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
always_divide_middle = true,
|
||||
globalstatus = true,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { "searchcount" },
|
||||
lualine_x = { "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {
|
||||
lualine_c = { "navic" },
|
||||
lualine_x = {
|
||||
{
|
||||
function()
|
||||
return " "
|
||||
end,
|
||||
cond = function()
|
||||
local present, navic = pcall(require, "nvim-navic")
|
||||
if not present then
|
||||
return false
|
||||
end
|
||||
return navic.is_available()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"dhruvasagar/vim-table-mode",
|
||||
config = function()
|
||||
vim.cmd([[autocmd FileType markdown let g:table_mode_corner='|']])
|
||||
end,
|
||||
},
|
||||
"jamessan/vim-gnupg",
|
||||
{ "iamcco/markdown-preview.nvim", build = "cd app && yarn install" },
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"nvim-neorg/neorg",
|
||||
build = ":Neorg sync-parsers",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("neorg").setup({
|
||||
load = {
|
||||
["core.defaults"] = {}, -- Loads default behaviour
|
||||
["core.concealer"] = {}, -- Adds pretty icons to your documents
|
||||
["core.dirman"] = { -- Manages Neorg workspaces
|
||||
config = {
|
||||
workspaces = {
|
||||
notes = "~/notes",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
config = function()
|
||||
local notify = require("notify")
|
||||
notify.setup({
|
||||
timeout = 1000,
|
||||
render = "compact",
|
||||
stages = "fade",
|
||||
})
|
||||
vim.notify = notify
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
opts = {
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
},
|
||||
actions = {
|
||||
file_popup = {
|
||||
open_win_config = {
|
||||
border = vim.g.bc.style,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
local C = require("catppuccin.palettes").get_palette()
|
||||
|
||||
local devicons = require("nvim-web-devicons")
|
||||
local justfile = {
|
||||
icon = "",
|
||||
name = "Justfile",
|
||||
color = C.peach,
|
||||
}
|
||||
devicons.setup({
|
||||
override_by_extension = {
|
||||
["astro"] = {
|
||||
icon = "",
|
||||
name = "Astro",
|
||||
color = C.red,
|
||||
},
|
||||
["dt"] = {
|
||||
icon = "",
|
||||
name = "Diet",
|
||||
color = "#427819",
|
||||
},
|
||||
["norg"] = {
|
||||
icon = "",
|
||||
name = "Neorg",
|
||||
color = C.green,
|
||||
},
|
||||
},
|
||||
override_by_filename = {
|
||||
[".ecrc"] = {
|
||||
icon = "",
|
||||
name = "EditorConfigChecker",
|
||||
color = C.green,
|
||||
},
|
||||
[".envrc"] = {
|
||||
icon = "",
|
||||
name = "envrc",
|
||||
color = C.yellow,
|
||||
},
|
||||
[".editorconfig"] = {
|
||||
icon = "",
|
||||
name = "EditorConfig",
|
||||
color = C.green,
|
||||
},
|
||||
[".luacheckrc"] = {
|
||||
icon = "",
|
||||
name = "LuacheckRC",
|
||||
color = C.blue,
|
||||
},
|
||||
[".Justfile"] = justfile,
|
||||
[".justfile"] = justfile,
|
||||
["Justfile"] = justfile,
|
||||
["justfile"] = justfile,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"andweeb/presence.nvim",
|
||||
config = function()
|
||||
local presence = require("presence")
|
||||
|
||||
local function starts_with(self, str)
|
||||
return self:find("^" .. str) ~= nil
|
||||
end
|
||||
|
||||
local home = vim.fn.expand("$HOME") .. "/Code/"
|
||||
|
||||
local blacklist = {
|
||||
[vim.fn.resolve(home .. "work")] = "Using nvim at work.",
|
||||
[vim.fn.resolve(home .. "freelance")] = "Using nvim to freelance.",
|
||||
}
|
||||
|
||||
---@param activity string?
|
||||
---@param info string?
|
||||
---@return {text: string, state: boolean}
|
||||
local conceal = function(activity, info)
|
||||
local cur_file = vim.fn.expand("%:p")
|
||||
for k, v in pairs(blacklist) do
|
||||
if starts_with(cur_file, k) then
|
||||
return { text = v, state = true }
|
||||
end
|
||||
end
|
||||
if info ~= nil then
|
||||
return { text = activity .. " " .. info, state = false }
|
||||
end
|
||||
return { text = activity, state = false }
|
||||
end
|
||||
|
||||
local v = vim.version()
|
||||
local vStr = string.format("v%d.%d.%d", v.major, v.minor, v.patch)
|
||||
|
||||
presence:setup({
|
||||
auto_update = true,
|
||||
debounce_timeout = 10,
|
||||
neovim_image_text = "Neovim " .. vStr,
|
||||
-- Main image display (either "neovim" or "file")
|
||||
main_image = "file",
|
||||
show_time = true,
|
||||
enable_line_number = true,
|
||||
buttons = function(_, repo_url)
|
||||
local concealed = conceal().state
|
||||
|
||||
if concealed then
|
||||
return {
|
||||
{
|
||||
label = "View my config",
|
||||
url = "https://github.com/nekowinston/dotfiles",
|
||||
},
|
||||
}
|
||||
else
|
||||
return {
|
||||
{
|
||||
label = "Steal the code",
|
||||
url = repo_url,
|
||||
},
|
||||
}
|
||||
end
|
||||
end,
|
||||
file_assets = {
|
||||
["d"] = {
|
||||
"Dlang",
|
||||
"https://github.com/dlang.png",
|
||||
},
|
||||
["astro"] = {
|
||||
"Astro",
|
||||
"https://github.com/withastro.png",
|
||||
},
|
||||
["k8s.yaml"] = {
|
||||
"Kubernetes",
|
||||
"https://github.com/kubernetes.png",
|
||||
},
|
||||
["Chart.yaml"] = {
|
||||
"Helm Chart",
|
||||
"https://raw.githubusercontent.com/helm/community/main/art/images/Logo-Tweak-Dark.png",
|
||||
},
|
||||
["helmfile.yaml"] = {
|
||||
"helmfile",
|
||||
"https://raw.githubusercontent.com/helm/community/main/art/images/Logo-Tweak-Dark.png",
|
||||
},
|
||||
["prisma"] = {
|
||||
"Prisma",
|
||||
"https://github.com/prisma.png",
|
||||
},
|
||||
["bu"] = {
|
||||
"Butane Config",
|
||||
"https://github.com/coreos.png",
|
||||
},
|
||||
["ign"] = {
|
||||
"CoreOS Ignition",
|
||||
"https://github.com/coreos.png",
|
||||
},
|
||||
},
|
||||
-- Rich Presence text options
|
||||
editing_text = function(s)
|
||||
return conceal("Editing", s).text
|
||||
end,
|
||||
reading_text = function(s)
|
||||
return conceal("Reading", s).text
|
||||
end,
|
||||
file_explorer_text = function(s)
|
||||
return conceal("Browsing", s).text
|
||||
end,
|
||||
workspace_text = function(s)
|
||||
local concealed = conceal()
|
||||
if s ~= nil and not concealed.state then
|
||||
return "Working on " .. s
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end,
|
||||
git_commit_text = "Committing changes",
|
||||
plugin_manager_text = "Managing Plugins",
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"nvim-pack/nvim-spectre",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
opts = {
|
||||
replace_engine = {
|
||||
sed = {
|
||||
cmd = "sed",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
local bc = vim.g.bc
|
||||
|
||||
local no_preview = function(opts)
|
||||
local defaults = require("telescope.themes").get_dropdown({
|
||||
-- stylua: ignore
|
||||
borderchars = {
|
||||
{ bc.horiz, bc.vert, bc.horiz, bc.vert, bc.topleft, bc.topright, bc.botright, bc.botleft },
|
||||
prompt = { bc.horiz, bc.vert, " ", bc.vert, bc.topleft, bc.topright, bc.vert, bc.vert },
|
||||
results = { bc.horiz, bc.vert, bc.horiz, bc.vert, bc.vertright, bc.vertleft, bc.botright, bc.botleft },
|
||||
preview = { bc.horiz, bc.vert, bc.horiz, bc.vert, bc.topleft, bc.topright, bc.botright, bc.botleft },
|
||||
},
|
||||
width = 0.8,
|
||||
previewer = false,
|
||||
prompt_title = false,
|
||||
results_title = false,
|
||||
})
|
||||
return vim.tbl_deep_extend("keep", opts or {}, defaults)
|
||||
end
|
||||
|
||||
---@type LazySpec[]
|
||||
return {
|
||||
{
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-tree/nvim-web-devicons" },
|
||||
|
||||
{ "GustavoKatel/telescope-asynctasks.nvim" },
|
||||
{ "nvim-telescope/telescope-file-browser.nvim" },
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
{ "nvim-telescope/telescope-project.nvim" },
|
||||
{ "nvim-telescope/telescope-ui-select.nvim" },
|
||||
|
||||
{ "pwntester/octo.nvim", opts = {} },
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
|
||||
pcall(telescope.load_extension, "asynctasks")
|
||||
pcall(telescope.load_extension, "file_browser")
|
||||
pcall(telescope.load_extension, "fzf")
|
||||
pcall(telescope.load_extension, "notify")
|
||||
pcall(telescope.load_extension, "project")
|
||||
pcall(telescope.load_extension, "ui-select")
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
multi_icon = "│",
|
||||
-- stylua: ignore
|
||||
borderchars = { bc.horiz, bc.vert, bc.horiz, bc.vert, bc.topleft, bc.topright, bc.botright, bc.botleft },
|
||||
},
|
||||
pickers = {
|
||||
find_files = no_preview(),
|
||||
live_grep = no_preview({
|
||||
previewer = true,
|
||||
}),
|
||||
load_session = no_preview(),
|
||||
},
|
||||
extensions = {
|
||||
file_browser = {
|
||||
grouped = true,
|
||||
sorting_strategy = "ascending",
|
||||
},
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case",
|
||||
},
|
||||
["ui-select"] = no_preview(),
|
||||
},
|
||||
})
|
||||
|
||||
local wk_present, wk = pcall(require, "which-key")
|
||||
if not wk_present then
|
||||
return
|
||||
end
|
||||
wk.register({
|
||||
["<leader>f"] = {
|
||||
name = "+Telescope",
|
||||
b = {
|
||||
"<cmd>Telescope file_browser grouped=true<cr>",
|
||||
"File browser",
|
||||
},
|
||||
d = { "<cmd>Telescope find_files<cr>", "Find file" },
|
||||
g = { "<cmd>Telescope live_grep<cr>", "Live grep" },
|
||||
h = { "<cmd>Telescope help_tags<cr>", "Help tags" },
|
||||
n = { "<cmd>Telescope notify<cr>", "Show notifications" },
|
||||
p = { "<cmd>Telescope project<cr>", "Project" },
|
||||
r = { "<cmd>Telescope asynctasks all<cr>", "Run asynctasks" },
|
||||
s = {
|
||||
function()
|
||||
require("telescope.builtin").find_files({
|
||||
cwd = vim.fn.resolve(vim.fn.stdpath("config")),
|
||||
})
|
||||
end,
|
||||
"Find in config",
|
||||
},
|
||||
S = { "<cmd>SessionManager load_session<cr>", "Show sessions" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"akinsho/toggleterm.nvim",
|
||||
version = "*",
|
||||
opts = {
|
||||
open_mapping = "<C-t>",
|
||||
shade_terminals = false,
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = function()
|
||||
require("nvim-treesitter.install").update()
|
||||
end,
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
auto_install = true,
|
||||
ignore_install = {
|
||||
"phpdoc",
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
rainbow = {
|
||||
enable = true,
|
||||
extended_mode = true,
|
||||
max_file_lines = 8192,
|
||||
},
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"css",
|
||||
"dockerfile",
|
||||
"go",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"python",
|
||||
"regex",
|
||||
"rust",
|
||||
"scss",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"yaml",
|
||||
},
|
||||
})
|
||||
vim.o.foldmethod = "expr"
|
||||
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.o.foldenable = false
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
config = { mode = "topline" },
|
||||
},
|
||||
"nvim-treesitter/playground",
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
"windwp/nvim-ts-autotag",
|
||||
"hiphish/rainbow-delimiters.nvim",
|
||||
|
||||
-- not treesitter, but close enough
|
||||
"towolf/vim-helm",
|
||||
"NoahTheDuke/vim-just",
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
"wakatime/vim-wakatime",
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
---@type LazyPluginSpec[]
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.setup({
|
||||
key_labels = {
|
||||
["<space>"] = " ",
|
||||
["<leader>"] = " ",
|
||||
["<bs>"] = " ",
|
||||
["<cr>"] = " ",
|
||||
["<esc>"] = " ",
|
||||
["<tab>"] = " ",
|
||||
},
|
||||
window = {
|
||||
border = vim.g.bc.style,
|
||||
margin = { 0, 0, 0, 0 },
|
||||
},
|
||||
})
|
||||
|
||||
-- clipboard
|
||||
wk.register({
|
||||
["<leader>"] = {
|
||||
y = { '"+y', "Copy to clipboard" },
|
||||
p = { '"+p', "Paste from clipboard" },
|
||||
db = { "<cmd>DBUIToggle<cr>", "Toggle DBUI" },
|
||||
gd = { "<cmd>Gvdiff!<CR>", "Git diff" },
|
||||
ng = { "<cmd>Neogit<cr>", "Neogit" },
|
||||
},
|
||||
}, { mode = { "n", "v" } })
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,611 +0,0 @@
|
|||
{
|
||||
"k8s Ingress with TLS": {
|
||||
"prefix": "k-ingress-tls",
|
||||
"description": "k8s Ingress with TLS",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/services-networking/ingress/#tls",
|
||||
"apiVersion: v1",
|
||||
"kind: Secret",
|
||||
"metadata:",
|
||||
" name: ${1:testsecret-tls}",
|
||||
" namespace: ${2:default}",
|
||||
"type: kubernetes.io/tls",
|
||||
"# The TLS secret must contain keys named 'tls.crt' and 'tls.key' that contain the certificate and private key to use for TLS.",
|
||||
"data:",
|
||||
" tls.crt: base64 encoded cert",
|
||||
" tls.key: base64 encoded key",
|
||||
"",
|
||||
"---",
|
||||
"apiVersion: networking.k8s.io/v1",
|
||||
"kind: Ingress",
|
||||
"metadata:",
|
||||
" name: ${3:tls-example-ingress}",
|
||||
" namespace: ${2:default}",
|
||||
"spec:",
|
||||
" tls:",
|
||||
" - hosts:",
|
||||
" - ${4:https-example.foo.com}",
|
||||
" secretName: ${1:testsecret-tls}",
|
||||
" rules:",
|
||||
" - host: ${4:https-example.foo.com}",
|
||||
" http:",
|
||||
" paths:",
|
||||
" - path: /${5}",
|
||||
" pathType: Prefix",
|
||||
" backend:",
|
||||
" service:",
|
||||
" name: ${6:service1}",
|
||||
" port:",
|
||||
" number: ${7:80}",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s Ingress": {
|
||||
"prefix": "k-ingress",
|
||||
"description": "k8s Ingress",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/services-networking/ingress/",
|
||||
"apiVersion: networking.k8s.io/v1",
|
||||
"kind: Ingress",
|
||||
"metadata:",
|
||||
" name: ${1:example-ingress}",
|
||||
" namespace: ${2:default}",
|
||||
"spec:",
|
||||
" rules:",
|
||||
" - host: ${3:example.foo.com}",
|
||||
" http:",
|
||||
" paths:",
|
||||
" - path: /${4}",
|
||||
" pathType: ${5|Prefix,Exact|}",
|
||||
" backend:",
|
||||
" service:",
|
||||
" name: ${6:service1}",
|
||||
" port:",
|
||||
" number: ${7:80}",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s Ingress with Rewrite rule": {
|
||||
"prefix": "k-ingress-rewrite",
|
||||
"description": "k8s Ingress with Rewrite rule",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/services-networking/ingress/",
|
||||
"apiVersion: networking.k8s.io/v1",
|
||||
"kind: Ingress",
|
||||
"metadata:",
|
||||
" name: ${1:example-ingress}",
|
||||
" namespace: ${2:default}",
|
||||
" # https://kubernetes.github.io/ingress-nginx/examples/rewrite/",
|
||||
" annotations:",
|
||||
" nginx.ingress.kubernetes.io/rewrite-target: /\\$1",
|
||||
"spec:",
|
||||
" rules:",
|
||||
" - host: ${3:example.foo.com}",
|
||||
" http:",
|
||||
" paths:",
|
||||
" - path: ${4:/api/(.*)}",
|
||||
" pathType: Prefix",
|
||||
" backend:",
|
||||
" service:",
|
||||
" name: ${5:service1}",
|
||||
" port:",
|
||||
" number: ${6:80}",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s Deployment": {
|
||||
"prefix": "k-deploymment",
|
||||
"description": "k8s Deployment",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/workloads/controllers/deployment/",
|
||||
"apiVersion: apps/v1",
|
||||
"kind: Deployment",
|
||||
"metadata:",
|
||||
" name: ${1:myjob}",
|
||||
" namespace: ${2:default}",
|
||||
" labels:",
|
||||
" app: ${1:myjob}",
|
||||
"spec:",
|
||||
" selector:",
|
||||
" matchLabels:",
|
||||
" app: ${1:myjob}",
|
||||
" replicas: 1",
|
||||
" strategy:",
|
||||
" rollingUpdate:",
|
||||
" maxSurge: 25%",
|
||||
" maxUnavailable: 25%",
|
||||
" type: RollingUpdate",
|
||||
" template:",
|
||||
" metadata:",
|
||||
" labels:",
|
||||
" app: ${1:myjob}",
|
||||
" spec:",
|
||||
" # initContainers:",
|
||||
" # Init containers are exactly like regular containers, except:",
|
||||
" # - Init containers always run to completion.",
|
||||
" # - Each init container must complete successfully before the next one starts.",
|
||||
" containers:",
|
||||
" - name: ${1:myjob}",
|
||||
" image: ${3:myjob:latest}",
|
||||
" imagePullPolicy: ${4|IfNotPresent,Always,Never|}",
|
||||
" resources:",
|
||||
" requests:",
|
||||
" cpu: 100m",
|
||||
" memory: 100Mi",
|
||||
" limits:",
|
||||
" cpu: 100m",
|
||||
" memory: 100Mi",
|
||||
" livenessProbe:",
|
||||
" tcpSocket:",
|
||||
" port: ${5:80}",
|
||||
" initialDelaySeconds: 5",
|
||||
" timeoutSeconds: 5",
|
||||
" successThreshold: 1",
|
||||
" failureThreshold: 3",
|
||||
" periodSeconds: 10",
|
||||
" readinessProbe:",
|
||||
" httpGet:",
|
||||
" path: /_status/healthz",
|
||||
" port: ${5:80}",
|
||||
" initialDelaySeconds: 5",
|
||||
" timeoutSeconds: 2",
|
||||
" successThreshold: 1",
|
||||
" failureThreshold: 3",
|
||||
" periodSeconds: 10",
|
||||
" env:",
|
||||
" - name: ACCEPT_EULA",
|
||||
" value: \"Y\"",
|
||||
" - name: DB_HOST",
|
||||
" valueFrom:",
|
||||
" configMapKeyRef:",
|
||||
" name: ${1:myjob}",
|
||||
" key: DB_HOST",
|
||||
" - name: DB_HOST",
|
||||
" valueFrom:",
|
||||
" secretKeyRef:",
|
||||
" name: ${1:mysecret}",
|
||||
" key: MSSQL_SA_PASSWORD",
|
||||
" ports:",
|
||||
" - containerPort: ${5:80}",
|
||||
" name: ${1:myjob}",
|
||||
" volumeMounts:",
|
||||
" - name: localtime",
|
||||
" mountPath: /etc/localtime",
|
||||
" volumes:",
|
||||
" - name: localtime",
|
||||
" hostPath:",
|
||||
" path: /usr/share/zoneinfo/Asia/Taipei",
|
||||
" restartPolicy: Always",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s Service": {
|
||||
"prefix": "k-service",
|
||||
"description": "k8s Service",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/services-networking/service/",
|
||||
"apiVersion: v1",
|
||||
"kind: Service",
|
||||
"metadata:",
|
||||
" name: ${1:myjob}",
|
||||
" namespace: ${2:default}",
|
||||
"spec:",
|
||||
" selector:",
|
||||
" app: ${1:myjob}",
|
||||
" type: ${3|ClusterIP,NodePort,LoadBalancer|}",
|
||||
" ports:",
|
||||
" - name: ${1:myjob}",
|
||||
" protocol: ${4|TCP,UDP|}",
|
||||
" port: ${5:80}",
|
||||
" targetPort: ${6:5000}",
|
||||
" nodePort: ${7:30001}",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s ConfigMap": {
|
||||
"prefix": "k-configmap",
|
||||
"description": "k8s ConfigMap",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/configuration/configmap/",
|
||||
"kind: ConfigMap",
|
||||
"apiVersion: v1",
|
||||
"metadata:",
|
||||
" name: ${1:myconfig}",
|
||||
" namespace: ${2:default}",
|
||||
"data:",
|
||||
" ${3:key}: ${4:value}",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s Secret": {
|
||||
"prefix": "k-secret",
|
||||
"description": "k8s Secret",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/configuration/secret/",
|
||||
"apiVersion: v1",
|
||||
"kind: Secret",
|
||||
"metadata:",
|
||||
" name: ${1:mysecret}",
|
||||
" namespace: ${2:default}",
|
||||
"type: ${3|Opaque,kubernetes.io/dockerconfigjson,kubernetes.io/dockercfg,kubernetes.io/basic-auth,kubernetes.io/ssh-auth,kubernetes.io/tls,kubernetes.io/service-account-token,bootstrap.kubernetes.io/token|}",
|
||||
"data:",
|
||||
" # Example:",
|
||||
" # password: {{ .Values.password | b64enc }}",
|
||||
"# stringData:",
|
||||
"# username: admin # required field for kubernetes.io/basic-auth",
|
||||
"# password: t0p-Secret # required field for kubernetes.io/basic-auth",
|
||||
"# immutable: true",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s Job": {
|
||||
"prefix": "k-job",
|
||||
"description": "k8s Job",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/workloads/controllers/job/",
|
||||
"apiVersion: batch/v1",
|
||||
"kind: Job",
|
||||
"metadata:",
|
||||
" name: ${1:myjob}",
|
||||
" namespace: ${2:default}",
|
||||
" labels:",
|
||||
" app: ${1:myjob}",
|
||||
"spec:",
|
||||
" template:",
|
||||
" metadata:",
|
||||
" name: ${1:myjob}",
|
||||
" labels:",
|
||||
" app: ${1:myjob}",
|
||||
" spec:",
|
||||
" containers:",
|
||||
" - name: ${1:myjob}",
|
||||
" image: ${3:python:3.7.6-alpine3.10}",
|
||||
" command: ['sh', '-c', '${4:python3 manage.py makemigrations && python3 manage.py migrate}']",
|
||||
" env:",
|
||||
" - name: ENV_NAME",
|
||||
" value: ENV_VALUE",
|
||||
" volumeMounts:",
|
||||
" - name: localtime",
|
||||
" mountPath: /etc/localtime",
|
||||
" volumes:",
|
||||
" - name: localtime",
|
||||
" hostPath:",
|
||||
" path: /usr/share/zoneinfo/Asia/Taipei",
|
||||
" restartPolicy: OnFailure",
|
||||
" dnsPolicy: ClusterFirst",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s CronJob": {
|
||||
"prefix": "k-cronjob",
|
||||
"description": "k8s CronJob",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/",
|
||||
"apiVersion: batch/v1beta1",
|
||||
"kind: CronJob",
|
||||
"metadata:",
|
||||
" name: ${1:cronjobname}",
|
||||
" namespace: ${2:default}",
|
||||
"spec:",
|
||||
" schedule: \"${3:*/1 * * * *}\"",
|
||||
" jobTemplate:",
|
||||
" spec:",
|
||||
" template:",
|
||||
" spec:",
|
||||
" containers:",
|
||||
" - name: ${4:jobname}",
|
||||
" image: ${5:busybox}",
|
||||
" args: ['/bin/sh', '-c', '${6:date; echo Hello from the Kubernetes cluster}']",
|
||||
" restartPolicy: OnFailure",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s Pod": {
|
||||
"prefix": "k-pod",
|
||||
"description": "k8s Pod",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/workloads/pods/",
|
||||
"apiVersion: v1",
|
||||
"kind: Pod",
|
||||
"metadata:",
|
||||
" name: \"${1:myapp}\"",
|
||||
" namespace: ${2:default}",
|
||||
" labels:",
|
||||
" app: \"${1:myapp}\"",
|
||||
"spec:",
|
||||
" containers:",
|
||||
" - name: ${1:myapp}",
|
||||
" image: \"${3:debian-slim:latest}\"",
|
||||
" resources:",
|
||||
" limits:",
|
||||
" cpu: 200m",
|
||||
" memory: 500Mi",
|
||||
" requests:",
|
||||
" cpu: 100m",
|
||||
" memory: 200Mi",
|
||||
" env:",
|
||||
" - name: DB_HOST",
|
||||
" valueFrom:",
|
||||
" configMapKeyRef:",
|
||||
" name: myapp",
|
||||
" key: DB_HOST",
|
||||
" ports:",
|
||||
" - containerPort: ${4:80}",
|
||||
" name: http",
|
||||
" volumeMounts:",
|
||||
" - name: localtime",
|
||||
" mountPath: /etc/localtime",
|
||||
" volumes:",
|
||||
" - name: localtime",
|
||||
" hostPath:",
|
||||
" path: /usr/share/zoneinfo/Asia/Taipei",
|
||||
" restartPolicy: Always",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s PersistentVolumeClaim": {
|
||||
"prefix": "k-pvc",
|
||||
"description": "k8s PersistentVolumeClaim",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/storage/persistent-volumes/",
|
||||
"apiVersion: v1",
|
||||
"kind: PersistentVolumeClaim",
|
||||
"metadata:",
|
||||
" name: ${1:myapp}",
|
||||
" namespace: ${2:default}",
|
||||
" labels:",
|
||||
" app: ${1:myapp}",
|
||||
"spec:",
|
||||
" # AKS: default,managed-premium",
|
||||
" # GKE: standard",
|
||||
" # EKS: gp2 (custom)",
|
||||
" # Rook: rook-ceph-block,rook-ceph-fs",
|
||||
" storageClassName: ${3|default,managed-premium,standard,gp2,rook-ceph-block,rook-ceph-fs|}",
|
||||
" accessModes:",
|
||||
" - ${4|ReadWriteOnce,ReadWriteMany,ReadOnlyMany|}",
|
||||
" resources:",
|
||||
" requests:",
|
||||
" storage: ${5:2Gi}",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s DaemonSet": {
|
||||
"prefix": "k-daemonset",
|
||||
"description": "k8s DaemonSet",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/",
|
||||
"apiVersion: apps/v1",
|
||||
"kind: DaemonSet",
|
||||
"metadata:",
|
||||
" name: ${1:myapp}",
|
||||
" namespace: ${2:default}",
|
||||
" labels:",
|
||||
" app: ${1:myapp}",
|
||||
"spec:",
|
||||
" selector:",
|
||||
" matchLabels:",
|
||||
" app: ${1:myapp}",
|
||||
" template:",
|
||||
" metadata:",
|
||||
" labels:",
|
||||
" app: ${1:myapp}",
|
||||
" spec:",
|
||||
" tolerations:",
|
||||
" # this toleration is to have the daemonset runnable on master nodes",
|
||||
" # remove it if your masters can't run pods",
|
||||
" - key: node-role.kubernetes.io/master",
|
||||
" effect: NoSchedule",
|
||||
" containers:",
|
||||
" - name: ${1:myapp}",
|
||||
" image: ${3:debian}",
|
||||
" resources:",
|
||||
" limits:",
|
||||
" memory: 200Mi",
|
||||
" requests:",
|
||||
" cpu: 100m",
|
||||
" memory: 200Mi",
|
||||
" volumeMounts:",
|
||||
" - name: localtime",
|
||||
" mountPath: /etc/localtime",
|
||||
" terminationGracePeriodSeconds: 30",
|
||||
" volumes:",
|
||||
" - name: localtime",
|
||||
" hostPath:",
|
||||
" path: /usr/share/zoneinfo/Asia/Taipei",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s StatefulSet": {
|
||||
"prefix": "k-statefulset",
|
||||
"description": "k8s StatefulSet",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/",
|
||||
"apiVersion: apps/v1",
|
||||
"kind: StatefulSet",
|
||||
"metadata:",
|
||||
" name: ${1:myapp}",
|
||||
" namespace: ${2:default}",
|
||||
"spec:",
|
||||
" selector:",
|
||||
" matchLabels:",
|
||||
" app: ${1:myapp} # has to match .spec.template.metadata.labels",
|
||||
" serviceName: \"${1:myapp}\"",
|
||||
" replicas: ${3:3} # by default is 1",
|
||||
" template:",
|
||||
" metadata:",
|
||||
" labels:",
|
||||
" app: ${1:myapp} # has to match .spec.selector.matchLabels",
|
||||
" spec:",
|
||||
" terminationGracePeriodSeconds: 10",
|
||||
" containers:",
|
||||
" - name: ${1:myapp}",
|
||||
" image: ${4:${1:myapp}-slim:1.16.1}",
|
||||
" ports:",
|
||||
" - containerPort: ${5:80}",
|
||||
" name: ${1:myapp}",
|
||||
" volumeMounts:",
|
||||
" - name: ${6:www}",
|
||||
" mountPath: /usr/share/nginx/html",
|
||||
" volumeClaimTemplates:",
|
||||
" - metadata:",
|
||||
" name: ${6:www}",
|
||||
" spec:",
|
||||
" storageClassName: ${7:my-storage-class}",
|
||||
" accessModes:",
|
||||
" - ${8|ReadWriteOnce,ReadWriteMany,ReadOnlyMany|}",
|
||||
" resources:",
|
||||
" requests:",
|
||||
" storage: ${9:1Gi}",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s NetworkPolicy": {
|
||||
"prefix": "k-networkpolicy",
|
||||
"description": "k8s NetworkPolicy",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/concepts/services-networking/network-policies/",
|
||||
"apiVersion: networking.k8s.io/v1",
|
||||
"kind: NetworkPolicy",
|
||||
"metadata:",
|
||||
" name: ${1:mypolicy}",
|
||||
" namespace: ${2:default}",
|
||||
"spec:",
|
||||
" podSelector:",
|
||||
" matchLabels:",
|
||||
" app: ${1:myapp}",
|
||||
" policyTypes:",
|
||||
" - Ingress",
|
||||
" ingress:",
|
||||
" - from:",
|
||||
" - podSelector:",
|
||||
" matchLabels:",
|
||||
" ${3:access}: ${4:granted}",
|
||||
" ports:",
|
||||
" - protocol: TCP",
|
||||
" port: ${5:8080}",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s Role": {
|
||||
"prefix": "k-role",
|
||||
"description": "k8s Role",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/reference/access-authn-authz/rbac/",
|
||||
"apiVersion: rbac.authorization.k8s.io/v1",
|
||||
"kind: Role",
|
||||
"metadata:",
|
||||
" name: ${1:role}",
|
||||
" namespace: ${2:default}",
|
||||
"rules:",
|
||||
"- apiGroups: [${3:\"\"}] # \"\" indicates the core API group",
|
||||
" resources: [${4:\"pods\"}]",
|
||||
" verbs: [${5:\"get\", \"watch\", \"list\"}]",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s ClusterRole": {
|
||||
"prefix": "k-clusterrole",
|
||||
"description": "k8s ClusterRole",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/reference/access-authn-authz/rbac/",
|
||||
"apiVersion: rbac.authorization.k8s.io/v1",
|
||||
"kind: ClusterRole",
|
||||
"metadata:",
|
||||
" name: ${1:clusterrole}",
|
||||
"rules:",
|
||||
"- apiGroups: [${3:\"\"}] # \"\" indicates the core API group",
|
||||
" resources: [${4:\"secrets\"}]",
|
||||
" verbs: [${5:\"get\", \"watch\", \"list\"}]",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s RoleBinding": {
|
||||
"prefix": "k-rolebinding",
|
||||
"description": "k8s RoleBinding",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/reference/access-authn-authz/rbac/",
|
||||
"apiVersion: rbac.authorization.k8s.io/v1",
|
||||
"kind: RoleBinding",
|
||||
"metadata:",
|
||||
" name: ${1:rolebinding}",
|
||||
" namespace: ${2:default}",
|
||||
"subjects:",
|
||||
"- kind: ${3|User,Group,ServiceAccount|}",
|
||||
" name: ${4:name} # Name is case sensitive",
|
||||
" apiGroup: rbac.authorization.k8s.io",
|
||||
"roleRef:",
|
||||
" kind: ${5:Role}",
|
||||
" name: ${6:RoleName}",
|
||||
" apiGroup: rbac.authorization.k8s.io",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s ClusterRoleBinding": {
|
||||
"prefix": "k-clusterrolebinding",
|
||||
"description": "k8s ClusterRoleBinding",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/reference/access-authn-authz/rbac/",
|
||||
"apiVersion: rbac.authorization.k8s.io/v1",
|
||||
"kind: ClusterRoleBinding",
|
||||
"metadata:",
|
||||
" name: ${1:clusterrolebinding}",
|
||||
"subjects:",
|
||||
"- kind: ${2|User,Group,ServiceAccount|}",
|
||||
" name: ${3:name} # Name is case sensitive",
|
||||
" apiGroup: rbac.authorization.k8s.io",
|
||||
"roleRef:",
|
||||
" kind: ${4:ClusterRole}",
|
||||
" name: ${5:RoleName}",
|
||||
" apiGroup: rbac.authorization.k8s.io",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s ServiceAccount": {
|
||||
"prefix": "k-serviceaccount",
|
||||
"description": "k8s ServiceAccount",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/reference/access-authn-authz/rbac/",
|
||||
"apiVersion: rbac.authorization.k8s.io/v1",
|
||||
"kind: ServiceAccount",
|
||||
"metadata:",
|
||||
" name: ${1:serviceaccount}",
|
||||
" namespace: ${2:default}",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
},
|
||||
"k8s ServiceAccount-ImagePullSecrets": {
|
||||
"prefix": "k-serviceaccount-imagepullsecrets",
|
||||
"description": "k8s ServiceAccount with ImagePullSecrets",
|
||||
"body": [
|
||||
"# https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account",
|
||||
"apiVersion: rbac.authorization.k8s.io/v1",
|
||||
"kind: ServiceAccount",
|
||||
"metadata:",
|
||||
" name: ${1:serviceaccount}",
|
||||
" namespace: ${2:default}",
|
||||
"imagePullSecrets:",
|
||||
" - name: ${3:myregistrykey}",
|
||||
"---",
|
||||
"$0"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue