commit 580986ce5bedd41c3c6259bceb8055ca2a2882e2 Author: Tymur Arsentiev Date: Tue Oct 6 17:47:38 2026 -0400 nvim config diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..a27332e --- /dev/null +++ b/init.lua @@ -0,0 +1,28 @@ +require("config.lazy") + +vim.filetype.add({ + extension = { + zsh = "zsh", + }, + filename = { + [".zshrc"] = "zsh", + [".zprofile"] = "zsh", + ["zshrc"] = "zsh", + }, +}) + +-- 1. Add custom filetype detection for Helm templates +vim.filetype.add({ + pattern = { + -- Match any YAML or TPL file inside a 'templates' directory + ['.*/templates/.*%.ya?ml'] = 'helm', + ['.*/templates/.*%.tpl'] = 'helm', + ['Chart%.ya?ml'] = 'helm', + ['values%.ya?ml'] = 'helm', + }, +}) + +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.undofile = true diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..d75031f --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,22 @@ +{ + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "gitsigns.nvim": { "branch": "main", "commit": "851a051e2bd2caba97e23314c68d69f1b1cf5d19" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lspkind.nvim": { "branch": "master", "commit": "c7274c48137396526b59d86232eabcdc7fed8a32" }, + "lspsaga.nvim": { "branch": "main", "commit": "cf6fc9473bba1d332eda9887855ea29ed9b37701" }, + "lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" }, + "nvim-cmp": { "branch": "main", "commit": "2ffe79f1f021def8dd1fcd81deb16f1bb0d989f3" }, + "nvim-lspconfig": { "branch": "master", "commit": "056f569f71e4b726323b799b9cfacc53653bceb3" }, + "nvim-tree.lua": { "branch": "master", "commit": "478c69c0fe253caea88de9c5e138bfa77395a59a" }, + "nvim-treesitter": { "branch": "main", "commit": "e289100ff98969e118c702199d88b764ce9e7fdf" }, + "nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" }, + "nvim-web-devicons": { "branch": "master", "commit": "58447c1fca354bbf184425e4a8d01deecbd6f3c4" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, + "seeker.nvim": { "branch": "main", "commit": "5aa8e1174b11418a1270631b02c4f42ff9620425" }, + "snacks.nvim": { "branch": "main", "commit": "882c996cf28183f4d63640de0b4c02ec886d01f2" }, + "vim-polyglot": { "branch": "master", "commit": "f061eddb7cdcc614c8406847b2bfb53099832a4e" }, + "vimtex": { "branch": "master", "commit": "bbfa1501287b65e8803d5cc1007db2c2351c4453" } +} diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..f5ee74c --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua new file mode 100644 index 0000000..73c5e3f --- /dev/null +++ b/lua/plugins/cmp.lua @@ -0,0 +1,61 @@ +return { + "hrsh7th/nvim-cmp", + version = false, -- last release is way too old + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "onsails/lspkind.nvim" + }, + config = function() + local cmp = require("cmp") + local lspkind = require("lspkind") + cmp.setup({ + sources = { + { name = "nvim_lsp" } + }, + formatting = { + fields = { 'abbr', 'icon', 'kind', 'menu' }, + format = lspkind.cmp_format({ + maxwidth = { + -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + -- can also be a function to dynamically calculate max width such as + -- menu = function() return math.floor(0.45 * vim.o.columns) end, + menu = 50, -- leading text (labelDetails) + abbr = 50, -- actual suggestion item + }, + ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) + show_labelDetails = true, -- show labelDetails in menu. Disabled by default + + -- The function below will be called before any actual modifications from lspkind + -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) + before = function (entry, vim_item) + return vim_item + end + }) + }, + mapping = cmp.mapping.preset.insert({ + -- Navigate between completion items + [''] = cmp.mapping.select_prev_item({behavior = 'select'}), + [''] = cmp.mapping.select_next_item({behavior = 'select'}), + + -- `Enter` key to confirm completion + [''] = cmp.mapping.confirm({select = false}), + + -- Ctrl+Space to trigger completion menu + [''] = cmp.mapping.complete(), + + -- Scroll up and down in the completion documentation + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + }), + snippet = { + expand = function(args) + vim.snippet.expand(args.body) + end, + } + }) + end, + main = "lazyvim.util.cmp", +} diff --git a/lua/plugins/core.lua b/lua/plugins/core.lua new file mode 100644 index 0000000..18e977f --- /dev/null +++ b/lua/plugins/core.lua @@ -0,0 +1,4 @@ +return { + { "folke/lazy.nvim", version = false }, +-- { "LazyVim/LazyVim", version = false }, +} diff --git a/lua/plugins/diffview.lua b/lua/plugins/diffview.lua new file mode 100644 index 0000000..ca2a6a0 --- /dev/null +++ b/lua/plugins/diffview.lua @@ -0,0 +1,10 @@ +return { + "sindrets/diffview.nvim", + dependencies = { + "nvim-web-devicons" + }, + options = { + enhanced_diff_hl = true, + + } +} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..f0703a6 --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,14 @@ +return { + "lewis6991/gitsigns.nvim", + config = function() + require('gitsigns').setup({ + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }) + end +} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..5d978b3 --- /dev/null +++ b/lua/plugins/lspconfig.lua @@ -0,0 +1,149 @@ +return { + "neovim/nvim-lspconfig", + opts = { + servers = { + } + }, + config = function() + local lspconfig = require('lspconfig') + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + + lspconfig.texlab.setup({ + capabilities = capabilities, + settings = { + texlab = { + build = { + executable = 'latexmk', + args = { '-pdf', '-interaction=nonstopmode', '-synctex=1', '%f' }, + onSave = true, + }, + chktex = { onOpenAndSave = true }, -- Enables linting + } + } + }) + lspconfig.rust_analyzer.setup({ + capabilities = capabilities, + settings = { + ['rust-analyzer'] = { + diagnostics = { + enable = true, + }, + imports = { + granularity = { + group = "module", + }, + prefix = "self", + }, + cargo = { + buildScripts = { + enable = true, + }, + }, + procMacro = { + enable = true, + }, + }, + }, + }) + lspconfig.lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + runtime = { version = 'LuaJIT' }, + workspace = { + checkThirdParty = false, + library = { vim.env.VIMRUNTIME }, + }, + }, + }, + }) + lspconfig.cssls.setup({ + capabilities = capabilities, + settings = { + scss = { + validate = true + }, + css = { + validate = true + } + } + }) + lspconfig.somesass_ls.setup({ + capabilities = capabilities, + filetypes = { "sass", "scss" } + }) + lspconfig.yamlls.setup({ + capabilities = capabilities, + filetypes = { "yaml", "yaml.docker-compose", "yaml.gitlab" }, + settings = { + yaml = { + validate = true, + hover = true, + completion = true, + format = { + enable = true + }, + schemaStore = { + enable = true, + url = "https://schemastore.org", + }, + schemas = { + ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*", + ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}", + ["http://json.schemastore.org/prettierrc"] = ".prettierrc.{yml,yaml}", + ["http://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}", + kubernetes = "*.yaml" + }, + }, + } + }) + lspconfig.ts_ls.setup({ + capabilities = capabilities, + init_options = { + plugins = { + { + name = "@vue/typescript-plugin", + location = "/usr/local/lib/node_modules/@vue/typescript-plugin", + languages = {"javascript", "typescript", "vue"}, + }, + }, + + } + }) + lspconfig.bashls.setup({ + capabilities = capabilities, + filetypes = { "sh", "bash", "zsh" }, + settings = { + bashIde = { + globPattern = "**/*@(.sh|.inc|.bash|.command|.zsh|zshrc|.zshrc|zsh_*|.zsh_*)" + } + }, + single_file_support = true + }) + lspconfig.jsonls.setup({ + capabilities = capabilities + }) +-- lspconfig.helm_ls.setup({ +-- capabilities = capabilities, +-- filetypes = { "helm" }, +-- settings = { +-- ['helm_ls'] = { +-- yamlls = { +-- enabled = true, +-- path = "yaml-language-server", +-- enabledForFilesGlob = "*.{yaml,yml}", +-- config = { +-- schemas = { +-- kubernetes = "templates/**", +-- }, +-- completion = true, +-- hover = true, +-- }, +-- } +-- } +-- } +-- }) + end, + version = "~1.0.0" +} diff --git a/lua/plugins/lspsaga.lua b/lua/plugins/lspsaga.lua new file mode 100644 index 0000000..c1304e1 --- /dev/null +++ b/lua/plugins/lspsaga.lua @@ -0,0 +1,10 @@ +return { + 'nvimdev/lspsaga.nvim', + config = function() + require('lspsaga').setup({}) + end, + dependencies = { + 'nvim-treesitter/nvim-treesitter', + 'nvim-tree/nvim-web-devicons', + } +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..3c1da48 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,7 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup() + end +} diff --git a/lua/plugins/polyglot.lua b/lua/plugins/polyglot.lua new file mode 100644 index 0000000..03a061f --- /dev/null +++ b/lua/plugins/polyglot.lua @@ -0,0 +1 @@ +return { "sheerun/vim-polyglot" } diff --git a/lua/plugins/seeker.lua b/lua/plugins/seeker.lua new file mode 100644 index 0000000..95478bd --- /dev/null +++ b/lua/plugins/seeker.lua @@ -0,0 +1,22 @@ +return { + '2kabhishek/seeker.nvim', + dependencies = { 'folke/snacks.nvim' }, + cmd = { 'Seeker' }, + keys = { + { 'fa', ':Seeker files', desc = 'Seek Files' }, + { 'ff', ':Seeker git_files', desc = 'Seek Git Files' }, + { 'fg', ':Seeker grep', desc = 'Seek Grep' }, + { 'fw', ':Seeker grep_word', mode = { 'n', 'x' }, desc = 'Seek Grep Word' }, + }, + opts = { + picker_provider = "snacks", + -- toggle_key = "", -- Key to toggle between seeker modes (default) + picker_opts = { + focus = "list", -- Customize options passed to the snacks picker + -- toggle_key = "", -- Key to toggle between seeker modes (default) + picker_opts = { + focus = "list", -- Customize options passed to the snacks picker + }, + }, + } +} diff --git a/lua/plugins/tree.lua b/lua/plugins/tree.lua new file mode 100644 index 0000000..bdfeece --- /dev/null +++ b/lua/plugins/tree.lua @@ -0,0 +1,27 @@ +return { + "nvim-tree/nvim-tree.lua", + dependencies = { + "nvim-tree/nvim-web-devicons" + }, + config = function() + local config = { + hijack_cursor = true, + sort = { + sorter = "modification_time", + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = false, + }, + filesystem_watchers = { + enable = true + } + } + require("nvim-tree").setup(config) + end +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..457a542 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,5 @@ +return { + 'nvim-treesitter/nvim-treesitter', + lazy = false, + build = ':TSUpdate' +} diff --git a/lua/plugins/ufo.lua b/lua/plugins/ufo.lua new file mode 100644 index 0000000..7c4a9a9 --- /dev/null +++ b/lua/plugins/ufo.lua @@ -0,0 +1,34 @@ +return { + "kevinhwang91/nvim-ufo", + version = false, -- last release is way too old + dependencies = { + "kevinhwang91/promise-async", + }, + config = function() + vim.o.foldcolumn = '1' -- '0' is not bad + vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + + -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself + vim.keymap.set('n', 'zR', require('ufo').openAllFolds) + vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) + + -- Option 2: nvim lsp as LSP client + -- Tell the server the capability of foldingRange, + -- Neovim hasn't added foldingRange to default capabilities, users must add it manually + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true + } + local language_servers = vim.lsp.get_clients() -- or list servers manually like {'gopls', 'clangd'} + for _, ls in ipairs(language_servers) do + require('lspconfig')[ls].setup({ + capabilities = capabilities + -- you can add other fields for setting up lsp server in this table + }) + end + require('ufo').setup() + end +} diff --git a/lua/plugins/vimtex.lua b/lua/plugins/vimtex.lua new file mode 100644 index 0000000..c982211 --- /dev/null +++ b/lua/plugins/vimtex.lua @@ -0,0 +1,16 @@ +return { + "lervag/vimtex", + lazy = false, -- we don't want to lazy load VimTeX + -- tag = "v2.15", -- uncomment to pin to a specific release + init = function() + -- VimTeX configuration goes here, e.g. + vim.g.vimtex_compiler_latexmk = { + options = { + '-pdf', + '-synctex=1', + '-interaction=nonstopmode', + }, + } + vim.g.vimtex_view_method = 'zathura' + end +}