From fdd284d6cb8abda78dead7a4902ba01dfc91bcbe Mon Sep 17 00:00:00 2001 From: Pratik Tripathy Date: Mon, 1 Sep 2025 12:42:21 +0530 Subject: [PATCH] fix(nvim): VIM config loading on Windows fixed - Made the Vim configuration file fetch work on both *nix & Windows - Docs: Improved comments on init.lua - Refactor: Removed unused variables from mini.statusbar config --- common/.config/nvim/init.lua | 10 +++++----- common/.config/nvim/lua/config/keymaps.lua | 4 +++- common/.config/nvim/lua/config/options.lua | 8 +++----- common/.config/nvim/lua/plugins/utility-plugs.lua | 3 +-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/common/.config/nvim/init.lua b/common/.config/nvim/init.lua index 619f9c7..706178a 100644 --- a/common/.config/nvim/init.lua +++ b/common/.config/nvim/init.lua @@ -8,23 +8,23 @@ -- Select last visual selection -> gv -- Copy visual section to a line number -> :'<,'>t15 (copies To line 15) --- Load keymaps & options --- Order matters +-- Load keymaps & options: Order matters require("config.options") require("config.keymaps") require("core.lazy") require("core.lsp") require("config.autocmd") --- NOTE: Tools needed for this Nvim config to work +-- NOTE: External Tools needed for this Nvim config to work -- jsregexp -- rust-analyzer, rustc, cargo (rustacean) -- OS Installs: -- general: curl, gzip, unzip, git, fd-find, ripgrep, fzf, tree-sitter -- tools: ImageMagick, xclip, xsel, ghostscript --- lsp: codespell, nodejs-bash-language-server, html, hadolint, lua, luajit, shellcheck, shfmt, trivy, ts_ls, pylint, stylua, shellcheck +-- lsp: codespell, nodejs-bash-language-server, hadolint, lua, luajit, shellcheck, shfmt, trivy, pylint, stylua -- Brew: -- tools: lazygit --- lsp: dockerfile-language-server, markdown-toc, markdownlint-cli, marksman, prettier, prettierd, python-lsp-server, shellharden, taplo, typescript-language-server, vue-language-server, yaml-language-server, yamlfmt +-- lsp: dockerfile-language-server, markdown-toc, markdownlint-cli, marksman, prettier, prettierd, python-lsp-server, +-- shellharden, taplo, typescript-language-server, vue-language-server, yaml-language-server, yamlfmt -- Mason: When they aren't found on OS or Brew -- codelldb, css-lsp, docker-compose-language-service, html-lsp, json-lsp, sqlls diff --git a/common/.config/nvim/lua/config/keymaps.lua b/common/.config/nvim/lua/config/keymaps.lua index 81d3e18..d98fc82 100644 --- a/common/.config/nvim/lua/config/keymaps.lua +++ b/common/.config/nvim/lua/config/keymaps.lua @@ -1,5 +1,7 @@ -- Load Keybindings from VIM -local vim_mappings = os.getenv("HOME") .. "/.vim/key_maps.vim" +local sep = package.config:sub(1, 1) +local home = os.getenv("HOME") or os.getenv("USERPROFILE") +local vim_mappings = home .. sep .. ".vim" .. sep .. "key_maps.vim" local util = require("config.util") if vim.loop.fs_stat(vim_mappings) and util.is_not_vscode() then vim.cmd("source " .. vim_mappings) diff --git a/common/.config/nvim/lua/config/options.lua b/common/.config/nvim/lua/config/options.lua index 1b668d2..c3c837b 100644 --- a/common/.config/nvim/lua/config/options.lua +++ b/common/.config/nvim/lua/config/options.lua @@ -1,9 +1,7 @@ --- Options available as-is: VimScript, --- Options starting with nvim_: lua --- To set VimScript options in lua: use either vim.opt (:help vim.opt) - -- Load configs from VIM -local vim_configs = os.getenv("HOME") .. "/.vim/configs.vim" +local sep = package.config:sub(1, 1) +local home = os.getenv("HOME") or os.getenv("USERPROFILE") +local vim_configs = home .. sep .. ".vim" .. sep .. "configs.vim" if vim.loop.fs_stat(vim_configs) then vim.cmd("source " .. vim_configs) end diff --git a/common/.config/nvim/lua/plugins/utility-plugs.lua b/common/.config/nvim/lua/plugins/utility-plugs.lua index 56f3f98..7070913 100644 --- a/common/.config/nvim/lua/plugins/utility-plugs.lua +++ b/common/.config/nvim/lua/plugins/utility-plugs.lua @@ -75,14 +75,13 @@ return { trunc_width = 75, signs = config.icons.diagnostics, }) - local lsp = MiniStatusline.section_lsp({ trunc_width = 75 }) local filename = MiniStatusline.section_filename({ trunc_width = 140 }) local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120, show_encoding = false }) local search = MiniStatusline.section_searchcount({ trunc_width = 40 }) local location = MiniStatusline.section_location({ trunc_width = 75 }) local stats = reading_stats() - -- Mode | Branch, diff | Diagnostics | ... | FileType | FileName | Rows/Columns + -- Mode | Branch, diff | Diagnostics | ... | FileName | FileType | Rows/Columns return MiniStatusline.combine_groups({ { hl = mode_hl, strings = { mode } }, { hl = "MiniStatuslineDevinfo", strings = { git, diff } },