commit 210e99d004dd4bdec6204c6c0682d7db5076d66b Author: Valeriy Filippov Date: Thu Mar 5 16:34:38 2026 +0300 Add neovim config diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..057d8ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +nvim/lazy-lock.json +nvim/lazyvim.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..b26c493 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Файлы необходимо распологать в директории `~/.config` diff --git a/nvim/Requirements.md b/nvim/Requirements.md new file mode 100644 index 0000000..248e611 --- /dev/null +++ b/nvim/Requirements.md @@ -0,0 +1,44 @@ +### NB + +Мой предпочитаемый вариант установки [brew](https://brew.sh/), но так же можно найти репозитории необходимых зависимостей и учтановить их другими методами. + +### Установка neovim + +```bash +# https://github.com/neovim/neovim +brew install neovim +``` + +### Установка зависимостей + +```bash +# https://github.com/junegunn/fzf +brew install fzf + +# https://github.com/alesbrelih/gitlab-ci-ls +brew install alesbrelih/gitlab-ci-ls/gitlab-ci-ls + +# https://github.com/golang/go +brew install go + +# https://github.com/jesseduffield/lazygit +brew install lazygit + +# https://github.com/LuaLS/lua-language-server +brew install lua-language-server + +# https://github.com/getsops/sops +brew onstall sops + +# https://github.com/hashicorp/terraform-ls +brew install terraform-ls + +# https://tree-sitter.github.io/ +brew install tree-sitter + +# https://github.com/redhat-developer/yaml-language-server +brew install yaml-language-server + +# https://github.com/ryanoasis/nerd-fonts +brew install --cask font-jetbrains-mono-nerd-font +``` diff --git a/nvim/filetype.lua b/nvim/filetype.lua new file mode 100644 index 0000000..6bd5d61 --- /dev/null +++ b/nvim/filetype.lua @@ -0,0 +1,16 @@ +-- Gitlab CI LSP +vim.filetype.add({ + pattern = { + ['%.gitlab%-ci%.ya?ml'] = 'yaml.gitlab', + }, +}) + +-- Terraform LSP +vim.filetype.add({ + filename = { + ['variables.tf'] = 'terraform.vars' + }, + pattern = { + ['.*%.tfvars'] = 'terraform.vars' + }, +}) diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..dbc863e --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1 @@ +require("config") diff --git a/nvim/lsp/gitlabcils.lua b/nvim/lsp/gitlabcils.lua new file mode 100644 index 0000000..8a5fb67 --- /dev/null +++ b/nvim/lsp/gitlabcils.lua @@ -0,0 +1,12 @@ +-- https://github.com/neovim/nvim-lspconfig/blob/master/lsp/gitlab_ci_ls.lua +local cache_dir = vim.uv.os_homedir() .. '/.cache/gitlab-ci-ls/' + +return { + cmd = { 'gitlab-ci-ls' }, + filetypes = { 'yaml.gitlab' }, + root_markers = { '.git', '.gitlab-ci.yml' }, + init_options = { + cache_path = cache_dir, + log_path = cache_dir .. '/log/gitlab-ci-ls.log', + }, +} diff --git a/nvim/lsp/luals.lua b/nvim/lsp/luals.lua new file mode 100644 index 0000000..94d7f20 --- /dev/null +++ b/nvim/lsp/luals.lua @@ -0,0 +1,28 @@ +-- https://github.com/neovim/nvim-lspconfig/blob/master/lsp/lua_ls.lua +return { + cmd = { + "lua-language-server", + }, + filetypes = { + "lua", + }, + root_markers = { + ".git", + ".luacheckrc", + ".luarc.json", + ".luarc.jsonc", + ".stylua.toml", + "selene.toml", + "selene.yml", + "stylua.toml", + }, + settings = { + Lua = { + workspace = { + library = vim.api.nvim_get_runtime_file("", true) + } + } + }, + single_file_support = true, + log_level = vim.lsp.protocol.MessageType.Warning, +} diff --git a/nvim/lsp/terraformls.lua b/nvim/lsp/terraformls.lua new file mode 100644 index 0000000..510665b --- /dev/null +++ b/nvim/lsp/terraformls.lua @@ -0,0 +1,6 @@ +-- https://github.com/neovim/nvim-lspconfig/blob/master/lsp/terraformls.lua +return { + cmd = { 'terraform-ls', 'serve' }, + filetypes = { 'terraform', 'terraform.vars' }, + root_markers = { '.terraform', '.git' }, +} diff --git a/nvim/lsp/yamlls.lua b/nvim/lsp/yamlls.lua new file mode 100644 index 0000000..d0d0cd6 --- /dev/null +++ b/nvim/lsp/yamlls.lua @@ -0,0 +1,18 @@ +-- https://github.com/neovim/nvim-lspconfig/blob/master/lsp/yamlls.lua +return { + cmd = { "yaml-language-server", "--stdio" }, + filetypes = { "yaml", 'yaml.docker-compose', 'yaml.gitlab', 'yaml.helm-values' }, + root_markers = { ".git" }, + settings = { + redhat = { + telemetry = { + enabled = false + } + }, + yaml = { + format = { + enable = true + } + } + }, +} diff --git a/nvim/lua/config/init.lua b/nvim/lua/config/init.lua new file mode 100644 index 0000000..90d8054 --- /dev/null +++ b/nvim/lua/config/init.lua @@ -0,0 +1,5 @@ +require("config.options") +require("config.keymaps") +require("config.lazy") +require("config.lsp") + diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..bb9b422 --- /dev/null +++ b/nvim/lua/config/keymaps.lua @@ -0,0 +1,124 @@ +-- Setup leader key +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +local keymap = vim.keymap + +-- Vim modes: +-- n Normal mode map. Defined using ':nmap' or ':nnoremap'. +-- i Insert mode map. Defined using ':imap' or ':inoremap'. +-- v Visual and select mode map. Defined using ':vmap' or ':vnoremap'. +-- x Visual mode map. Defined using ':xmap' or ':xnoremap'. +-- s Select mode map. Defined using ':smap' or ':snoremap'. +-- c Command-line mode map. Defined using ':cmap' or ':cnoremap'. +-- o Operator pending mode map. Defined using ':omap' or ':onoremap'. + +-- Reserved firs characters: +-- +/- - numbers +-- c - [C]lear +-- d - [D]iagnostic +-- e - File [E]xplorer +-- f - [F]ind +-- g - [G]it +-- h - [H]istory +-- l - [L]SP +-- n - [N]otifications +-- p - [P]anes +-- s - [S]ession +-- t - [T]abs +-- u - [U]i + +-- [C]lear highlits +keymap.set("n", "ch", ":nohl", { desc = "[C]lear: serch [h]ighlights" }) + +-- [D]iagnostic +keymap.set("n", "dl", vim.diagnostic.open_float, { desc = "[D]iagnostic: [l]ine" }) +keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Hover Documentation" }) +keymap.set({ "n", "v" }, "da", vim.lsp.buf.code_action, { desc = "[D]iagnostic: avalible code [a]ctions" }) +-- nvim-telescope/telescope.nvim +keymap.set("n", "db", "Telescope diagnostics bufnr=0", { desc = "[D]iagnostic: [b]uffer" }) +-- folke/trouble.nvim +keymap.set("n", "dw", "Trouble diagnostics toggle", { desc = "[D]iagnostic: Trouble [w]orkspace" }) +keymap.set("n", "dc", "Trouble diagnostics toggle filter.buf=0", { desc = "[D]iagnostic: Trouble do[c]ument" }) +keymap.set("n", "dq", "Trouble quickfix toggle", { desc = "[D]iagnostic: Trouble [q]uickfix" }) + +-- File [E]xplorer +-- nvim-tree/nvim-tree.lua +keymap.set("n", "ee", "NvimTreeToggle", { desc = "File [E]xplorer: Toggle file [e]xplorer" }) +keymap.set("n", "ef", "NvimTreeFindFileToggle", { desc = "File [E]xplorer: Toggle file explorer on current [f]ile" }) +keymap.set("n", "ec", "NvimTreeCollapse", { desc = "File [E]xplorer: [C]ollapse" }) +keymap.set("n", "er", "NvimTreeRefresh", { desc = "File [E]xplorer: [R]efresh" }) + +-- [F]ind +-- nvim-telescope/telescope.nvim +keymap.set("n", "ff", "Telescope find_files", { desc = "[F]ind: [f]iles in cwd" }) +keymap.set("n", "fr", "Telescope oldfiles", { desc = "[F]ind: [r]ecent files" }) +keymap.set("n", "fs", "Telescope live_grep", { desc = "[F]ind: string in cwd" }) +keymap.set("n", "fc", "Telescope grep_string", { desc = "[F]ind: string under [c]ursor in cwd" }) +-- folke/todo-comments.nvim +keymap.set("n", "ft", "TodoTelescope", { desc = "[F]ind: [t]odos" }) +-- folke/snacks.nvim +keymap.set("n", "fq", function() Snacks.picker.qflist() end, { desc = "[F]ind: [Q]uickfix list" }) + +-- [G]it +-- lewis6991/gitsigns.nvim +keymap.set("n", "gs", "Gitsigns stage_buffer", { desc = "[G]it: [s]tage buffer" }) +keymap.set("n", "gr", "Gitsigns reset_buffer", { desc = "[G]it: [r]eset buffer" }) +keymap.set("n", "gb", "Gitsigns blame_line", { desc = "[G]it: [b]lame line" }) +keymap.set("n", "gd", "Gitsigns diffthis", { desc = "[G]it: [d]iff this" }) +keymap.set("n", "ghn", "Gitsigns nav_hunk next", { desc = "[G]it [H]unk: [n]ext" }) +keymap.set("n", "ghp", "Gitsigns nav_hunk prev", { desc = "[G]it [H]unk: [p]revious" }) +keymap.set("n", "ghs", "Gitsigns stage_hunk", { desc = "[G]it [H]unk: [s]tage" }) +keymap.set("n", "ghr", "Gitsigns reset_hunk", { desc = "[G]it [H]unk: [r]eset" }) +keymap.set("n", "ghv", "Gitsigns preview_hunk", { desc = "[G]it [H]unk: pre[v]iew" }) +keymap.set("v", "ghs", function() require("gitsigns").stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, { desc = "[G]it [H]unk: [s]tage" }) +keymap.set("v", "ghr", function() require("gitsigns").reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, { desc = "[G]it [H]unk: [r]eset" }) +keymap.set({ "o", "x" }, "gh", "Gitsigns select_hunk", { desc = "[G]it [H]unk: select" }) + +-- [H]istory +-- folke/snacks.nvim +keymap.set("n", "hn", function() Snacks.picker.notifications() end, { desc = "[H]istory: [N]otifications" } ) +keymap.set("n", "hc", function() Snacks.picker.command_history() end, { desc = "[H]istory: [C]ommands" } ) + +-- [L]SP +-- folke/snacks.nvim +keymap.set("n", "lf", function() Snacks.picker.lsp_definitions() end, { desc = "[L]SP: Goto De[f]initions" }) +keymap.set("n", "lc", function() Snacks.picker.lsp_declarations() end, { desc = "[L]SP: Goto De[c]larations" }) +keymap.set("n", "le", function() Snacks.picker.lsp_references() end, { desc = "[L]SP: Goto R[e]ferences" }) +keymap.set("n", "li", function() Snacks.picker.lsp_implementations() end, { desc = "[L]SP: Goto [I]mplementations" }) +keymap.set("n", "ly", function() Snacks.picker.lsp_type_definitions() end, { desc = "[L]SP: Goto T[y]pe Definitions" }) + +-- [P]anes +keymap.set("n", "pv", "v", { desc = "[P]ane: split [v]ertically" }) +keymap.set("n", "ph", "s", { desc = "[P]ane: split [h]orizontally" }) +keymap.set("n", "pe", "=", { desc = "[P]ane: Make splits [e]qual size" }) +keymap.set("n", "pc", "close", { desc = "[P]ane: [C]lose current split" }) +-- szw/vim-maximizer +keymap.set("n", "pm", "MaximizerToggle", { desc = "[P]ane: [M]aximize/minimize current split" }) + +-- [S]ession +-- rmagatti/auto-session +keymap.set("n", "sr", "AutoSession restore", { desc = "[S]ession: [R]estore" }) +keymap.set("n", "ss", "AutoSession save", { desc = "[S]ession: [S]ave" }) +keymap.set("n", "sf", "AutoSession search", { desc = "[S]ession: [F]ind" }) +keymap.set("n", "sd", "AutoSession deletePicker", { desc = "[S]ession: [D]elete" }) + +-- [T]abs +keymap.set("n", "to", "tabnew", { desc = "[T]ab: Open new" }) +keymap.set("n", "tc", "tabclose", { desc = "[T]ab: [C]lose current" }) +keymap.set("n", "tn", "tabn", { desc = "[T]ab: Go to [n]ext" }) +keymap.set("n", "tp", "tabp", { desc = "[T]ab: Go to [p]revious" }) +keymap.set("n", "tb", "tabnew %", { desc = "[T]ab: Open current buffer in new tab" }) + +-- [U]I +-- folke/snacks.nvim +keymap.set("n", "ug", function() Snacks.lazygit() end, { desc = "[U]I: Open [L]azyGit" }) +keymap.set("n", "ud", function() Snacks.dashboard() end, { desc = "[U]I: Open [D]ashboard" }) +-- folke/lazy.nvim +keymap.set("n", "ul", "Lazy", { desc = "[U]I: Open [L]azyVim" }) + +-- Misc +-- VonHeikemen/fine-cmdline.nvim +keymap.set("n", ":", "FineCmdline", { desc = "Fine Command Line" }) +-- folke/which-key.nvim +keymap.set("n", "?", function() require("which-key").show({ global = false }) end, { desc = "Buffer Local Keymaps (which-key)" }) diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..c9743d0 --- /dev/null +++ b/nvim/lua/config/lazy.lua @@ -0,0 +1,29 @@ +-- https://githup.com/folke/lazy.nvim +-- 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) + +-- Setup lazy.nvim +require("lazy").setup("plugins", { + checker = { + enabled = true, + notify = false, + }, + change_detection = { + notify = false, + }, +}) + diff --git a/nvim/lua/config/lsp.lua b/nvim/lua/config/lsp.lua new file mode 100644 index 0000000..9be8673 --- /dev/null +++ b/nvim/lua/config/lsp.lua @@ -0,0 +1,30 @@ +vim.lsp.enable({ + "gitlabcils", + "luals", + "terraformls", + "yamlls" +}) + +vim.diagnostic.config({ + virtual_lines = true, + -- virtual_text = true, + underline = true, + update_in_insert = false, + severity_sort = true, + float = { + border = "rounded", + source = true, + }, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "󰅚 ", + [vim.diagnostic.severity.WARN] = "󰀪 ", + [vim.diagnostic.severity.INFO] = "󰋽 ", + [vim.diagnostic.severity.HINT] = "󰌶 ", + }, + numhl = { + [vim.diagnostic.severity.ERROR] = "ErrorMsg", + [vim.diagnostic.severity.WARN] = "WarningMsg", + }, + }, +}) diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua new file mode 100644 index 0000000..de9c1d3 --- /dev/null +++ b/nvim/lua/config/options.lua @@ -0,0 +1,47 @@ +-- Explorer tree style +vim.cmd("let g:netrw_liststyle = 3") + +-- Theme + +local opt = vim.opt + +-- Show string numbers relative to cursor position +opt.relativenumber = true +-- Show string numper of cursor position +opt.number = true + +-- tabs & idents +opt.tabstop = 2 -- 2 spaces for tab +opt.shiftwidth = 2 -- 2 spaces for ident +opt.expandtab = true -- expand tab to spaces +opt.autoindent = true -- save indent when start new line + +-- Wrap long strings to fit screen size +opt.wrap = true + +-- search +opt.ignorecase = true -- ignore case +opt.smartcase = true -- case-sensitive when mixed case in search + +-- highlite line with cursor +-- opt.cursorline = true + +-- turn on terminal colors +opt.termguicolors = true +opt.background = "dark" +opt.signcolumn = "yes" + +-- backspace +opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position + +-- clipboard +opt.clipboard:append("unnamedplus") -- use system clipboard as default register + +-- split windows +opt.splitright = true -- split vertical window to the right +opt.splitbelow = true -- split horizontal window to the bottom + +-- turn off swapfile +opt.swapfile = false + +-- opt.messagesopt = "wait:10000,history:50" diff --git a/nvim/lua/plugins/auto-session.lua b/nvim/lua/plugins/auto-session.lua new file mode 100644 index 0000000..2cd4dc4 --- /dev/null +++ b/nvim/lua/plugins/auto-session.lua @@ -0,0 +1,12 @@ +-- https://github.com/rmagatti/auto-session +return { + "rmagatti/auto-session", + config = function() + local auto_session = require("auto-session") + + auto_session.setup({ + auto_restore_enabled = false, + auto_session_suppress_dirs = { "~/", "~/Downloads", "~/Documents", "~/Desktop/" }, + }) + end, +} diff --git a/nvim/lua/plugins/autopairs.lua b/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..1c12c99 --- /dev/null +++ b/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,31 @@ +-- https://github.com/windwp/nvim-autopairs +return { + "windwp/nvim-autopairs", + event = { "InsertEnter" }, + dependencies = { + "hrsh7th/nvim-cmp", + }, + config = function() + -- import nvim-autopairs + local autopairs = require("nvim-autopairs") + + -- configure autopairs + autopairs.setup({ + check_ts = true, -- enable treesitter + ts_config = { + lua = { "string" }, -- don't add pairs in lua string treesitter nodes + javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes + java = false, -- don't check treesitter on java + }, + }) + + -- import nvim-autopairs completion functionality + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + + -- import nvim-cmp plugin (completions plugin) + local cmp = require("cmp") + + -- make autopairs and completion work together + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end, +} diff --git a/nvim/lua/plugins/blink.lua b/nvim/lua/plugins/blink.lua new file mode 100644 index 0000000..086d6cd --- /dev/null +++ b/nvim/lua/plugins/blink.lua @@ -0,0 +1,53 @@ +return { + 'saghen/blink.cmp', + -- optional: provides snippets for the snippet source + dependencies = { 'rafamadriz/friendly-snippets' }, + + -- use a release tag to download pre-built binaries + version = '1.*', + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = 'default' }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono' + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = true } }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" } + }, + opts_extend = { "sources.default" } +} diff --git a/nvim/lua/plugins/bufferline.lua b/nvim/lua/plugins/bufferline.lua new file mode 100644 index 0000000..c32e8b8 --- /dev/null +++ b/nvim/lua/plugins/bufferline.lua @@ -0,0 +1,12 @@ +-- https://github.com/akinsho/bufferline.nvim +return { + "akinsho/bufferline.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + version = "*", + opts = { + options = { + mode = "tabs", + separator_style = "slant", + }, + }, +} diff --git a/nvim/lua/plugins/catpuccin.lua b/nvim/lua/plugins/catpuccin.lua new file mode 100644 index 0000000..0c8f84d --- /dev/null +++ b/nvim/lua/plugins/catpuccin.lua @@ -0,0 +1,14 @@ +-- https://github.com/catppuccin/nvim +-- Catpuccin theme for nvim +return { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + config = function() + require("catppuccin").setup({ + flavour = "mocha", + auto_integrations = true, + }) + vim.cmd.colorscheme "catppuccin" + end +} diff --git a/nvim/lua/plugins/comment.lua b/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..9d8ee61 --- /dev/null +++ b/nvim/lua/plugins/comment.lua @@ -0,0 +1,20 @@ +-- https://github.com/numToStr/Comment.nvim +return { + "numToStr/Comment.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + }, + config = function() + -- import comment plugin safely + local comment = require("Comment") + + local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") + + -- enable comment + comment.setup({ + -- for commenting tsx, jsx, svelte, html files + pre_hook = ts_context_commentstring.create_pre_hook(), + }) + end, +} diff --git a/nvim/lua/plugins/fine-cmdline.lua b/nvim/lua/plugins/fine-cmdline.lua new file mode 100644 index 0000000..db2f66b --- /dev/null +++ b/nvim/lua/plugins/fine-cmdline.lua @@ -0,0 +1,5 @@ +-- https://github.com/VonHeikemen/fine-cmdline.nvim +return { + "VonHeikemen/fine-cmdline.nvim", + dependencies = { "MunifTanjim/nui.nvim" }, +} diff --git a/nvim/lua/plugins/gitlab.lua b/nvim/lua/plugins/gitlab.lua new file mode 100644 index 0000000..dbc4586 --- /dev/null +++ b/nvim/lua/plugins/gitlab.lua @@ -0,0 +1,14 @@ +return { + "harrisoncramer/gitlab.nvim", + dependencies = { + "MunifTanjim/nui.nvim", + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + "stevearc/dressing.nvim", -- Recommended but not required. Better UI for pickers. + "nvim-tree/nvim-web-devicons", -- Recommended but not required. Icons in discussion tree. + }, + build = function () require("gitlab.server").build(true) end, -- Builds the Go binary + config = function() + require("gitlab").setup() + end, +} diff --git a/nvim/lua/plugins/gitsigns.lua b/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..1e97b89 --- /dev/null +++ b/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,10 @@ +-- https://github.com/lewis6991/gitsigns.nvim +return { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, +} diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..a885d95 --- /dev/null +++ b/nvim/lua/plugins/init.lua @@ -0,0 +1,4 @@ +return { + "nvim-lua/plenary.nvim", -- lua functions that many plugins use + "christoomey/vim-tmux-navigator", -- tmux & split window navigation +} diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..b274283 --- /dev/null +++ b/nvim/lua/plugins/lualine.lua @@ -0,0 +1,28 @@ +-- https://github.com/nvim-lualine/lualine.nvim +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local lualine = require("lualine") + local lazy_status = require("lazy.status") -- to configure lazy pending updates count + + -- configure lualine with modified theme + lualine.setup({ + options = { + theme = 'auto', + }, + sections = { + lualine_x = { + { + lazy_status.updates, + cond = lazy_status.has_updates, + color = { fg = "#ff9e64" }, + }, + { "encoding" }, + { "fileformat" }, + { "filetype" }, + }, + }, + }) + end, +} diff --git a/nvim/lua/plugins/nvim-tree.lua b/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..d7b9d7b --- /dev/null +++ b/nvim/lua/plugins/nvim-tree.lua @@ -0,0 +1,49 @@ +-- https://github.com/nvim-tree/nvim-tree.lua +return { + "nvim-tree/nvim-tree.lua", + dependencies = "nvim-tree/nvim-web-devicons", + config = function() + local nvimtree = require("nvim-tree") + + -- recommended settings from nvim-tree documentation + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + nvimtree.setup({ + view = { + width = 40, + relativenumber = false, + }, + -- change folder arrow icons + renderer = { + indent_markers = { + enable = true, + }, + icons = { + glyphs = { + folder = { + arrow_closed = "", -- arrow when folder is closed + arrow_open = "", -- arrow when folder is open + }, + }, + }, + }, + -- disable window_picker for + -- explorer to work well with + -- window splits + actions = { + open_file = { + window_picker = { + enable = false, + }, + }, + }, + filters = { + custom = { ".DS_Store" }, + }, + git = { + ignore = false, + }, + }) + end +} diff --git a/nvim/lua/plugins/snacks.lua b/nvim/lua/plugins/snacks.lua new file mode 100644 index 0000000..7831063 --- /dev/null +++ b/nvim/lua/plugins/snacks.lua @@ -0,0 +1,84 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + indent = { enabled = true }, + input = { enabled = true }, + git = { enabled = true }, + lazygit = { enabled = true }, + notifier = { enabled = true }, + picker = { enabled = true }, + dashboard = { + width = 80, + row = nil, -- dashboard position. nil for center + col = nil, -- dashboard position. nil for center + pane_gap = 20, -- empty columns between vertical panes + preset = { + header = [[ +" *++*- " +" -=+++++ " +" -=====++= " +" :======== " +" .======== " +" .-======= " +" .----====. :---. " +" -------. :===--- " +" :----. :======-- " +" :========. " +" =======. " +" ======++ " +" .+++++++* " +" .+++++** " +" .***** " +" " +" " +" " +" =. " +" -#%%=. :++++ :### .++++. " +" .#####% -#### %%. .*### " +" .:%##-:: .-==: :--: .::. %##- .:-==:. ###% :==. :==:. " +" *%###%%# *##%###%.####. +### .##% .%##%%###. %##=%####. :#######. " +" -### %##= .%#% ###. *### ###* .###. .### :###. -##% =##% .### " +" %##+ :######%= +##% %##- %##: %### #### +######%. ######%*. " +" .### :##% .. %##+ +### ###. %### .###: %##-.###. ###: - " +" *### =######@ :######: :###% .####%####.:##% ####= .%#####% " +" ###- " +" *####% " +" .:-:. "]], + keys = { + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { icon = " ", key = "e", desc = "File Explorer", action = ":NvimTreeToggle" }, + { icon = " ", key = "ff", desc = "Find File", action = ":Telescope find_files" }, + { icon = " ", key = "fs", desc = "Find String", action = ":Telescope live_grep" }, + { icon = " ", key = "s", desc = "Restore Session", action = ":AutoSession restore"}, + { icon = "󰒲 ", key = "L", desc = "Lazy UI", action = ":Lazy", enabled = package.loaded.lazy ~= nil }, + { icon = " ", key = "G", desc = "LazyGit", action = function() Snacks.lazygit() end}, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + }, + sections = { + { section = "header" }, + { + pane = 2, + icon = " ", + title = "Git Status", + section = "terminal", + enabled = function() + return Snacks.git.get_root() ~= nil + end, + cmd = "git status --short --branch --renames", + height = 5, + padding = 2, + ttl = 5 * 60, + indent = 3, + }, + { pane = 2, section = "keys", gap = 1, padding = 4 }, + { pane = 2, section = "startup" }, + }, + }, + }, +} diff --git a/nvim/lua/plugins/sops.lua b/nvim/lua/plugins/sops.lua new file mode 100644 index 0000000..72d437d --- /dev/null +++ b/nvim/lua/plugins/sops.lua @@ -0,0 +1,4 @@ +-- https://github.com/trixnz/sops.nvim +return { + "trixnz/sops.nvim", +} diff --git a/nvim/lua/plugins/substitude.lua b/nvim/lua/plugins/substitude.lua new file mode 100644 index 0000000..0db9bd1 --- /dev/null +++ b/nvim/lua/plugins/substitude.lua @@ -0,0 +1,10 @@ +-- https://github.com/gbprod/substitute.nvim +return { + -- "gbprod/substitute.nvim", + -- event = { "BufReadPre", "BufNewFile" }, + -- opts = { + -- -- your configuration comes here + -- -- or leave it empty to use the default settings + -- -- refer to the configuration section below + -- } +} diff --git a/nvim/lua/plugins/surround.lua b/nvim/lua/plugins/surround.lua new file mode 100644 index 0000000..fe43bf9 --- /dev/null +++ b/nvim/lua/plugins/surround.lua @@ -0,0 +1,7 @@ +-- https://github.com/kylechui/nvim-surround +return { + "kylechui/nvim-surround", + event = { "BufReadPre", "BufNewFile" }, + version = "*", -- Use for stability; omit to use `main` branch for the latest features + config = true, +} diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..ff7535d --- /dev/null +++ b/nvim/lua/plugins/telescope.lua @@ -0,0 +1,30 @@ +-- https://github.com/nvim-telescope/telescope.nvim +return { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + dependencies = { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + "nvim-tree/nvim-web-devicons", + "folke/todo-comments.nvim", + }, + config = function() + local telescope = require("telescope") + local actions = require("telescope.actions") + + telescope.setup({ + defaults = { + path_display = { "smart" }, + mappings = { + i = { + [""] = actions.move_selection_previous, -- move to prev result + [""] = actions.move_selection_next, -- move to next result + [""] = actions.send_selected_to_qflist, -- add to qflist + }, + }, + }, + }) + + telescope.load_extension("fzf") + end, +} diff --git a/nvim/lua/plugins/todo-comments.lua b/nvim/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..c1681c2 --- /dev/null +++ b/nvim/lua/plugins/todo-comments.lua @@ -0,0 +1,11 @@ +-- https://github.com/folke/todo-comments.nvim +return { + "folke/todo-comments.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..e45e2ad --- /dev/null +++ b/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,55 @@ +-- https://github.com/nvim-treesitter/nvim-treesitter +return { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + build = ":TSUpdate", + dependencies = { + "windwp/nvim-ts-autotag", + }, + config = function() + -- import nvim-treesitter plugin + local treesitter = require("nvim-treesitter.configs") + + -- configure treesitter + treesitter.setup({ -- enable syntax highlighting + highlight = { + enable = true, + }, + -- enable indentation + indent = { enable = true }, + -- enable autotagging (w/ nvim-ts-autotag plugin) + autotag = { + enable = true, + }, + -- ensure these language parsers are installed + ensure_installed = { + "bash", + "dockerfile", + "gitignore", + "jinja", + "jinja_inline", + "json", + "hcl", + "helm", + "lua", + "luadoc", + "luap", + "markdown", + "markdown_inline", + "nginx", + "vim", + "vimdoc", + "yaml", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + }) + end, +} diff --git a/nvim/lua/plugins/trouble.lua b/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..e284456 --- /dev/null +++ b/nvim/lua/plugins/trouble.lua @@ -0,0 +1,9 @@ +return { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim" }, + opts = { + focus = true, + auto_preview = false, + }, + cmd = "Trouble", +} diff --git a/nvim/lua/plugins/vim-maximizer.lua b/nvim/lua/plugins/vim-maximizer.lua new file mode 100644 index 0000000..1556383 --- /dev/null +++ b/nvim/lua/plugins/vim-maximizer.lua @@ -0,0 +1,5 @@ +-- https://github.com/szw/vim-maximizer +return { + "szw/vim-maximizer", + event = "VeryLazy", +} diff --git a/nvim/lua/plugins/which-key.lua b/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..00dec08 --- /dev/null +++ b/nvim/lua/plugins/which-key.lua @@ -0,0 +1,14 @@ +-- https://github.com/folke/which-key.nvim +return { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 500 + end, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } +}