From 977453fa053733ee08aaf9c18761252bb0b9d732 Mon Sep 17 00:00:00 2001 From: Bartek Stalewski Date: Sat, 28 Jun 2025 14:33:33 +0200 Subject: [PATCH] (neovim) switch to own configuration --- _saved/neovim/ftpd/init.lua | 175 ----------- _saved/{neovim/ftpd => vim}/init.vim | 0 .../nvim => _saved/vim/lazyvim}/.gitignore | 0 .../nvim => _saved/vim/lazyvim}/.neoconf.json | 0 .../nvim => _saved/vim/lazyvim}/LICENSE | 0 .../nvim => _saved/vim/lazyvim}/README.md | 0 _saved/vim/lazyvim/init.lua | 2 + _saved/vim/lazyvim/lua/config/autocmds.lua | 25 ++ _saved/vim/lazyvim/lua/config/keymaps.lua | 67 +++++ .../vim/lazyvim}/lua/config/lazy.lua | 0 .../vim/lazyvim}/lua/config/options.lua | 0 .../vim/lazyvim}/lua/plugins/disabled.lua | 0 .../vim/lazyvim}/lua/plugins/lsp.lua | 0 _saved/vim/lazyvim/lua/plugins/lualine.lua | 40 +++ _saved/vim/lazyvim/lua/plugins/monokai.lua | 15 + _saved/vim/lazyvim/lua/plugins/snacks.lua | 28 ++ _saved/vim/lazyvim/lua/plugins/treesitter.lua | 18 ++ _saved/vim/lazyvim/lua/plugins/which-key.lua | 35 +++ _saved/vim/lazyvim/stylua.toml | 3 + _saved/{neovim => vim}/nvchad/.stylua.toml | 0 _saved/{neovim => vim}/nvchad/init.lua | 0 _saved/{neovim => vim}/nvchad/lua/chadrc.lua | 0 .../nvchad/lua/configs/conform.lua | 0 .../nvchad/lua/configs/lazy.lua | 0 .../nvchad/lua/configs/lspconfig.lua | 0 _saved/{neovim => vim}/nvchad/lua/init.lua | 0 .../{neovim => vim}/nvchad/lua/mappings.lua | 0 _saved/{neovim => vim}/nvchad/lua/options.lua | 0 .../nvchad/lua/plugins/init.lua | 0 config/common/nvim/init.lua | 4 +- config/common/nvim/lsp/lua.lua | 20 ++ config/common/nvim/lsp/terraform.lua | 5 + config/common/nvim/lua/config/autocmds.lua | 99 ++++++- config/common/nvim/lua/config/init.lua | 3 + config/common/nvim/lua/config/keymaps.lua | 109 +++---- config/common/nvim/lua/config/settings.lua | 44 +++ config/common/nvim/lua/core/init.lua | 3 + config/common/nvim/lua/core/lazy.lua | 43 +++ config/common/nvim/lua/core/lsp.lua | 274 ++++++++++++++++++ config/common/nvim/lua/core/mason-path.lua | 25 ++ config/common/nvim/lua/plugins/blink.lua | 64 ++++ config/common/nvim/lua/plugins/conform.lua | 18 ++ config/common/nvim/lua/plugins/gitsigns.lua | 22 ++ config/common/nvim/lua/plugins/lualine.lua | 92 +++--- config/common/nvim/lua/plugins/mason.lua | 45 +++ config/common/nvim/lua/plugins/mini.lua | 12 + config/common/nvim/lua/plugins/monokai.lua | 19 +- config/common/nvim/lua/plugins/noice.lua | 27 ++ config/common/nvim/lua/plugins/snacks.lua | 69 +++-- config/common/nvim/lua/plugins/treesitter.lua | 37 ++- config/common/nvim/lua/plugins/which-key.lua | 61 ++-- 51 files changed, 1145 insertions(+), 358 deletions(-) delete mode 100644 _saved/neovim/ftpd/init.lua rename _saved/{neovim/ftpd => vim}/init.vim (100%) rename {config/common/nvim => _saved/vim/lazyvim}/.gitignore (100%) rename {config/common/nvim => _saved/vim/lazyvim}/.neoconf.json (100%) rename {config/common/nvim => _saved/vim/lazyvim}/LICENSE (100%) rename {config/common/nvim => _saved/vim/lazyvim}/README.md (100%) create mode 100644 _saved/vim/lazyvim/init.lua create mode 100644 _saved/vim/lazyvim/lua/config/autocmds.lua create mode 100644 _saved/vim/lazyvim/lua/config/keymaps.lua rename {config/common/nvim => _saved/vim/lazyvim}/lua/config/lazy.lua (100%) rename {config/common/nvim => _saved/vim/lazyvim}/lua/config/options.lua (100%) rename {config/common/nvim => _saved/vim/lazyvim}/lua/plugins/disabled.lua (100%) rename {config/common/nvim => _saved/vim/lazyvim}/lua/plugins/lsp.lua (100%) create mode 100644 _saved/vim/lazyvim/lua/plugins/lualine.lua create mode 100644 _saved/vim/lazyvim/lua/plugins/monokai.lua create mode 100644 _saved/vim/lazyvim/lua/plugins/snacks.lua create mode 100644 _saved/vim/lazyvim/lua/plugins/treesitter.lua create mode 100644 _saved/vim/lazyvim/lua/plugins/which-key.lua create mode 100644 _saved/vim/lazyvim/stylua.toml rename _saved/{neovim => vim}/nvchad/.stylua.toml (100%) rename _saved/{neovim => vim}/nvchad/init.lua (100%) rename _saved/{neovim => vim}/nvchad/lua/chadrc.lua (100%) rename _saved/{neovim => vim}/nvchad/lua/configs/conform.lua (100%) rename _saved/{neovim => vim}/nvchad/lua/configs/lazy.lua (100%) rename _saved/{neovim => vim}/nvchad/lua/configs/lspconfig.lua (100%) rename _saved/{neovim => vim}/nvchad/lua/init.lua (100%) rename _saved/{neovim => vim}/nvchad/lua/mappings.lua (100%) rename _saved/{neovim => vim}/nvchad/lua/options.lua (100%) rename _saved/{neovim => vim}/nvchad/lua/plugins/init.lua (100%) create mode 100644 config/common/nvim/lsp/lua.lua create mode 100644 config/common/nvim/lsp/terraform.lua create mode 100644 config/common/nvim/lua/config/init.lua create mode 100644 config/common/nvim/lua/config/settings.lua create mode 100644 config/common/nvim/lua/core/init.lua create mode 100644 config/common/nvim/lua/core/lazy.lua create mode 100644 config/common/nvim/lua/core/lsp.lua create mode 100644 config/common/nvim/lua/core/mason-path.lua create mode 100644 config/common/nvim/lua/plugins/blink.lua create mode 100644 config/common/nvim/lua/plugins/conform.lua create mode 100644 config/common/nvim/lua/plugins/gitsigns.lua create mode 100644 config/common/nvim/lua/plugins/mason.lua create mode 100644 config/common/nvim/lua/plugins/mini.lua create mode 100644 config/common/nvim/lua/plugins/noice.lua diff --git a/_saved/neovim/ftpd/init.lua b/_saved/neovim/ftpd/init.lua deleted file mode 100644 index 7e86cf0..0000000 --- a/_saved/neovim/ftpd/init.lua +++ /dev/null @@ -1,175 +0,0 @@ --- disable netrw -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 - --- install Lazy -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", -- latest stable release - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - --- define plugins -require("lazy").setup({ - "jdhao/whitespace.nvim", - "lewis6991/gitsigns.nvim", - "lukas-reineke/indent-blankline.nvim", - "numToStr/Comment.nvim", - "NvChad/nvim-colorizer.lua", - "nvim-lualine/lualine.nvim", - "nvim-treesitter/nvim-treesitter", - "tanvirtin/monokai.nvim", - { "nvim-telescope/telescope.nvim", - dependencies = { 'nvim-lua/plenary.nvim' } - }, - { "nvim-neo-tree/neo-tree.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim" - }, - }, - { - "folke/which-key.nvim", - config = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - require("which-key").setup({ - }) - end, - }, -}) - --- start & setup plugins --- colorscheme has to be first -require("monokai").setup() -require("gitsigns").setup({ - signs = { - add = { text = "▎" }, - change = { text = "▎" }, - delete = { text = "▎" }, - topdelete = { text = "契" }, - changedelete = { text = "▎" }, - untracked = { text = "▎" }, - }, -}) -require("indent_blankline").setup() -require("Comment").setup() -require("colorizer").setup() -require("lualine").setup({ - options = { - component_separators = '', - icons_enabled = true, - section_separators = '', - theme = "molokai", - }, - sections = { - lualine_a = { "mode" }, - lualine_b = { { "filename", file_status = true, path = 1 } }, - lualine_c = { "branch" }, - lualine_x = { "filetype" }, - lualine_y = { "progress" }, - lualine_z = { "location" }, - }, - tabline = { - lualine_a = { "buffers" }, - }, -}) -require("nvim-treesitter.configs").setup({ - build = ":TSUpdate", - ensure_installed = { "bash", "python", "terraform", "vim", "yaml" }, - highlight = { - enable = true, - use_languagetree = true, - }, -}) - -require("neo-tree").setup({ - close_if_last_window = false, - sort_case_insensitive = true, - window = { - position = "left", - auto_expand_width = true, - -- width = 100, - mappings = { - ["s"] = "open_split", - ["v"] = "open_vsplit", - }, - }, - nesting_rules = {}, - filesystem = { - filtered_items = { - visible = true, - hide_dotfiles = false, - hide_gitignored = true, - }, - }, -}) - --- modify colorcheme -vim.api.nvim_set_hl(0, "ColorColumn", { bg = "#770000" }) -vim.api.nvim_set_hl(0, "DiffChange", { bg = NONE, fg = "#e7c547" }) -vim.api.nvim_set_hl(0, "DiffText", { bg = NONE, fg = "#ff8700" }) -vim.api.nvim_set_hl(0, "LineNr", { bg = NONE, fg = "#465457" }) -vim.api.nvim_set_hl(0, "NonText", { bg = NONE }) -vim.api.nvim_set_hl(0, "Normal", { bg = NONE }) -vim.api.nvim_set_hl(0, "SignColumn", { bg = NONE }) -vim.api.nvim_set_hl(0, "SpellBad", { bg = "#770000", fg = "#ffffff" }) -vim.api.nvim_set_hl(0, "Visual", { bg = "#005577", fg = "#ffffff" }) - --- global options -vim.opt.list = true -vim.opt.cursorline = true -vim.opt.expandtab = true -vim.opt.gdefault = true -vim.opt.hlsearch = false -vim.opt.ignorecase = true -vim.opt.number = true -vim.opt.shiftround = true -vim.opt.showmode = false -vim.opt.smartcase = true -vim.opt.splitbelow = true -vim.opt.splitright = true -vim.opt.termguicolors = true -vim.opt.writebackup = false -vim.opt.clipboard = "" -vim.opt.mouse = "" -vim.opt.tabstop = 2 -vim.opt.scrolloff = 5 -vim.opt.updatetime = 100 -vim.opt.shiftwidth = 2 -vim.opt.showtabline = 2 -vim.opt.softtabstop = 2 - --- configure mappings -vim.g.mapleader = " " -vim.keymap.set("i", "", "I", { silent = true }) -vim.keymap.set("i", "", "A", { silent = true }) -vim.keymap.set("n", "", "wq!", { silent = true }) -vim.keymap.set("n", "/", "lua require('Comment.api').toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1)", { silent = true, desc = "toggle comment" }) -vim.keymap.set("n", "c", 'execute "set colorcolumn=" . (&colorcolumn == "" ? "80,120" : "")', { silent = true, desc = "toggle column" }) -vim.keymap.set("n", "fb", require("telescope.builtin").buffers, { desc = "find buffer" }) -vim.keymap.set("n", "ff", require("telescope.builtin").find_files, { desc = "find file" }) -vim.keymap.set("n", "fg", require("telescope.builtin").live_grep, { desc = "find text" }) -vim.keymap.set("n", "h", "set hlsearch!", { silent = true, desc = "toggle hlsearch" }) -vim.keymap.set("n", "j", "bprevious", { silent = true, desc = "previous buffer" }) -vim.keymap.set("n", "k", "bnext", { silent = true, desc = "next buffer" }) -vim.keymap.set("n", "n", "set nonumber!Gitsigns toggle_signsIndentBlanklineToggle", { silent = true, desc = "toggle decorations" }) -vim.keymap.set("n", "s", "set spell!", { silent = true, desc = "toggle spell" }) -vim.keymap.set("n", "t", "Neotree toggle", { silent = true, desc = "toggle tree" }) -vim.keymap.set("n", "x", "bd", { silent = true, desc = "close buffer" }) -vim.keymap.set("n", "", "w", { silent = true }) -vim.keymap.set("v", "/", "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", { silent = true, desc = "toggle comment" }) - --- autocmd -vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { - pattern = {"*.gotmpl"}, - callback = function() vim.bo.filetype = "yaml" end, -}) diff --git a/_saved/neovim/ftpd/init.vim b/_saved/vim/init.vim similarity index 100% rename from _saved/neovim/ftpd/init.vim rename to _saved/vim/init.vim diff --git a/config/common/nvim/.gitignore b/_saved/vim/lazyvim/.gitignore similarity index 100% rename from config/common/nvim/.gitignore rename to _saved/vim/lazyvim/.gitignore diff --git a/config/common/nvim/.neoconf.json b/_saved/vim/lazyvim/.neoconf.json similarity index 100% rename from config/common/nvim/.neoconf.json rename to _saved/vim/lazyvim/.neoconf.json diff --git a/config/common/nvim/LICENSE b/_saved/vim/lazyvim/LICENSE similarity index 100% rename from config/common/nvim/LICENSE rename to _saved/vim/lazyvim/LICENSE diff --git a/config/common/nvim/README.md b/_saved/vim/lazyvim/README.md similarity index 100% rename from config/common/nvim/README.md rename to _saved/vim/lazyvim/README.md diff --git a/_saved/vim/lazyvim/init.lua b/_saved/vim/lazyvim/init.lua new file mode 100644 index 0000000..2514f9e --- /dev/null +++ b/_saved/vim/lazyvim/init.lua @@ -0,0 +1,2 @@ +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/_saved/vim/lazyvim/lua/config/autocmds.lua b/_saved/vim/lazyvim/lua/config/autocmds.lua new file mode 100644 index 0000000..fb101c3 --- /dev/null +++ b/_saved/vim/lazyvim/lua/config/autocmds.lua @@ -0,0 +1,25 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- +-- Add any additional autocmds here +-- with `vim.api.nvim_create_autocmd` +-- +-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) +-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") + +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "helmfile.y?ml", "*.gotmpl" }, + callback = function() + vim.cmd("set filetype=helm") + end, +}) + +vim.api.nvim_create_autocmd({ "BufReadPre" }, { + callback = function() + vim.api.nvim_set_hl(0, "ColorColumn", { bg = "#770000" }) + vim.api.nvim_set_hl(0, "DiffChange", { bg = "NONE", fg = "#e7c547" }) + vim.api.nvim_set_hl(0, "DiffText", { bg = "NONE", fg = "#ff8700" }) + vim.api.nvim_set_hl(0, "SpellBad", { bg = "#770000", fg = "#ffffff" }) + vim.api.nvim_set_hl(0, "Visual", { bg = "#0094d8", fg = "#ffffff" }) + end, +}) diff --git a/_saved/vim/lazyvim/lua/config/keymaps.lua b/_saved/vim/lazyvim/lua/config/keymaps.lua new file mode 100644 index 0000000..5cda86d --- /dev/null +++ b/_saved/vim/lazyvim/lua/config/keymaps.lua @@ -0,0 +1,67 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here + +local map = vim.keymap.set +local nomap = vim.keymap.del + +nomap("n", "") +nomap("n", ",") +nomap("n", ".") +nomap("n", "?") +nomap("n", "K") +nomap("n", "l") +nomap("n", "L") +nomap("n", "S") +nomap("n", "`") + +nomap("n", "bb") +nomap("n", "bD") +nomap("n", "bo") + +nomap("n", "E") + +nomap("n", "fB") +nomap("n", "fe") +nomap("n", "fE") +nomap("n", "fn") +nomap("n", "fp") +nomap("n", "fR") +nomap("n", "ft") +nomap("n", "fT") + +nomap("n", "gY") +nomap("n", "gS") + +nomap("n", "qq") + +nomap("n", "xl") +nomap("n", "xq") + +map("i", "", "I") +map("i", "", "A") + +map("n", "", "wq!", { desc = "Save and Exit", remap = true }) +map("n", "", "w", { desc = "Switch Pane", remap = true }) + +map("n", "-", "s", { desc = "Split Horizontally", remap = true }) +map("n", "/", "gcc", { desc = "Toggle Comments", remap = true }) +map("n", "|", "v", { desc = "Split Vertically", remap = true }) +map("n", "bl", function() + Snacks.picker.buffers() +end, { desc = "Buffer List", remap = true }) +map("n", "b[", "bprevious", { desc = "Previous Buffer", remap = true }) +map("n", "b]", "bnext", { desc = "Next Buffer", remap = true }) +map("n", "bn", "enew", { desc = "New Buffer", remap = true }) +map("n", "h", "set hlsearch!", { desc = "Toggle hlsearch", remap = true }) +map( + "n", + "m", + 'execute "set colorcolumn=" . (&colorcolumn == "" ? "80,120" : "")', + { desc = "Toggle Columns", remap = true } +) +map("n", "T", function() + Snacks.terminal() +end, { desc = "Terminal", remap = true }) + +map("v", "/", "gc", { desc = "Toggle Comments", remap = true }) diff --git a/config/common/nvim/lua/config/lazy.lua b/_saved/vim/lazyvim/lua/config/lazy.lua similarity index 100% rename from config/common/nvim/lua/config/lazy.lua rename to _saved/vim/lazyvim/lua/config/lazy.lua diff --git a/config/common/nvim/lua/config/options.lua b/_saved/vim/lazyvim/lua/config/options.lua similarity index 100% rename from config/common/nvim/lua/config/options.lua rename to _saved/vim/lazyvim/lua/config/options.lua diff --git a/config/common/nvim/lua/plugins/disabled.lua b/_saved/vim/lazyvim/lua/plugins/disabled.lua similarity index 100% rename from config/common/nvim/lua/plugins/disabled.lua rename to _saved/vim/lazyvim/lua/plugins/disabled.lua diff --git a/config/common/nvim/lua/plugins/lsp.lua b/_saved/vim/lazyvim/lua/plugins/lsp.lua similarity index 100% rename from config/common/nvim/lua/plugins/lsp.lua rename to _saved/vim/lazyvim/lua/plugins/lsp.lua diff --git a/_saved/vim/lazyvim/lua/plugins/lualine.lua b/_saved/vim/lazyvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..4b6a4c0 --- /dev/null +++ b/_saved/vim/lazyvim/lua/plugins/lualine.lua @@ -0,0 +1,40 @@ +return { + "nvim-lualine/lualine.nvim", + opts = { + options = { + theme = "powerline", + section_separators = "", + component_separators = "", + globalstatus = false, + }, + sections = { + lualine_c = { + { + "diagnostics", + symbols = { + error = LazyVim.config.icons.diagnostics.Error, + warn = LazyVim.config.icons.diagnostics.Warn, + info = LazyVim.config.icons.diagnostics.Info, + hint = LazyVim.config.icons.diagnostics.Hint, + }, + }, + { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, + { "filename", file_status = true, path = 1 }, + }, + lualine_x = { + { + "diff", + symbols = { + added = LazyVim.config.icons.git.added, + modified = LazyVim.config.icons.git.modified, + removed = LazyVim.config.icons.git.removed, + }, + }, + }, + lualine_z = {}, + }, + tabline = { + lualine_a = { "buffers" }, + }, + }, +} diff --git a/_saved/vim/lazyvim/lua/plugins/monokai.lua b/_saved/vim/lazyvim/lua/plugins/monokai.lua new file mode 100644 index 0000000..bd1de20 --- /dev/null +++ b/_saved/vim/lazyvim/lua/plugins/monokai.lua @@ -0,0 +1,15 @@ +return { + { + "loctvl842/monokai-pro.nvim", + priority = 1000, + opts = { + filter = "classic", + }, + }, + { + "LazyVim/LazyVim", + opts = { + colorscheme = "monokai-pro", + }, + }, +} diff --git a/_saved/vim/lazyvim/lua/plugins/snacks.lua b/_saved/vim/lazyvim/lua/plugins/snacks.lua new file mode 100644 index 0000000..8c38215 --- /dev/null +++ b/_saved/vim/lazyvim/lua/plugins/snacks.lua @@ -0,0 +1,28 @@ +return { + "folke/snacks.nvim", + opts = { + dashboard = { enabled = false }, + }, + keys = { + { + "n", + function() + vim.cmd("set number!") + vim.cmd('execute "set signcolumn=" . (&signcolumn == "yes" ? "no" : "yes")') + if Snacks.indent.enabled then + Snacks.indent.disable() + else + Snacks.indent.enable() + end + end, + desc = "Toggle Decorations", + }, + { + "e", + function() + Snacks.explorer() + end, + desc = "File Explorer", + }, + }, +} diff --git a/_saved/vim/lazyvim/lua/plugins/treesitter.lua b/_saved/vim/lazyvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..ac75221 --- /dev/null +++ b/_saved/vim/lazyvim/lua/plugins/treesitter.lua @@ -0,0 +1,18 @@ +return { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "diff", + "gotmpl", + "helm", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "terraform", + "vim", + }, + }, +} diff --git a/_saved/vim/lazyvim/lua/plugins/which-key.lua b/_saved/vim/lazyvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..47460fe --- /dev/null +++ b/_saved/vim/lazyvim/lua/plugins/which-key.lua @@ -0,0 +1,35 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts_extend = { "spec" }, + opts = { + preset = "helix", + icons = { + mappings = false, + }, + defaults = {}, + spec = { + { + mode = { "n", "v" }, + { + "b", + group = "buffer", + expand = function() + return require("which-key.extras").expand.buf() + end, + }, + { "", group = "tabs", hidden = true }, + { "d", group = "debug", hidden = true }, + { "dp", group = "profiler", hidden = true }, + { "gh", group = "hunks", hidden = true }, + { "q", group = "quit/session", hidden = true }, + { "s", group = "search", hidden = true }, + { "t", hidden = true }, + { "u", group = "ui", hidden = true }, + { "w", hidden = true }, + { "x", group = "diagnostics/quickfix", hidden = true }, + { "gx", desc = "Open with system app", hidden = true }, + }, + }, + }, +} diff --git a/_saved/vim/lazyvim/stylua.toml b/_saved/vim/lazyvim/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/_saved/vim/lazyvim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file diff --git a/_saved/neovim/nvchad/.stylua.toml b/_saved/vim/nvchad/.stylua.toml similarity index 100% rename from _saved/neovim/nvchad/.stylua.toml rename to _saved/vim/nvchad/.stylua.toml diff --git a/_saved/neovim/nvchad/init.lua b/_saved/vim/nvchad/init.lua similarity index 100% rename from _saved/neovim/nvchad/init.lua rename to _saved/vim/nvchad/init.lua diff --git a/_saved/neovim/nvchad/lua/chadrc.lua b/_saved/vim/nvchad/lua/chadrc.lua similarity index 100% rename from _saved/neovim/nvchad/lua/chadrc.lua rename to _saved/vim/nvchad/lua/chadrc.lua diff --git a/_saved/neovim/nvchad/lua/configs/conform.lua b/_saved/vim/nvchad/lua/configs/conform.lua similarity index 100% rename from _saved/neovim/nvchad/lua/configs/conform.lua rename to _saved/vim/nvchad/lua/configs/conform.lua diff --git a/_saved/neovim/nvchad/lua/configs/lazy.lua b/_saved/vim/nvchad/lua/configs/lazy.lua similarity index 100% rename from _saved/neovim/nvchad/lua/configs/lazy.lua rename to _saved/vim/nvchad/lua/configs/lazy.lua diff --git a/_saved/neovim/nvchad/lua/configs/lspconfig.lua b/_saved/vim/nvchad/lua/configs/lspconfig.lua similarity index 100% rename from _saved/neovim/nvchad/lua/configs/lspconfig.lua rename to _saved/vim/nvchad/lua/configs/lspconfig.lua diff --git a/_saved/neovim/nvchad/lua/init.lua b/_saved/vim/nvchad/lua/init.lua similarity index 100% rename from _saved/neovim/nvchad/lua/init.lua rename to _saved/vim/nvchad/lua/init.lua diff --git a/_saved/neovim/nvchad/lua/mappings.lua b/_saved/vim/nvchad/lua/mappings.lua similarity index 100% rename from _saved/neovim/nvchad/lua/mappings.lua rename to _saved/vim/nvchad/lua/mappings.lua diff --git a/_saved/neovim/nvchad/lua/options.lua b/_saved/vim/nvchad/lua/options.lua similarity index 100% rename from _saved/neovim/nvchad/lua/options.lua rename to _saved/vim/nvchad/lua/options.lua diff --git a/_saved/neovim/nvchad/lua/plugins/init.lua b/_saved/vim/nvchad/lua/plugins/init.lua similarity index 100% rename from _saved/neovim/nvchad/lua/plugins/init.lua rename to _saved/vim/nvchad/lua/plugins/init.lua diff --git a/config/common/nvim/init.lua b/config/common/nvim/init.lua index 2514f9e..f6daed1 100644 --- a/config/common/nvim/init.lua +++ b/config/common/nvim/init.lua @@ -1,2 +1,2 @@ --- bootstrap lazy.nvim, LazyVim and your plugins -require("config.lazy") +require("config") +require("core") diff --git a/config/common/nvim/lsp/lua.lua b/config/common/nvim/lsp/lua.lua new file mode 100644 index 0000000..42d872d --- /dev/null +++ b/config/common/nvim/lsp/lua.lua @@ -0,0 +1,20 @@ +return { + cmd = { "lua-language-server" }, + filetypes = { "lua" }, + settings = { + Lua = { + diagnostics = { + globals = { + "vim", + "Snacks", + }, + }, + }, + }, + capabilities = vim.tbl_deep_extend("force", {}, vim.lsp.protocol.make_client_capabilities(), { + fileOperations = { + didRename = true, + willRename = true, + }, + }), +} diff --git a/config/common/nvim/lsp/terraform.lua b/config/common/nvim/lsp/terraform.lua new file mode 100644 index 0000000..c80ff6f --- /dev/null +++ b/config/common/nvim/lsp/terraform.lua @@ -0,0 +1,5 @@ +return { + cmd = { "terraform-ls", "serve" }, + filetypes = { "terraform", "hcl" }, + root_markers = { ".terraform", ".git" }, +} diff --git a/config/common/nvim/lua/config/autocmds.lua b/config/common/nvim/lua/config/autocmds.lua index fb101c3..824f84b 100644 --- a/config/common/nvim/lua/config/autocmds.lua +++ b/config/common/nvim/lua/config/autocmds.lua @@ -1,25 +1,100 @@ --- Autocmds are automatically loaded on the VeryLazy event --- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua --- --- Add any additional autocmds here --- with `vim.api.nvim_create_autocmd` --- --- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) --- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") +-- don't auto comment new line +vim.api.nvim_create_autocmd("BufEnter", { command = [[set formatoptions-=cro]] }) -vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { - pattern = { "helmfile.y?ml", "*.gotmpl" }, +-- resize neovim split when terminal is resized +vim.api.nvim_command("autocmd VimResized * wincmd =") + +-- enable spell for text files +vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("spell", { clear = true }), + pattern = { "text", "plaintex", "typst", "gitcommit", "markdown" }, callback = function() - vim.cmd("set filetype=helm") + vim.api.nvim_set_hl(0, "SpellBad", { bg = "#770000", fg = "#ffffff" }) + vim.opt_local.spell = true end, }) +-- set some colors vim.api.nvim_create_autocmd({ "BufReadPre" }, { callback = function() vim.api.nvim_set_hl(0, "ColorColumn", { bg = "#770000" }) vim.api.nvim_set_hl(0, "DiffChange", { bg = "NONE", fg = "#e7c547" }) vim.api.nvim_set_hl(0, "DiffText", { bg = "NONE", fg = "#ff8700" }) - vim.api.nvim_set_hl(0, "SpellBad", { bg = "#770000", fg = "#ffffff" }) vim.api.nvim_set_hl(0, "Visual", { bg = "#0094d8", fg = "#ffffff" }) end, }) + +-- fix dimmed elements in Snacks.picker +vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + Snacks.util.set_hl({ + PickerDir = { link = "Text" }, + PickerPathHidden = { link = "Text" }, + PickerPathIgnored = { link = "Comment" }, + PickerGitStatusUntracked = { link = "Special" }, + }, { prefix = "Snacks" }) + end, +}) + +-- remember last location +vim.api.nvim_create_autocmd("BufReadPost", { + group = vim.api.nvim_create_augroup("last-loc", { clear = true }), + callback = function(event) + local exclude = { "gitcommit" } + local buf = event.buf + if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].my_last_loc then + return + end + vim.b[buf].my_last_loc = true + local mark = vim.api.nvim_buf_get_mark(buf, '"') + local lcount = vim.api.nvim_buf_line_count(buf) + if mark[1] > 0 and mark[1] <= lcount then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, +}) + +-- lsp +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }), + callback = function(event) + local map = function(keys, func, desc) + vim.keymap.set("n", keys, func, { buffer = event.buf, desc = desc }) + end + map("cd", vim.diagnostic.open_float, "diagnostic (float)") + map("ch", vim.lsp.buf.hover, "help") + map("ca", vim.lsp.buf.code_action, "actions") + map("cf", vim.lsp.buf.format, "format file") + local function client_supports_method(client, method, bufnr) + if vim.fn.has("nvim-0.11") == 1 then + return client:supports_method(method, bufnr) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end + local client = vim.lsp.get_client_by_id(event.data.client_id) + if + client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) + then + local highlight_augroup = vim.api.nvim_create_augroup("lsp-highlight", { clear = false }) + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + vim.api.nvim_create_autocmd("LspDetach", { + group = vim.api.nvim_create_augroup("lsp-detach", { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds({ group = "lsp-highlight", buffer = event2.buf }) + end, + }) + end + end, +}) diff --git a/config/common/nvim/lua/config/init.lua b/config/common/nvim/lua/config/init.lua new file mode 100644 index 0000000..5049454 --- /dev/null +++ b/config/common/nvim/lua/config/init.lua @@ -0,0 +1,3 @@ +require("config.settings") +require("config.keymaps") +require("config.autocmds") diff --git a/config/common/nvim/lua/config/keymaps.lua b/config/common/nvim/lua/config/keymaps.lua index 5cda86d..4b6a090 100644 --- a/config/common/nvim/lua/config/keymaps.lua +++ b/config/common/nvim/lua/config/keymaps.lua @@ -1,67 +1,74 @@ --- Keymaps are automatically loaded on the VeryLazy event --- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua --- Add any additional keymaps here +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" local map = vim.keymap.set -local nomap = vim.keymap.del - -nomap("n", "") -nomap("n", ",") -nomap("n", ".") -nomap("n", "?") -nomap("n", "K") -nomap("n", "l") -nomap("n", "L") -nomap("n", "S") -nomap("n", "`") - -nomap("n", "bb") -nomap("n", "bD") -nomap("n", "bo") - -nomap("n", "E") - -nomap("n", "fB") -nomap("n", "fe") -nomap("n", "fE") -nomap("n", "fn") -nomap("n", "fp") -nomap("n", "fR") -nomap("n", "ft") -nomap("n", "fT") - -nomap("n", "gY") -nomap("n", "gS") - -nomap("n", "qq") - -nomap("n", "xl") -nomap("n", "xq") map("i", "", "I") map("i", "", "A") -map("n", "", "wq!", { desc = "Save and Exit", remap = true }) -map("n", "", "w", { desc = "Switch Pane", remap = true }) +map("v", "/", "gc", { desc = "toggle comments", remap = true }) -map("n", "-", "s", { desc = "Split Horizontally", remap = true }) -map("n", "/", "gcc", { desc = "Toggle Comments", remap = true }) -map("n", "|", "v", { desc = "Split Vertically", remap = true }) +map("n", "", "wqa", { desc = "save and exit", remap = true }) +map("n", "", "wqa", { desc = "save and exit", remap = true }) +map("n", "", "w", { desc = "switch pane", remap = true }) + +map("n", "+", ":vertical resize +5") +map("n", "_", ":vertical resize -5") +map("n", "=", ":resize +5") +map("n", "-", ":resize -5") + +map("n", "-", "s", { desc = "split horizontally", remap = true }) +map("n", "/", "gcc", { desc = "toggle comments", remap = true }) +map("n", "|", "v", { desc = "split vertically", remap = true }) + +map("n", "b[", "bprevious", { desc = "buffer previous", remap = true }) +map("n", "b]", "bnext", { desc = "buffer next", remap = true }) +map("n", "bd", function() + Snacks.bufdelete() +end, { desc = "buffer delete", remap = true }) map("n", "bl", function() Snacks.picker.buffers() -end, { desc = "Buffer List", remap = true }) -map("n", "b[", "bprevious", { desc = "Previous Buffer", remap = true }) -map("n", "b]", "bnext", { desc = "Next Buffer", remap = true }) -map("n", "bn", "enew", { desc = "New Buffer", remap = true }) -map("n", "h", "set hlsearch!", { desc = "Toggle hlsearch", remap = true }) +end, { desc = "buffer list", remap = true }) +map("n", "bn", "enew", { desc = "buffer create", remap = true }) + +map("n", "e", function() + Snacks.explorer() +end, { desc = "explorer", remap = true }) +map("n", "s", "set hlsearch!", { desc = "toggle hlsearch", remap = true }) + +map("n", "ff", function() + Snacks.picker.files() +end, { desc = "files", remap = true }) +map("n", "fg", function() + Snacks.picker.grep() +end, { desc = "grep", remap = true }) + +map("n", "hc", function() + Snacks.picker.command_history() +end, { desc = "commands", remap = true }) +map("n", "hn", "Noice", { desc = "notifications", remap = true }) +map("n", "hs", function() + Snacks.picker.search_history() +end, { desc = "search", remap = true }) + map( "n", "m", 'execute "set colorcolumn=" . (&colorcolumn == "" ? "80,120" : "")', - { desc = "Toggle Columns", remap = true } + { desc = "toggle columns" } ) -map("n", "T", function() +map("n", "n", function() + vim.cmd("set number!") + vim.cmd('execute "set signcolumn=" . (&signcolumn == "yes" ? "no" : "yes")') + if Snacks.indent.enabled then + Snacks.indent.disable() + else + Snacks.indent.enable() + end +end, { desc = "toggle decorations", remap = true }) +map("n", "t", function() Snacks.terminal() -end, { desc = "Terminal", remap = true }) +end, { desc = "terminal", remap = true }) -map("v", "/", "gc", { desc = "Toggle Comments", remap = true }) +map("n", "us", "set spell!", { desc = "toggle spell", remap = true }) +map("n", "uw", "set wrap!", { desc = "toggle wrap", remap = true }) diff --git a/config/common/nvim/lua/config/settings.lua b/config/common/nvim/lua/config/settings.lua new file mode 100644 index 0000000..805d8b6 --- /dev/null +++ b/config/common/nvim/lua/config/settings.lua @@ -0,0 +1,44 @@ +vim.filetype.add({ + pattern = { + ["helmfile.y.ml"] = "helm", + [".*.gotmpl"] = "helm", + }, +}) + +vim.o.backup = false +vim.o.breakindent = true +vim.o.confirm = true +vim.o.cursorline = true +vim.o.expandtab = true +vim.o.gdefault = true +vim.o.hlsearch = true +vim.o.inccommand = "split" +vim.o.number = true +vim.o.relativenumber = false +vim.o.shiftround = true +vim.o.showcmd = false +vim.o.showmode = false +vim.o.smartcase = true +vim.o.smartindent = true +vim.o.splitbelow = true +vim.o.splitright = true +vim.o.termguicolors = true +vim.o.undofile = true +vim.o.wrap = true +vim.o.writebackup = false + +vim.o.clipboard = "" +vim.o.conceallevel = 0 +vim.o.fileencoding = "utf-8" +vim.o.foldcolumn = "0" +vim.o.mouse = "" +vim.o.shiftwidth = 2 +vim.o.signcolumn = "yes" +vim.o.softtabstop = 2 +vim.o.spelllang = "en_us,pl" +vim.o.statuscolumn = "" +vim.o.tabstop = 2 +vim.o.updatetime = 100 +vim.o.whichwrap = "" + +vim.opt.shortmess:append({ W = true, I = true, c = true, C = true, S = false }) diff --git a/config/common/nvim/lua/core/init.lua b/config/common/nvim/lua/core/init.lua new file mode 100644 index 0000000..27c8575 --- /dev/null +++ b/config/common/nvim/lua/core/init.lua @@ -0,0 +1,3 @@ +require("core.lazy") +require("core.lsp") +require("core.mason-path") diff --git a/config/common/nvim/lua/core/lazy.lua b/config/common/nvim/lua/core/lazy.lua new file mode 100644 index 0000000..a91f0c6 --- /dev/null +++ b/config/common/nvim/lua/core/lazy.lua @@ -0,0 +1,43 @@ +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) + +require("lazy").setup({ import = "plugins" }, { + install = { + missing = true, + }, + checker = { + enabled = true, + notify = false, + }, + change_detection = { + enabled = true, + notify = false, + }, + ui = { + -- border = "rounded" + }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/config/common/nvim/lua/core/lsp.lua b/config/common/nvim/lua/core/lsp.lua new file mode 100644 index 0000000..ed3e623 --- /dev/null +++ b/config/common/nvim/lua/core/lsp.lua @@ -0,0 +1,274 @@ +vim.lsp.enable({ + "lua", + "terraform", +}) + +vim.diagnostic.config({ + virtual_lines = true, + -- virtual_text = true, + underline = false, + update_in_insert = false, + severity_sort = true, + float = { + border = "rounded", + source = false, + }, + 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", + }, + }, +}) + +-- Extras + +local function restart_lsp(bufnr) + bufnr = bufnr or vim.api.nvim_get_current_buf() + local clients = vim.lsp.get_clients({ bufnr = bufnr }) + + for _, client in ipairs(clients) do + vim.lsp.stop_client(client.id) + end + + vim.defer_fn(function() + vim.cmd("edit") + end, 100) +end + +vim.api.nvim_create_user_command("LspRestart", function() + restart_lsp() +end, {}) + +local function lsp_status() + local bufnr = vim.api.nvim_get_current_buf() + local clients = vim.lsp.get_clients({ bufnr = bufnr }) + + if #clients == 0 then + print("󰅚 No LSP clients attached") + return + end + + print("󰒋 LSP Status for buffer " .. bufnr .. ":") + print("─────────────────────────────────") + + for i, client in ipairs(clients) do + print(string.format("󰌘 Client %d: %s (ID: %d)", i, client.name, client.id)) + print(" Root: " .. (client.config.root_dir or "N/A")) + print(" Filetypes: " .. table.concat(client.config.filetypes or {}, ", ")) + + -- Check capabilities + local caps = client.server_capabilities + local features = {} + if caps.completionProvider then + table.insert(features, "completion") + end + if caps.hoverProvider then + table.insert(features, "hover") + end + if caps.definitionProvider then + table.insert(features, "definition") + end + if caps.referencesProvider then + table.insert(features, "references") + end + if caps.renameProvider then + table.insert(features, "rename") + end + if caps.codeActionProvider then + table.insert(features, "code_action") + end + if caps.documentFormattingProvider then + table.insert(features, "formatting") + end + + print(" Features: " .. table.concat(features, ", ")) + print("") + end +end + +vim.api.nvim_create_user_command("LspStatus", lsp_status, { desc = "Show detailed LSP status" }) + +local function check_lsp_capabilities() + local bufnr = vim.api.nvim_get_current_buf() + local clients = vim.lsp.get_clients({ bufnr = bufnr }) + + if #clients == 0 then + print("No LSP clients attached") + return + end + + for _, client in ipairs(clients) do + print("Capabilities for " .. client.name .. ":") + local caps = client.server_capabilities + + local capability_list = { + { "Completion", caps.completionProvider }, + { "Hover", caps.hoverProvider }, + { "Signature Help", caps.signatureHelpProvider }, + { "Go to Definition", caps.definitionProvider }, + { "Go to Declaration", caps.declarationProvider }, + { "Go to Implementation", caps.implementationProvider }, + { "Go to Type Definition", caps.typeDefinitionProvider }, + { "Find References", caps.referencesProvider }, + { "Document Highlight", caps.documentHighlightProvider }, + { "Document Symbol", caps.documentSymbolProvider }, + { "Workspace Symbol", caps.workspaceSymbolProvider }, + { "Code Action", caps.codeActionProvider }, + { "Code Lens", caps.codeLensProvider }, + { "Document Formatting", caps.documentFormattingProvider }, + { "Document Range Formatting", caps.documentRangeFormattingProvider }, + { "Rename", caps.renameProvider }, + { "Folding Range", caps.foldingRangeProvider }, + { "Selection Range", caps.selectionRangeProvider }, + } + + for _, cap in ipairs(capability_list) do + local status = cap[2] and "✓" or "✗" + print(string.format(" %s %s", status, cap[1])) + end + print("") + end +end + +vim.api.nvim_create_user_command("LspCapabilities", check_lsp_capabilities, { desc = "Show LSP capabilities" }) + +local function lsp_diagnostics_info() + local bufnr = vim.api.nvim_get_current_buf() + local diagnostics = vim.diagnostic.get(bufnr) + + local counts = { ERROR = 0, WARN = 0, INFO = 0, HINT = 0 } + + for _, diagnostic in ipairs(diagnostics) do + local severity = vim.diagnostic.severity[diagnostic.severity] + counts[severity] = counts[severity] + 1 + end + + print("󰒡 Diagnostics for current buffer:") + print(" Errors: " .. counts.ERROR) + print(" Warnings: " .. counts.WARN) + print(" Info: " .. counts.INFO) + print(" Hints: " .. counts.HINT) + print(" Total: " .. #diagnostics) +end + +vim.api.nvim_create_user_command("LspDiagnostics", lsp_diagnostics_info, { desc = "Show LSP diagnostics count" }) + +local function lsp_info() + local bufnr = vim.api.nvim_get_current_buf() + local clients = vim.lsp.get_clients({ bufnr = bufnr }) + + print("═══════════════════════════════════") + print(" LSP INFORMATION ") + print("═══════════════════════════════════") + print("") + + -- Basic info + print("󰈙 Language client log: " .. vim.lsp.get_log_path()) + print("󰈔 Detected filetype: " .. vim.bo.filetype) + print("󰈮 Buffer: " .. bufnr) + print("󰈔 Root directory: " .. (vim.fn.getcwd() or "N/A")) + print("") + + if #clients == 0 then + print("󰅚 No LSP clients attached to buffer " .. bufnr) + print("") + print("Possible reasons:") + print(" • No language server installed for " .. vim.bo.filetype) + print(" • Language server not configured") + print(" • Not in a project root directory") + print(" • File type not recognized") + return + end + + print("󰒋 LSP clients attached to buffer " .. bufnr .. ":") + print("─────────────────────────────────") + + for i, client in ipairs(clients) do + print(string.format("󰌘 Client %d: %s", i, client.name)) + print(" ID: " .. client.id) + print(" Root dir: " .. (client.config.root_dir or "Not set")) + print(" Command: " .. table.concat(client.config.cmd or {}, " ")) + print(" Filetypes: " .. table.concat(client.config.filetypes or {}, ", ")) + + -- Server status + if client.is_stopped() then + print(" Status: 󰅚 Stopped") + else + print(" Status: 󰄬 Running") + end + + -- Workspace folders + if client.workspace_folders and #client.workspace_folders > 0 then + print(" Workspace folders:") + for _, folder in ipairs(client.workspace_folders) do + print(" • " .. folder.name) + end + end + + -- Attached buffers count + local attached_buffers = {} + for buf, _ in pairs(client.attached_buffers or {}) do + table.insert(attached_buffers, buf) + end + print(" Attached buffers: " .. #attached_buffers) + + -- Key capabilities + local caps = client.server_capabilities + local key_features = {} + if caps.completionProvider then + table.insert(key_features, "completion") + end + if caps.hoverProvider then + table.insert(key_features, "hover") + end + if caps.definitionProvider then + table.insert(key_features, "definition") + end + if caps.documentFormattingProvider then + table.insert(key_features, "formatting") + end + if caps.codeActionProvider then + table.insert(key_features, "code_action") + end + + if #key_features > 0 then + print(" Key features: " .. table.concat(key_features, ", ")) + end + + print("") + end + + -- Diagnostics summary + local diagnostics = vim.diagnostic.get(bufnr) + if #diagnostics > 0 then + print("󰒡 Diagnostics Summary:") + local counts = { ERROR = 0, WARN = 0, INFO = 0, HINT = 0 } + + for _, diagnostic in ipairs(diagnostics) do + local severity = vim.diagnostic.severity[diagnostic.severity] + counts[severity] = counts[severity] + 1 + end + + print(" 󰅚 Errors: " .. counts.ERROR) + print(" 󰀪 Warnings: " .. counts.WARN) + print(" 󰋽 Info: " .. counts.INFO) + print(" 󰌶 Hints: " .. counts.HINT) + print(" Total: " .. #diagnostics) + else + print("󰄬 No diagnostics") + end + + print("") + print("Use :LspLog to view detailed logs") + print("Use :LspCapabilities for full capability list") +end + +-- Create command +vim.api.nvim_create_user_command("LspInfo", lsp_info, { desc = "Show comprehensive LSP information" }) diff --git a/config/common/nvim/lua/core/mason-path.lua b/config/common/nvim/lua/core/mason-path.lua new file mode 100644 index 0000000..a00d3b8 --- /dev/null +++ b/config/common/nvim/lua/core/mason-path.lua @@ -0,0 +1,25 @@ +local mason_bin = vim.fn.stdpath("data") .. "/mason/bin" +local current_path = vim.env.PATH or "" + +-- Remove any existing Mason bin entries to prevent duplicates +local path_entries = vim.split(current_path, ":") +local clean_path_entries = {} +local seen = {} + +for _, entry in ipairs(path_entries) do + -- Skip Mason bin entries and duplicates + if entry ~= mason_bin and entry ~= "" and not seen[entry] then + seen[entry] = true + table.insert(clean_path_entries, entry) + end +end + +-- Add Mason bin directory at the beginning +local new_path = mason_bin .. ":" .. table.concat(clean_path_entries, ":") +vim.env.PATH = new_path + +-- Verify Mason bin directory exists +if vim.fn.isdirectory(mason_bin) == 0 then + -- Mason not installed yet, create placeholder + vim.fn.mkdir(mason_bin, "p") +end diff --git a/config/common/nvim/lua/plugins/blink.lua b/config/common/nvim/lua/plugins/blink.lua new file mode 100644 index 0000000..0e89abc --- /dev/null +++ b/config/common/nvim/lua/plugins/blink.lua @@ -0,0 +1,64 @@ +return { + { "L3MON4D3/LuaSnip", keys = {} }, + { + "saghen/blink.cmp", + dependencies = { + "rafamadriz/friendly-snippets", + }, + version = "*", + config = function() + require("blink.cmp").setup({ + snippets = { preset = "luasnip" }, + signature = { enabled = true }, + appearance = { + use_nvim_cmp_as_default = false, + nerd_font_variant = "normal", + }, + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + providers = { + cmdline = { + min_keyword_length = 2, + }, + }, + }, + keymap = { + [""] = { "accept", "fallback" }, + }, + cmdline = { + enabled = false, + completion = { menu = { auto_show = true } }, + keymap = { + [""] = { "accept_and_enter", "fallback" }, + }, + }, + completion = { + menu = { + border = nil, + scrolloff = 1, + scrollbar = false, + draw = { + columns = { + { "kind_icon" }, + { "label", "label_description", gap = 1 }, + { "kind" }, + { "source_name" }, + }, + }, + }, + documentation = { + window = { + border = nil, + scrollbar = false, + winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,EndOfBuffer:BlinkCmpDoc", + }, + auto_show = true, + auto_show_delay_ms = 500, + }, + }, + }) + + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, +} diff --git a/config/common/nvim/lua/plugins/conform.lua b/config/common/nvim/lua/plugins/conform.lua new file mode 100644 index 0000000..ce53db1 --- /dev/null +++ b/config/common/nvim/lua/plugins/conform.lua @@ -0,0 +1,18 @@ +return { + "stevearc/conform.nvim", + opts = {}, + config = function() + require("conform").setup({ + formatters_by_ft = { + lua = { "stylua" }, + terraform = { "terraform_fmt" }, + tf = { "terraform_fmt" }, + ["terraform-vars"] = { "terraform_fmt" }, + }, + format_on_save = { + lsp_fallback = true, + async = false, + }, + }) + end, +} diff --git a/config/common/nvim/lua/plugins/gitsigns.lua b/config/common/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..5681f2b --- /dev/null +++ b/config/common/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,22 @@ +return { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup({ + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + signs_staged = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + }, + }) + end, +} diff --git a/config/common/nvim/lua/plugins/lualine.lua b/config/common/nvim/lua/plugins/lualine.lua index 4b6a4c0..3dcbf09 100644 --- a/config/common/nvim/lua/plugins/lualine.lua +++ b/config/common/nvim/lua/plugins/lualine.lua @@ -1,40 +1,60 @@ return { "nvim-lualine/lualine.nvim", - opts = { - options = { - theme = "powerline", - section_separators = "", - component_separators = "", - globalstatus = false, - }, - sections = { - lualine_c = { - { - "diagnostics", - symbols = { - error = LazyVim.config.icons.diagnostics.Error, - warn = LazyVim.config.icons.diagnostics.Warn, - info = LazyVim.config.icons.diagnostics.Info, - hint = LazyVim.config.icons.diagnostics.Hint, - }, - }, - { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, - { "filename", file_status = true, path = 1 }, - }, - lualine_x = { - { - "diff", - symbols = { - added = LazyVim.config.icons.git.added, - modified = LazyVim.config.icons.git.modified, - removed = LazyVim.config.icons.git.removed, - }, - }, - }, - lualine_z = {}, - }, - tabline = { - lualine_a = { "buffers" }, - }, + dependencies = { + "nvim-tree/nvim-web-devicons", }, + config = function() + require("lualine").setup({ + options = { + theme = "monokai-pro", + section_separators = "", + component_separators = "", + globalstatus = false, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch" }, + lualine_c = { + { + "diff", + symbols = { + added = " ", + modified = " ", + removed = " ", + }, + }, + { + "diagnostics", + symbols = { + error = " ", + warn = " ", + info = " ", + hint = " ", + }, + }, + { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, + { "filename", file_status = true, path = 1 }, + }, + lualine_x = { + { + "lsp_status", + symbols = { + spinner = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }, + done = "✓", + separator = " ", + }, + }, + }, + lualine_y = { + { "searchcount" }, + { "progress", separator = " ", padding = { left = 1, right = 0 } }, + { "location", padding = { left = 0, right = 1 } }, + }, + lualine_z = {}, + }, + tabline = { + lualine_a = { "buffers" }, + }, + }) + end, } diff --git a/config/common/nvim/lua/plugins/mason.lua b/config/common/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..c7d4259 --- /dev/null +++ b/config/common/nvim/lua/plugins/mason.lua @@ -0,0 +1,45 @@ +return { + { + "williamboman/mason.nvim", + lazy = false, + cmd = "Mason", + keys = { { "cm", "Mason", desc = "Mason" } }, + build = ":MasonUpdate", + opts = { + ensure_installed = { + "lua-language-server", + "terraform-ls", + "stylua", + }, + }, + config = function(_, opts) + require("mason").setup(opts) + local mr = require("mason-registry") + local function ensure_installed() + for _, tool in ipairs(opts.ensure_installed) do + if mr.has_package(tool) then + local p = mr.get_package(tool) + if not p:is_installed() then + vim.notify("Mason: Installing " .. tool .. "...", vim.log.levels.INFO) + p:install():once("closed", function() + if p:is_installed() then + vim.notify("Mason: Successfully installed " .. tool, vim.log.levels.INFO) + else + vim.notify("Mason: Failed to install " .. tool, vim.log.levels.ERROR) + end + end) + end + else + vim.notify("Mason: Package '" .. tool .. "' not found", vim.log.levels.WARN) + end + end + end + + if mr.refresh then + mr.refresh(ensure_installed) + else + ensure_installed() + end + end, + }, +} diff --git a/config/common/nvim/lua/plugins/mini.lua b/config/common/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..8bc8aaf --- /dev/null +++ b/config/common/nvim/lua/plugins/mini.lua @@ -0,0 +1,12 @@ +return { + "echasnovski/mini.pairs", + config = function() + require("mini.pairs").setup({ + modes = { insert = true, command = true, terminal = false }, + skip_next = [=[[%w%%%'%[%"%.%`%$]]=], + skip_ts = { "string" }, + skip_unbalanced = true, + markdown = true, + }) + end, +} diff --git a/config/common/nvim/lua/plugins/monokai.lua b/config/common/nvim/lua/plugins/monokai.lua index bd1de20..03c45eb 100644 --- a/config/common/nvim/lua/plugins/monokai.lua +++ b/config/common/nvim/lua/plugins/monokai.lua @@ -1,15 +1,10 @@ return { - { - "loctvl842/monokai-pro.nvim", - priority = 1000, - opts = { + "loctvl842/monokai-pro.nvim", + priority = 10000, + config = function() + require("monokai-pro").setup({ filter = "classic", - }, - }, - { - "LazyVim/LazyVim", - opts = { - colorscheme = "monokai-pro", - }, - }, + }) + vim.cmd.colorscheme("monokai-pro") + end, } diff --git a/config/common/nvim/lua/plugins/noice.lua b/config/common/nvim/lua/plugins/noice.lua new file mode 100644 index 0000000..e4a65b5 --- /dev/null +++ b/config/common/nvim/lua/plugins/noice.lua @@ -0,0 +1,27 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { + "MunifTanjim/nui.nvim", + }, + config = function() + require("noice").setup({ + lsp = { + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + messages = { + view_search = false, + }, + presets = { + bottom_search = true, + command_palette = true, + long_message_to_split = true, + lsp_doc_border = true, + }, + }) + end, +} diff --git a/config/common/nvim/lua/plugins/snacks.lua b/config/common/nvim/lua/plugins/snacks.lua index 8c38215..2d3fa53 100644 --- a/config/common/nvim/lua/plugins/snacks.lua +++ b/config/common/nvim/lua/plugins/snacks.lua @@ -1,28 +1,47 @@ return { "folke/snacks.nvim", - opts = { - dashboard = { enabled = false }, - }, - keys = { - { - "n", - function() - vim.cmd("set number!") - vim.cmd('execute "set signcolumn=" . (&signcolumn == "yes" ? "no" : "yes")') - if Snacks.indent.enabled then - Snacks.indent.disable() - else - Snacks.indent.enable() - end - end, - desc = "Toggle Decorations", - }, - { - "e", - function() - Snacks.explorer() - end, - desc = "File Explorer", - }, - }, + priority = 1000, + lazy = false, + config = function() + require("snacks").setup({ + animate = { enabled = false }, + bigfile = { enabled = false }, + bufdelete = { enabled = true }, + dashboard = { enabled = false }, + debug = { enabled = false }, + dim = { enabled = false }, + explorer = { enabled = true, replace_netrw = true }, + git = { enabled = false }, + gitbrowse = { enabled = false }, + image = { enabled = false }, + indent = { enabled = true }, + input = { enabled = true }, + layout = { enabled = false }, + lazygit = { enabled = false }, + notifier = { enabled = true }, + notify = { enabled = true }, + picker = { + enabled = true, + files = { + hidden = true, + ignored = true, + }, + hidden = true, + ignored = true, + }, + profiler = { enabled = false }, + quickfile = { enabled = true }, + rename = { enabled = false }, + scope = { enabled = true }, + scratch = { enabled = false }, + scroll = { enabled = true }, + statuscolumn = { enabled = false }, + terminal = { enabled = true }, + toggle = { enabled = false }, + util = { enabled = true }, + win = { enabled = false }, + words = { enabled = false }, + zen = { enabled = false }, + }) + end, } diff --git a/config/common/nvim/lua/plugins/treesitter.lua b/config/common/nvim/lua/plugins/treesitter.lua index ac75221..394fa1f 100644 --- a/config/common/nvim/lua/plugins/treesitter.lua +++ b/config/common/nvim/lua/plugins/treesitter.lua @@ -1,18 +1,25 @@ return { "nvim-treesitter/nvim-treesitter", - opts = { - ensure_installed = { - "bash", - "diff", - "gotmpl", - "helm", - "json", - "lua", - "markdown", - "markdown_inline", - "python", - "terraform", - "vim", - }, - }, + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "bash", + "diff", + "gotmpl", + "hcl", + "helm", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "regex", + "terraform", + "vim", + }, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, } diff --git a/config/common/nvim/lua/plugins/which-key.lua b/config/common/nvim/lua/plugins/which-key.lua index 47460fe..c9f05f8 100644 --- a/config/common/nvim/lua/plugins/which-key.lua +++ b/config/common/nvim/lua/plugins/which-key.lua @@ -1,35 +1,36 @@ return { "folke/which-key.nvim", event = "VeryLazy", - opts_extend = { "spec" }, - opts = { - preset = "helix", - icons = { - mappings = false, - }, - defaults = {}, - spec = { - { - mode = { "n", "v" }, - { - "b", - group = "buffer", - expand = function() - return require("which-key.extras").expand.buf() - end, - }, - { "", group = "tabs", hidden = true }, - { "d", group = "debug", hidden = true }, - { "dp", group = "profiler", hidden = true }, - { "gh", group = "hunks", hidden = true }, - { "q", group = "quit/session", hidden = true }, - { "s", group = "search", hidden = true }, - { "t", hidden = true }, - { "u", group = "ui", hidden = true }, - { "w", hidden = true }, - { "x", group = "diagnostics/quickfix", hidden = true }, - { "gx", desc = "Open with system app", hidden = true }, + config = function() + require("which-key").setup({ + preset = "helix", + delay = 300, + icons = { + rules = false, + breadcrumb = " ", + separator = "󱦰 ", + group = "󰹍 ", }, - }, - }, + plugins = { + spelling = { + enabled = false, + }, + }, + win = { + height = { + max = math.huge, + }, + }, + spec = { + { + mode = { "n", "v" }, + { "b", group = "buffer" }, + { "c", group = "code" }, + { "f", group = "find" }, + { "h", group = "history" }, + { "u", group = "ui" }, + }, + }, + }) + end, }