mirror of
https://github.com/outbackdingo/Biohazard.git
synced 2026-01-27 10:18:27 +00:00
feat(dots/nvim): folding, cmp git, org mode
This commit is contained in:
@@ -47,11 +47,7 @@ require("lazy").setup({
|
||||
spec = {
|
||||
-- # Plugins
|
||||
-- colorscheme
|
||||
{ "folke/tokyonight.nvim", lazy = false, priority = 1000, opts = { style = "night" }, config = function()
|
||||
-- load the colorscheme here
|
||||
vim.cmd([[colorscheme tokyonight-night]])
|
||||
end,
|
||||
},
|
||||
{ "folke/tokyonight.nvim", lazy = false, priority = 1000, opts = { style = "night" }, config = function() vim.cmd([[colorscheme tokyonight-night]]); end, },
|
||||
--- on-screen key prompts
|
||||
{ "folke/which-key.nvim", event = "VeryLazy", opts = {} },
|
||||
-- rainbow indents
|
||||
@@ -100,6 +96,8 @@ require("lazy").setup({
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "yaml", "go", "dockerfile", "fish", "bash", "python", "javascript", "typescript", "html", "css" },
|
||||
--ensure_installed = 'all',
|
||||
ignore_install = { 'org' }, -- nvim-orgmode compatibility
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
@@ -110,6 +108,12 @@ require("lazy").setup({
|
||||
{ "nvim-telescope/telescope.nvim", event = "VeryLazy", },
|
||||
-- auto brackets
|
||||
{ 'windwp/nvim-autopairs', event = "InsertEnter", opts = {}, },
|
||||
---- folding
|
||||
{ "kevinhwang91/nvim-ufo", dependencies = { "kevinhwang91/promise-async" }, event = { "BufReadPre", "BufNewFile" }, opts = {
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
return { "treesitter", "indent" } -- LSP takes too long to init
|
||||
end
|
||||
}},
|
||||
-- Autocomplete
|
||||
{ "hrsh7th/nvim-cmp",
|
||||
version = false, -- last release is way too old
|
||||
@@ -130,14 +134,27 @@ require("lazy").setup({
|
||||
-- actual cmp config
|
||||
local defaults = require("cmp.config.default")()
|
||||
local auto_select = true
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'conventionalcommits' },
|
||||
{ name = 'commit' },
|
||||
{ name = 'git' },
|
||||
}, {
|
||||
{ name = "async_path" },
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
cmp.setup.filetype('org', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "orgmode" },
|
||||
{ name = "async_path" },
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
return {
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
|
||||
end,
|
||||
},
|
||||
sources = cmp.config.sources({ -- TODO: git sources
|
||||
snippet = { expand = function(args) vim.snippet.expand(args.body); end, }, -- REQUIRED to specify snippet engine -- `vim.snippet` for native neovim snippets (Neovim v0.10+)
|
||||
sources = cmp.config.sources({ -- multiple tables is so the first table must have no results before the second table is shown, etc
|
||||
-- TODO: git sources
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "bufname" },
|
||||
@@ -146,10 +163,8 @@ require("lazy").setup({
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"),
|
||||
},
|
||||
preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None,
|
||||
completion = { completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"), }, -- suggested config
|
||||
preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None, -- suggested config
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
@@ -160,16 +175,15 @@ require("lazy").setup({
|
||||
['<C-c>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
}),
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "CmpGhostText",
|
||||
},
|
||||
},
|
||||
sorting = defaults.sorting,
|
||||
experimental = { ghost_text = { hl_group = "CmpGhostText", }, }, -- suggested config
|
||||
sorting = defaults.sorting, -- suggested config
|
||||
}
|
||||
end,
|
||||
},
|
||||
{ "mtoohey31/cmp-fish", ft = "fish" },
|
||||
{ "davidsierradz/cmp-conventionalcommits", ft = "gitcommit", },
|
||||
{ "Dosx001/cmp-commit", ft = "gitcommit", },
|
||||
{ "petertriho/cmp-git", ft = "gitcommit", },
|
||||
{ "ray-x/lsp_signature.nvim", event = "VeryLazy", opts = {}, },
|
||||
-- LSP
|
||||
{ "williamboman/mason.nvim", lazy = true },
|
||||
@@ -179,7 +193,8 @@ require("lazy").setup({
|
||||
{ "someone-stole-my-name/yaml-companion.nvim",
|
||||
--{ "msvechla/yaml-companion.nvim",
|
||||
-- branch = "kubernetes_crd_detection",
|
||||
ft = { "yaml"},
|
||||
--event = "VeryLazy",
|
||||
ft = { "yaml" },
|
||||
dependancies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("telescope").load_extension("yaml_schema")
|
||||
@@ -194,7 +209,13 @@ require("lazy").setup({
|
||||
if vim.fn.isdirectory(vim.fs.normalize('~/.local/share/nvim/mason/registries')) == 0 then vim.cmd('MasonUpdate'); end -- lazy.nvim build not working for this, only run on first init
|
||||
require('mason-lspconfig').setup{ automatic_installation = true }
|
||||
local lsp = require('lspconfig')
|
||||
local cmp_caps = require('cmp_nvim_lsp').default_capabilities()
|
||||
local caps = function()
|
||||
local default_caps = vim.lsp.protocol.make_client_capabilities()
|
||||
default_caps.textDocument.completion = require('cmp_nvim_lsp').default_capabilities()['textDocument'].completion --- nvim-cmp completion
|
||||
--local default_caps = require('cmp_nvim_lsp').default_capabilities() --- nvim-cmp completion
|
||||
default_caps.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true } --- nvim-ufo folding
|
||||
return default_caps
|
||||
end
|
||||
-- lazy load Kubernetes.nvim
|
||||
local kubernetes_nvim_load = function()
|
||||
if vim.bo.filetype == "yaml" then return require('kubernetes').yamlls_schema(); else return ""; end
|
||||
@@ -219,6 +240,12 @@ require("lazy").setup({
|
||||
fileMatch = 'hr.yaml',
|
||||
url = "https://flux.jank.ing/helmrelease-helm-v2beta2.json",
|
||||
},
|
||||
--{ -- TODO: this seems to do nothing...? not sure how the MachineConfig schema is supposed to look like, but it doesn't look right?
|
||||
-- name = 'Talos Linux MachineConfig',
|
||||
-- fileMatch = '{*/clusterconfig/,/tmp/MachineConfigs.config.talos.dev-v1alpha1}*.yaml',
|
||||
-- url = "https://www.talos.dev/v1.7/schemas/v1alpha1_config.schema.json",
|
||||
-- --url = "https://raw.githubusercontent.com/siderolabs/talos/main/website/content/v1.7/schemas/config.schema.json",
|
||||
--},
|
||||
}
|
||||
local schemaStoreCatalog = {
|
||||
-- select subset from the JSON schema catalog
|
||||
@@ -258,7 +285,7 @@ require("lazy").setup({
|
||||
end
|
||||
--- LSP servers config
|
||||
local yamlls_config = {
|
||||
capabilities = cmp_caps,
|
||||
capabilities = caps(),
|
||||
settings = {
|
||||
redhat = { telemetry = { enabled = false } },
|
||||
yaml = {
|
||||
@@ -281,10 +308,11 @@ require("lazy").setup({
|
||||
-- Run LSP server setup
|
||||
-- IMPORTANT: if the return of the args passed to setup has a parent {}, use `setup(arg)` where `arg = {...}` so the result is `setup{...}`, rather than `setup{arg}` which becomes `setup{{...}}`
|
||||
if vim.bo.filetype == "yaml" then lsp.yamlls.setup( require("yaml-companion").setup { builtin_matchers = { kubernetes = { enabled = true }, }, lspconfig = yamlls_config, schemas = yamlCompanionSchemas() } ); end
|
||||
lsp.taplo.setup { settings = { evenBetterToml = { schema = { associations = {
|
||||
lsp.taplo.setup { capabilities = caps(), settings = { evenBetterToml = { schema = { associations = {
|
||||
['^\\.mise\\.toml$'] = 'https://mise.jdx.dev/schema/mise.json',
|
||||
}}}}}
|
||||
if vim.bo.filetype == "json" then lsp.jsonls.setup {
|
||||
capabilities = caps(),
|
||||
settings = {
|
||||
json = {
|
||||
validate = { enable = true },
|
||||
@@ -297,14 +325,19 @@ require("lazy").setup({
|
||||
}
|
||||
}
|
||||
}; end
|
||||
lsp.helm_ls.setup{}
|
||||
lsp.lua_ls.setup{}
|
||||
lsp.dockerls.setup{}
|
||||
lsp.gopls.setup{}
|
||||
lsp.tsserver.setup{}
|
||||
lsp.pyright.setup{}
|
||||
lsp.helm_ls.setup{capabilities = caps(),}
|
||||
lsp.lua_ls.setup{capabilities = caps(),}
|
||||
lsp.dockerls.setup{capabilities = caps(),}
|
||||
if vim.fn.executable('go') == 1 then lsp.gopls.setup{capabilities = caps(),} end
|
||||
lsp.tsserver.setup{capabilities = caps(),}
|
||||
lsp.pyright.setup{capabilities = caps(),}
|
||||
end
|
||||
},
|
||||
-- Org
|
||||
{ 'nvim-orgmode/orgmode', ft = { 'org' }, opts = {
|
||||
org_agenda_files = '~/orgfiles/**/*',
|
||||
org_default_notes_file = '~/orgfiles/refile.org',
|
||||
}},
|
||||
},
|
||||
checker = { enabled = true, notify = false },
|
||||
-- default to latest stable semver
|
||||
@@ -315,3 +348,9 @@ require("lazy").setup({
|
||||
vim.g.rainbow_delimiters = {}
|
||||
-- use nvim-notify for notifications
|
||||
vim.notify = require("notify")
|
||||
-- nvim-ufo
|
||||
vim.o.foldmethod = "manual" -- override vimrc value as that is meant for pluginless
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
|
||||
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
"cmp-async-path": { "branch": "main", "commit": "9d581eec5acf812316913565c135b0d1ee2c9a71" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-bufname": { "branch": "main", "commit": "e6ea451b13ff0942232bad19ea6f2bd8929aa86c" },
|
||||
"cmp-commit": { "branch": "main", "commit": "5f7d19957012ba114da59f06c7e6a3adafb1751d" },
|
||||
"cmp-conventionalcommits": { "branch": "master", "commit": "a4dfacf0601130b7f8afa7c948d735c27802fb7f" },
|
||||
"cmp-fish": { "branch": "main", "commit": "3a23492e2aead05522a9887ec685d70e8c987323" },
|
||||
"cmp-git": { "branch": "main", "commit": "50d526dff0f6bc441b51fc269d9fdc99a50c76af" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
@@ -10,7 +13,7 @@
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" },
|
||||
"indent-rainbowline.nvim": { "branch": "master", "commit": "4977a9735583f13d5c1114f373342745dd35b3b4" },
|
||||
"kubernetes.nvim": { "branch": "main", "commit": "101e63f8f92b2ae9cf6a78560bc2b2321d1264af" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
@@ -19,7 +22,10 @@
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "3ad562700d0615818bf358268ac8914f6ce2b079" },
|
||||
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "64cc1ef764a0b137a642d05cacdfe1126124fb35" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "b23a46aa06f5f653d107efbc67fd2aa3877ac344" },
|
||||
"orgmode": { "branch": "master", "commit": "c6bdb070a97daab5e405ab7ba2fe35c5bb61c838" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
|
||||
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "bb48714623a4fae73c42e4b318b4587464111769" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "6d3ba6ad250538446b2727e352e15a425d6692ef" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" },
|
||||
|
||||
20
dots/vimrc
20
dots/vimrc
@@ -12,10 +12,10 @@
|
||||
" nocompatible, placed first so all others below follow this
|
||||
set nocompatible
|
||||
|
||||
" Prepend mise shims to PATH
|
||||
if has('mac') || has('unix')
|
||||
let $PATH = $HOME . '/.local/share/mise/shims:' . $PATH
|
||||
endif
|
||||
" Prepend mise shims to PATH # TODO: disabled due to `gopls` failing to install
|
||||
"if has('mac') || has('unix')
|
||||
" let $PATH = $HOME . '/.local/share/mise/shims:' . $PATH
|
||||
"endif
|
||||
|
||||
" set vim tmp files (https://stackoverflow.com/a/61585014)
|
||||
if has('win32')
|
||||
@@ -163,8 +163,16 @@ if has("gui_macvim")
|
||||
autocmd GUIEnter * set vb t_vb=
|
||||
endif
|
||||
|
||||
" " Add a bit extra margin to the left
|
||||
" set foldcolumn=1
|
||||
" folding/collapse
|
||||
set foldenable
|
||||
set foldcolumn=1 " minimum column width
|
||||
nnoremap <Tab> za
|
||||
augroup remember_folds
|
||||
autocmd!
|
||||
autocmd BufWinLeave *.* mkview
|
||||
autocmd BufWinEnter *.* silent! loadview
|
||||
autocmd BufWinEnter *.* set viewoptions-=curdir
|
||||
augroup END
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
Reference in New Issue
Block a user