From 03d9b7a52d43a9c7dc890fd1069bd1ddba722772 Mon Sep 17 00:00:00 2001 From: Gamunu Balagalla Date: Sun, 21 Dec 2025 23:37:54 +0530 Subject: [PATCH] fix: add extra linters and update shortcuts Signed-off-by: Gamunu Balagalla --- .github/workflows/ci.yml | 40 ++++++++++++++--------------- .github/workflows/release.yml | 2 +- .luacheckrc | 5 ++++ .pre-commit-config.yaml | 18 +++++++++++++ Makefile | 2 +- README.md | 6 ++--- doc/git.md | 1 - init.lua | 3 +++ lazyvim.json | 2 +- lua/coldboot/plugins/coc_ale.lua | 5 ++++ lua/coldboot/plugins/init.lua | 44 +++++++++++++++++++++++++++++--- lua/coldboot/plugins/mason.lua | 15 +++++++++++ 12 files changed, 113 insertions(+), 30 deletions(-) create mode 100644 .luacheckrc create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c70feb2..f19e606 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,76 +10,76 @@ jobs: format-check: runs-on: ubuntu-latest name: Format Check - + steps: - uses: actions/checkout@v6 - + - name: Setup Rust uses: actions-rs/toolchain@v1 with: toolchain: stable profile: minimal override: true - + - name: Install stylua run: cargo install stylua - + - name: Check Lua formatting run: make format-check - + lint: runs-on: ubuntu-latest name: Lint - + steps: - uses: actions/checkout@v6 - + - name: Setup Lua uses: leafo/gh-actions-lua@v12 with: luaVersion: "5.1" - + - name: Setup Luarocks uses: leafo/gh-actions-luarocks@v6 - + - name: Install luacheck run: luarocks install luacheck - + - name: Lint Lua files run: make lint - + syntax-check: runs-on: ubuntu-latest name: Syntax Check - + steps: - uses: actions/checkout@v6 - + - name: Setup Lua uses: leafo/gh-actions-lua@v12 with: luaVersion: "5.1" - + - name: Check Lua syntax run: make check - + neovim-test: runs-on: ubuntu-latest name: Neovim Config Test - + steps: - uses: actions/checkout@v6 - + - name: Setup Neovim uses: rhysd/action-setup-vim@v1 with: neovim: true version: stable - + - name: Test Neovim configuration run: | # Basic syntax check nvim --headless -c "lua print('Configuration loaded successfully')" -c "qa!" - + # Check for any immediate errors in plugin loading - timeout 30s nvim --headless -c "lua require('lazy').setup({})" -c "qa!" || echo "Plugin setup test completed" \ No newline at end of file + timeout 30s nvim --headless -c "lua require('lazy').setup({})" -c "qa!" || echo "Plugin setup test completed" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fcdcfcf..a8bb23a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,4 +19,4 @@ jobs: # Optional: package name (defaults to repository name) package-name: nvim-config # Optional: changelog sections - changelog-sections: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"style","section":"Styles","hidden":false},{"type":"refactor","section":"Code Refactoring","hidden":false},{"type":"test","section":"Tests","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]' \ No newline at end of file + changelog-sections: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"style","section":"Styles","hidden":false},{"type":"refactor","section":"Code Refactoring","hidden":false},{"type":"test","section":"Tests","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]' diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..fa47bc2 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,5 @@ +std = "luajit" +globals = { + "vim", +} +max_line_length = 160 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7b4a982 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-merge-conflict + - id: check-toml + - id: check-yaml + - id: mixed-line-ending + - repo: local + hooks: + - id: stylua + name: stylua + entry: stylua + language: system + types: [lua] + args: [--config-path, .stylua.toml] diff --git a/Makefile b/Makefile index c69fe14..4a7808f 100644 --- a/Makefile +++ b/Makefile @@ -59,4 +59,4 @@ format-check: stylua --check . || (echo "Files need formatting. Run 'make format' to fix." && exit 1); \ else \ echo "stylua not found, skipping format check"; \ - fi \ No newline at end of file + fi diff --git a/README.md b/README.md index e976922..1262eb8 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Distribution Alternatives: ### Installation -> **NOTE** +> **NOTE** > [Backup](#FAQ) your previous configuration (if any exists) Requirements: @@ -46,7 +46,7 @@ git clone https://github.com/gamunu/coldboot.nvim.git "${XDG_CONFIG_HOME:-$HOME/ ``` # on Windows -git clone https://github.com/gamunu/coldboot.nvim.git %userprofile%\AppData\Local\nvim\ +git clone https://github.com/gamunu/coldboot.nvim.git %userprofile%\AppData\Local\nvim\ ``` ### Post Installation @@ -61,7 +61,7 @@ nvim --headless "+Lazy! sync" +qa [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo (so that you have your own copy that you can modify) and then installing you can install to your machine using the methods above. -> **NOTE** +> **NOTE** > Your fork's url will be something like this: `https://github.com//coldboot.nvim.git` ### Configuration And Extension diff --git a/doc/git.md b/doc/git.md index 7ae6946..2f8cd2c 100644 --- a/doc/git.md +++ b/doc/git.md @@ -59,4 +59,3 @@ After resolving: - Undo a conflict choice you just applied: `u` - Discard file/hunk from Neogit status: `x` - Abort an in-progress rebase/merge: use the `r`/`m` popup actions (Neogit will show “abort/continue” options when applicable). - diff --git a/init.lua b/init.lua index c1e6449..f28b0c4 100644 --- a/init.lua +++ b/init.lua @@ -112,6 +112,9 @@ require('lazy').setup({ -- See `:help vim.o` -- NOTE: You can change these options as you wish! +-- Prepend mason bin to PATH +vim.env.PATH = vim.fn.stdpath 'data' .. '/mason/bin' .. ':' .. vim.env.PATH + -- Set highlight on search vim.o.hlsearch = false diff --git a/lazyvim.json b/lazyvim.json index ff6a139..0d43824 100644 --- a/lazyvim.json +++ b/lazyvim.json @@ -6,4 +6,4 @@ "NEWS.md": "2123" }, "version": 2 -} \ No newline at end of file +} diff --git a/lua/coldboot/plugins/coc_ale.lua b/lua/coldboot/plugins/coc_ale.lua index 267b199..8b05e29 100644 --- a/lua/coldboot/plugins/coc_ale.lua +++ b/lua/coldboot/plugins/coc_ale.lua @@ -11,6 +11,8 @@ return { 'coc-pyright', 'coc-go', 'coc-rust-analyzer', + 'coc-docker', + 'coc-terraform', } local map = function(mode, lhs, rhs, desc, opts) @@ -144,6 +146,7 @@ return { typescriptreact = { 'eslint', 'prettier' }, rust = { 'rustfmt' }, python = { 'isort', 'black' }, + terraform = { 'terraform' }, } vim.g.ale_linters = { @@ -154,6 +157,8 @@ return { typescriptreact = { 'eslint' }, rust = { 'clippy' }, python = { 'ruff' }, + dockerfile = { 'hadolint' }, + terraform = { 'tflint' }, } local format_is_enabled = vim.g.ale_fix_on_save == 1 diff --git a/lua/coldboot/plugins/init.lua b/lua/coldboot/plugins/init.lua index 9e6dfa6..40d6033 100644 --- a/lua/coldboot/plugins/init.lua +++ b/lua/coldboot/plugins/init.lua @@ -32,7 +32,42 @@ return { -- Git related plugins { 'gD', 'DiffviewClose', desc = '[G]it [D]iff close' }, { 'gh', 'DiffviewFileHistory', desc = '[G]it file [H]istory' }, }, - opts = {}, + opts = function() + local actions = require 'diffview.actions' + local fold_descs = { + za = 'Toggle fold', + zA = 'Toggle fold recursively', + ze = 'Eliminate all folds', + zE = 'Eliminate all folds', + zo = 'Open fold', + zc = 'Close fold', + zO = 'Open fold recursively', + zC = 'Close fold recursively', + zr = 'Reduce folding', + zm = 'Fold more', + zR = 'Open all folds', + zM = 'Close all folds', + zv = 'Open folds to reveal cursor', + zx = 'Reapply foldlevel and open to cursor', + zX = 'Reapply foldlevel', + zn = 'Disable folding', + zN = 'Enable folding', + zi = 'Toggle foldenable', + } + + local fold_keymaps = {} + for _, map in ipairs(actions.compat.fold_cmds) do + local mode, lhs, rhs = map[1], map[2], map[3] + local desc = fold_descs[lhs] or 'Fold command' + fold_keymaps[#fold_keymaps + 1] = { mode, lhs, rhs, { desc = desc } } + end + + return { + keymaps = { + view = fold_keymaps, + }, + } + end, }, 'tpope/vim-sleuth', -- NOTE: This is where your plugins related to LSP can be installed. -- The configuration is done below. Search for lspconfig to find it below. @@ -102,10 +137,13 @@ return { -- Git related plugins }, }, { - 'ellisonleao/gruvbox.nvim', + 'sainnhe/gruvbox-material', + lazy = false, priority = 1000, config = function() - vim.cmd [[colorscheme gruvbox]] + vim.g.gruvbox_material_enable_italic = true + vim.g.ruvbox_material_background = 'hard' + vim.cmd.colorscheme 'gruvbox-material' end, }, { diff --git a/lua/coldboot/plugins/mason.lua b/lua/coldboot/plugins/mason.lua index bd1b5cb..9374134 100644 --- a/lua/coldboot/plugins/mason.lua +++ b/lua/coldboot/plugins/mason.lua @@ -22,9 +22,24 @@ return { -- Keep this list small: just the server binaries Coc commonly uses. local ensure_installed = { + -- LSP Servers 'gopls', 'rust-analyzer', 'pyright', + 'typescript-language-server', + 'eslint-lsp', + 'dockerfile-language-server', + 'terraform-ls', + + -- Linters & Formatters + 'black', + 'isort', + 'ruff', + 'goimports', + 'golangci-lint', + 'prettier', + 'hadolint', + 'tflint', } local function install(pkg_name)