From fd744757afc96696c3f04638bafa68b9f7ab3bab Mon Sep 17 00:00:00 2001 From: Daniel Bengl Date: Wed, 24 Sep 2025 16:37:33 +0200 Subject: [PATCH 1/3] Linting changes --- .config/nvim/init.lua | 18 +- .config/nvim/lua/plugins/autopairs.lua | 6 +- .config/nvim/lua/plugins/autosession.lua | 18 +- .config/nvim/lua/plugins/boole.lua | 38 ++-- .config/nvim/lua/plugins/bufexplorer.lua | 4 +- .../nvim/lua/plugins/cellular_automaton.lua | 2 +- .config/nvim/lua/plugins/colorscheme.lua | 4 +- .config/nvim/lua/plugins/comment.lua | 10 +- .config/nvim/lua/plugins/conform.lua | 72 +++--- .config/nvim/lua/plugins/copilot.lua | 10 +- .config/nvim/lua/plugins/diffview.lua | 14 +- .config/nvim/lua/plugins/endpoint.lua | 62 +++--- .config/nvim/lua/plugins/flash.lua | 24 +- .config/nvim/lua/plugins/gitlinker.lua | 62 +++--- .config/nvim/lua/plugins/gitsigns.lua | 166 +++++++------- .config/nvim/lua/plugins/gradlew.lua | 28 +-- .config/nvim/lua/plugins/grug.lua | 54 ++--- .config/nvim/lua/plugins/harpoon.lua | 96 ++++---- .config/nvim/lua/plugins/lualine.lua | 206 +++++++++--------- .config/nvim/lua/plugins/markdown.lua | 30 +-- .config/nvim/lua/plugins/maximize.lua | 16 +- .config/nvim/lua/plugins/mini-cursorword.lua | 16 +- .config/nvim/lua/plugins/neogit.lua | 28 +-- .config/nvim/lua/plugins/neotest.lua | 16 +- .../lua/plugins/nvim-asciidoc-preview.lua | 6 +- .config/nvim/lua/plugins/nvim-cmp.lua | 176 +++++++-------- .config/nvim/lua/plugins/nvim-lspconfig.lua | 129 ++++++----- .config/nvim/lua/plugins/nvim-surround.lua | 12 +- .../lua/plugins/nvim-treesitter-endwise.lua | 18 +- .../plugins/nvim-treesitter-textobjects.lua | 120 +++++----- .config/nvim/lua/plugins/nvim-treesitter.lua | 68 +++--- .config/nvim/lua/plugins/nvim-ts-autotag.lua | 42 ++-- .config/nvim/lua/plugins/oil.lua | 116 +++++----- .config/nvim/lua/plugins/plantuml.lua | 12 +- .config/nvim/lua/plugins/refactoring.lua | 22 +- .config/nvim/lua/plugins/telescope.lua | 39 ++-- .config/nvim/lua/plugins/text-case.lua | 34 +-- .config/nvim/lua/plugins/trouble.lua | 70 +++--- .config/nvim/lua/plugins/undotree.lua | 54 ++--- .config/nvim/lua/plugins/vim-case-convert.lua | 4 +- .config/nvim/lua/plugins/vim-fetch.lua | 2 +- .config/nvim/lua/plugins/vim-fugitive.lua | 22 +- .config/nvim/lua/plugins/vim-rails.lua | 4 +- .../nvim/lua/plugins/vim-tmux-navigator.lua | 32 +-- .config/nvim/lua/plugins/visual-multi.lua | 4 +- .config/nvim/lua/plugins/yaml.lua | 2 +- .config/nvim/lua/plugins/zj-navigator.lua | 20 +- .config/nvim/lua/settings.lua | 34 +-- .config/nvim/lua/theme.lua | 22 +- .config/nvim/lua/util.lua | 70 +++--- .config/nvim/stylua.toml | 6 + .config/nvim/vscode.lua | 40 ++-- .github/workflows/format.yml | 69 ++++++ bin/fastcheck | 44 ++++ change_theme.sh | 42 ++-- create_linux_symlinx.sh | 1 - neovim/fastcheck | 19 ++ scripts/branch-checkout.ts | 12 +- scripts/clone_praktikum.sh | 2 +- scripts/copy-ticket-number.ts | 25 ++- scripts/create_executable_script.sh | 10 +- scripts/fastcheck | 39 ++++ scripts/format_url.sh | 16 +- scripts/get-pr-template.ts | 29 +-- scripts/git-smart-log.ts | 76 +++---- scripts/index.ts | 16 +- scripts/open-repo-in-browser.ts | 27 ++- scripts/open-ticket-in-browser.ts | 28 +-- scripts/pretty-pulls.ts | 66 +++--- scripts/simplecov_parser.rb | 90 ++++---- scripts/startup-communications.sh | 1 - scripts/zip_split.sh | 11 +- 72 files changed, 1510 insertions(+), 1293 deletions(-) create mode 100644 .config/nvim/stylua.toml create mode 100644 .github/workflows/format.yml create mode 100755 bin/fastcheck create mode 100755 neovim/fastcheck create mode 100755 scripts/fastcheck diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index ae30fde..4943379 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -3,20 +3,20 @@ require("util") local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", - lazypath, - }) + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) end vim.opt.rtp:prepend(lazypath) local plugins = { - { import = "plugins" }, + { import = "plugins" }, } local opts = { defaults = { lazy = true }, change_detection = { notify = false } } diff --git a/.config/nvim/lua/plugins/autopairs.lua b/.config/nvim/lua/plugins/autopairs.lua index 6378d47..b83282d 100644 --- a/.config/nvim/lua/plugins/autopairs.lua +++ b/.config/nvim/lua/plugins/autopairs.lua @@ -1,5 +1,5 @@ return { - "windwp/nvim-autopairs", - event = "InsertEnter", - config = true, + "windwp/nvim-autopairs", + event = "InsertEnter", + config = true, } diff --git a/.config/nvim/lua/plugins/autosession.lua b/.config/nvim/lua/plugins/autosession.lua index 7f6fe80..a7dc9b6 100644 --- a/.config/nvim/lua/plugins/autosession.lua +++ b/.config/nvim/lua/plugins/autosession.lua @@ -1,11 +1,11 @@ return { - "rmagatti/auto-session", - lazy = false, - dependencies = { - "nvim-telescope/telescope.nvim", - }, - opts = {}, - keys = { - { "", "SessionDelete", desc = "Delete session" }, - }, + "rmagatti/auto-session", + lazy = false, + dependencies = { + "nvim-telescope/telescope.nvim", + }, + opts = {}, + keys = { + { "", "SessionDelete", desc = "Delete session" }, + }, } diff --git a/.config/nvim/lua/plugins/boole.lua b/.config/nvim/lua/plugins/boole.lua index 7d37e72..919e18e 100644 --- a/.config/nvim/lua/plugins/boole.lua +++ b/.config/nvim/lua/plugins/boole.lua @@ -1,21 +1,21 @@ return { - "nat-418/boole.nvim", - event = { "BufReadPre", "BufNewFile" }, - config = function() - require("boole").setup({ - mappings = { - increment = "", - decrement = "", - }, - additions = { - { "Foo", "Bar", "Baz", "Qux", "Quux" }, - { "light", "dark" }, - { "if", "unless" }, - { "true", "false" }, - { "&&", "||" }, - { "private", "public", "protected" }, - { "const", "let" }, - }, - }) - end, + "nat-418/boole.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("boole").setup({ + mappings = { + increment = "", + decrement = "", + }, + additions = { + { "Foo", "Bar", "Baz", "Qux", "Quux" }, + { "light", "dark" }, + { "if", "unless" }, + { "true", "false" }, + { "&&", "||" }, + { "private", "public", "protected" }, + { "const", "let" }, + }, + }) + end, } diff --git a/.config/nvim/lua/plugins/bufexplorer.lua b/.config/nvim/lua/plugins/bufexplorer.lua index 9653a92..fe14cfa 100644 --- a/.config/nvim/lua/plugins/bufexplorer.lua +++ b/.config/nvim/lua/plugins/bufexplorer.lua @@ -1,4 +1,4 @@ return { - "jlanzarotta/bufexplorer", - lazy = false, + "jlanzarotta/bufexplorer", + lazy = false, } diff --git a/.config/nvim/lua/plugins/cellular_automaton.lua b/.config/nvim/lua/plugins/cellular_automaton.lua index 1e21b5b..cf86bc2 100644 --- a/.config/nvim/lua/plugins/cellular_automaton.lua +++ b/.config/nvim/lua/plugins/cellular_automaton.lua @@ -1,4 +1,4 @@ return { "Eandrju/cellular-automaton.nvim", - lazy = false + lazy = false, } diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua index 39a41ef..677dfeb 100644 --- a/.config/nvim/lua/plugins/colorscheme.lua +++ b/.config/nvim/lua/plugins/colorscheme.lua @@ -15,6 +15,6 @@ return { priority = 1000, }, { "ellisonleao/gruvbox.nvim", priority = 1000, config = { - transparent_mode = true, - } } + transparent_mode = true, + } }, } diff --git a/.config/nvim/lua/plugins/comment.lua b/.config/nvim/lua/plugins/comment.lua index c833f67..2254763 100644 --- a/.config/nvim/lua/plugins/comment.lua +++ b/.config/nvim/lua/plugins/comment.lua @@ -1,7 +1,7 @@ return { - "numToStr/Comment.nvim", - opts = {}, - keys = { - { "gcc", "CommentToggle", desc = "Comment" }, - }, + "numToStr/Comment.nvim", + opts = {}, + keys = { + { "gcc", "CommentToggle", desc = "Comment" }, + }, } diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua index 2c67e12..4ca3b67 100644 --- a/.config/nvim/lua/plugins/conform.lua +++ b/.config/nvim/lua/plugins/conform.lua @@ -1,38 +1,38 @@ return { - -- "stevearc/conform.nvim", - -- event = { "BufReadPre", "BufNewFile" }, - -- config = function() - -- local conform = require("conform") - -- - -- conform.setup({ - -- formatters_by_ft = { - -- javascript = { "prettier" }, - -- typescript = { "prettier" }, - -- javascriptreact = { "prettier" }, - -- typescriptreact = { "prettier" }, - -- svelte = { "prettier" }, - -- css = { "prettier" }, - -- html = { "prettier" }, - -- json = { "prettier" }, - -- java = { "prettier" }, - -- yaml = { "prettier" }, - -- markdown = { "prettier" }, - -- graphql = { "prettier" }, - -- lua = { "stylua" }, - -- }, - -- format_on_save = { - -- lsp_fallback = true, - -- async = false, - -- timeout_ms = 100, - -- }, - -- }) - -- - -- vim.keymap.set({ "n", "v" }, "mp", function() - -- conform.format({ - -- lsp_fallback = true, - -- async = false, - -- timeout_ms = 500, - -- }) - -- end, { desc = "Format file or range (in visual mode)" }) - -- end, + -- "stevearc/conform.nvim", + -- event = { "BufReadPre", "BufNewFile" }, + -- config = function() + -- local conform = require("conform") + -- + -- conform.setup({ + -- formatters_by_ft = { + -- javascript = { "prettier" }, + -- typescript = { "prettier" }, + -- javascriptreact = { "prettier" }, + -- typescriptreact = { "prettier" }, + -- svelte = { "prettier" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + -- json = { "prettier" }, + -- java = { "prettier" }, + -- yaml = { "prettier" }, + -- markdown = { "prettier" }, + -- graphql = { "prettier" }, + -- lua = { "stylua" }, + -- }, + -- format_on_save = { + -- lsp_fallback = true, + -- async = false, + -- timeout_ms = 100, + -- }, + -- }) + -- + -- vim.keymap.set({ "n", "v" }, "mp", function() + -- conform.format({ + -- lsp_fallback = true, + -- async = false, + -- timeout_ms = 500, + -- }) + -- end, { desc = "Format file or range (in visual mode)" }) + -- end, } diff --git a/.config/nvim/lua/plugins/copilot.lua b/.config/nvim/lua/plugins/copilot.lua index 5c8d139..14e55eb 100644 --- a/.config/nvim/lua/plugins/copilot.lua +++ b/.config/nvim/lua/plugins/copilot.lua @@ -1,7 +1,7 @@ return { - -- "github/copilot.vim", - -- event = "BufRead", - -- commands = { - -- "Copilot" - -- } + -- "github/copilot.vim", + -- event = "BufRead", + -- commands = { + -- "Copilot" + -- } } diff --git a/.config/nvim/lua/plugins/diffview.lua b/.config/nvim/lua/plugins/diffview.lua index b74a05a..8bf3783 100644 --- a/.config/nvim/lua/plugins/diffview.lua +++ b/.config/nvim/lua/plugins/diffview.lua @@ -1,9 +1,9 @@ return { - "sindrets/diffview.nvim", - cmd = { - "DiffviewOpen", - }, - keys = { - { "do", "DiffviewOpen", desc = "Open diffview" }, - }, + "sindrets/diffview.nvim", + cmd = { + "DiffviewOpen", + }, + keys = { + { "do", "DiffviewOpen", desc = "Open diffview" }, + }, } diff --git a/.config/nvim/lua/plugins/endpoint.lua b/.config/nvim/lua/plugins/endpoint.lua index cbcd4a8..be02f46 100644 --- a/.config/nvim/lua/plugins/endpoint.lua +++ b/.config/nvim/lua/plugins/endpoint.lua @@ -8,65 +8,73 @@ return { require("endpoint").setup({ -- Framework configuration framework = "auto", -- "auto", "spring", "nestjs", "django", "rails", "express" - + -- Optional: Path-based framework overrides framework_paths = { ["/path/to/spring/project"] = "spring", ["/path/to/nestjs/project"] = "nestjs", }, - + -- Cache configuration cache_mode = "persistent", -- Cache mode: "session" or "persistent" debug = false, -- Enable debug logging - + ui = { - show_icons = true, -- Show method icons - show_method = true, -- Show method text (GET, POST, etc.) + show_icons = true, -- Show method icons + show_method = true, -- Show method text (GET, POST, etc.) use_nerd_font = false, -- Use nerd font glyphs instead of emojis - + -- Customize icons (requires show_icons = true) method_icons = { emoji = { - GET = "📥", - POST = "📤", - PUT = "✏️", + GET = "📥", + POST = "📤", + PUT = "✏️", DELETE = "🗑️", - PATCH = "🔧", + PATCH = "🔧", }, nerd_font = { - GET = "", -- download icon - POST = "", -- upload icon - PUT = "", -- edit icon + GET = "", -- download icon + POST = "", -- upload icon + PUT = "", -- edit icon DELETE = "", -- trash icon - PATCH = "", -- wrench icon + PATCH = "", -- wrench icon }, }, - + -- Customize colors method_colors = { - GET = "DiagnosticOk", -- Green - POST = "DiagnosticInfo", -- Blue - PUT = "DiagnosticWarn", -- Yellow - DELETE = "DiagnosticError", -- Red - PATCH = "DiagnosticHint", -- Purple + GET = "DiagnosticOk", -- Green + POST = "DiagnosticInfo", -- Blue + PUT = "DiagnosticWarn", -- Yellow + DELETE = "DiagnosticError", -- Red + PATCH = "DiagnosticHint", -- Purple }, - + -- Cache status UI customization cache_status_icons = { emoji = { - title = "🚀", success = "✅", error = "❌", - tree = "🌳", directory = "📁", file = "📄" + title = "🚀", + success = "✅", + error = "❌", + tree = "🌳", + directory = "📁", + file = "📄", }, nerd_font = { - title = "", success = "", error = "", - tree = "", directory = "", file = "" + title = "", + success = "", + error = "", + tree = "", + directory = "", + file = "", }, }, - + -- Cache status syntax highlighting cache_status_highlight = { title = "Special", - success = "DiagnosticOk", + success = "DiagnosticOk", error = "DiagnosticError", key = "Keyword", tree_method = "Function", diff --git a/.config/nvim/lua/plugins/flash.lua b/.config/nvim/lua/plugins/flash.lua index e7b2f08..4e7ab2a 100644 --- a/.config/nvim/lua/plugins/flash.lua +++ b/.config/nvim/lua/plugins/flash.lua @@ -1,14 +1,14 @@ return { - "folke/flash.nvim", - event = "VeryLazy", - keys = { - { - "s", - mode = { "n", "x", "o" }, - function() - require("flash").jump() - end, - desc = "Flash", - }, - }, + "folke/flash.nvim", + event = "VeryLazy", + keys = { + { + "s", + mode = { "n", "x", "o" }, + function() + require("flash").jump() + end, + desc = "Flash", + }, + }, } diff --git a/.config/nvim/lua/plugins/gitlinker.lua b/.config/nvim/lua/plugins/gitlinker.lua index 6a0bb22..6e8cb3c 100644 --- a/.config/nvim/lua/plugins/gitlinker.lua +++ b/.config/nvim/lua/plugins/gitlinker.lua @@ -1,33 +1,33 @@ return { - "ruifm/gitlinker.nvim", - lazy = false, - config = function() - require("gitlinker").setup({ - opts = { - remote = nil, -- force the use of a specific remote - -- adds current line nr in the url for normal mode - add_current_line_on_normal_mode = true, - -- callback for what to do with the url - action_callback = require("gitlinker.actions").copy_to_clipboard, - -- print the url after performing the action - print_url = true, - }, - callbacks = { - ["github.com"] = require("gitlinker.hosts").get_github_type_url, - ["gitlab.com"] = require("gitlinker.hosts").get_gitlab_type_url, - ["gitlab.nine.ch"] = require("gitlinker.hosts").get_gitlab_type_url, - ["try.gitea.io"] = require("gitlinker.hosts").get_gitea_type_url, - ["codeberg.org"] = require("gitlinker.hosts").get_gitea_type_url, - ["bitbucket.org"] = require("gitlinker.hosts").get_bitbucket_type_url, - ["try.gogs.io"] = require("gitlinker.hosts").get_gogs_type_url, - ["git.sr.ht"] = require("gitlinker.hosts").get_srht_type_url, - ["git.launchpad.net"] = require("gitlinker.hosts").get_launchpad_type_url, - ["repo.or.cz"] = require("gitlinker.hosts").get_repoorcz_type_url, - ["git.kernel.org"] = require("gitlinker.hosts").get_cgit_type_url, - ["git.savannah.gnu.org"] = require("gitlinker.hosts").get_cgit_type_url, - }, - -- default mapping to call url generation with action_callback - mappings = "oy", - }) - end, + "ruifm/gitlinker.nvim", + lazy = false, + config = function() + require("gitlinker").setup({ + opts = { + remote = nil, -- force the use of a specific remote + -- adds current line nr in the url for normal mode + add_current_line_on_normal_mode = true, + -- callback for what to do with the url + action_callback = require("gitlinker.actions").copy_to_clipboard, + -- print the url after performing the action + print_url = true, + }, + callbacks = { + ["github.com"] = require("gitlinker.hosts").get_github_type_url, + ["gitlab.com"] = require("gitlinker.hosts").get_gitlab_type_url, + ["gitlab.nine.ch"] = require("gitlinker.hosts").get_gitlab_type_url, + ["try.gitea.io"] = require("gitlinker.hosts").get_gitea_type_url, + ["codeberg.org"] = require("gitlinker.hosts").get_gitea_type_url, + ["bitbucket.org"] = require("gitlinker.hosts").get_bitbucket_type_url, + ["try.gogs.io"] = require("gitlinker.hosts").get_gogs_type_url, + ["git.sr.ht"] = require("gitlinker.hosts").get_srht_type_url, + ["git.launchpad.net"] = require("gitlinker.hosts").get_launchpad_type_url, + ["repo.or.cz"] = require("gitlinker.hosts").get_repoorcz_type_url, + ["git.kernel.org"] = require("gitlinker.hosts").get_cgit_type_url, + ["git.savannah.gnu.org"] = require("gitlinker.hosts").get_cgit_type_url, + }, + -- default mapping to call url generation with action_callback + mappings = "oy", + }) + end, } diff --git a/.config/nvim/lua/plugins/gitsigns.lua b/.config/nvim/lua/plugins/gitsigns.lua index 66d452d..5fb77dd 100644 --- a/.config/nvim/lua/plugins/gitsigns.lua +++ b/.config/nvim/lua/plugins/gitsigns.lua @@ -1,87 +1,87 @@ return { - "lewis6991/gitsigns.nvim", - lazy = false, - config = function() - require("gitsigns").setup({ - numhl = true, - attach_to_untracked = true, - update_debounce = 5, - on_attach = function(bufnr) - local gitsigns = require("gitsigns") - end, - }) - end, - keys = { - -- Navigation - { - "]c", - function() - if vim.wo.diff then - vim.cmd("normal! ]c") - else - require("gitsigns").next_hunk() - end - end, - mode = "n", - desc = "Next Git hunk", - }, - { - "[c", - function() - if vim.wo.diff then - vim.cmd("normal! [c") - else - require("gitsigns").prev_hunk() - end - end, - mode = "n", - desc = "Previous Git hunk", - }, + "lewis6991/gitsigns.nvim", + lazy = false, + config = function() + require("gitsigns").setup({ + numhl = true, + attach_to_untracked = true, + update_debounce = 5, + on_attach = function(bufnr) + local gitsigns = require("gitsigns") + end, + }) + end, + keys = { + -- Navigation + { + "]c", + function() + if vim.wo.diff then + vim.cmd("normal! ]c") + else + require("gitsigns").next_hunk() + end + end, + mode = "n", + desc = "Next Git hunk", + }, + { + "[c", + function() + if vim.wo.diff then + vim.cmd("normal! [c") + else + require("gitsigns").prev_hunk() + end + end, + mode = "n", + desc = "Previous Git hunk", + }, - -- Actions - { "hs", ":Gitsigns stage_hunk", mode = "n", desc = "Stage Hunk" }, - { "hr", ":Gitsigns reset_hunk", mode = "n", desc = "Reset Hunk" }, - { - "hs", - function() - require("gitsigns").stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end, - mode = "v", - desc = "Stage Hunk", - }, - { - "hr", - function() - require("gitsigns").reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end, - mode = "v", - desc = "Reset Hunk", - }, - { "hS", ":Gitsigns stage_buffer", mode = "n", desc = "Stage Buffer" }, - { "hu", ":Gitsigns undo_stage_hunk", mode = "n", desc = "Undo Stage Hunk" }, - { "hR", ":Gitsigns reset_buffer", mode = "n", desc = "Reset Buffer" }, - { "hp", ":Gitsigns preview_hunk", mode = "n", desc = "Preview Hunk" }, - { - "hb", - function() - require("gitsigns").blame_line({ full = true }) - end, - mode = "n", - desc = "Blame Line", - }, - { "tb", ":Gitsigns toggle_current_line_blame", mode = "n", desc = "Toggle Blame" }, - { "hd", ":Gitsigns diffthis", mode = "n", desc = "Diff This" }, - { - "hD", - function() - require("gitsigns").diffthis("~") - end, - mode = "n", - desc = "Diff This ~", - }, - { "td", ":Gitsigns toggle_deleted", mode = "n", desc = "Toggle Deleted" }, + -- Actions + { "hs", ":Gitsigns stage_hunk", mode = "n", desc = "Stage Hunk" }, + { "hr", ":Gitsigns reset_hunk", mode = "n", desc = "Reset Hunk" }, + { + "hs", + function() + require("gitsigns").stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, + mode = "v", + desc = "Stage Hunk", + }, + { + "hr", + function() + require("gitsigns").reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, + mode = "v", + desc = "Reset Hunk", + }, + { "hS", ":Gitsigns stage_buffer", mode = "n", desc = "Stage Buffer" }, + { "hu", ":Gitsigns undo_stage_hunk", mode = "n", desc = "Undo Stage Hunk" }, + { "hR", ":Gitsigns reset_buffer", mode = "n", desc = "Reset Buffer" }, + { "hp", ":Gitsigns preview_hunk", mode = "n", desc = "Preview Hunk" }, + { + "hb", + function() + require("gitsigns").blame_line({ full = true }) + end, + mode = "n", + desc = "Blame Line", + }, + { "tb", ":Gitsigns toggle_current_line_blame", mode = "n", desc = "Toggle Blame" }, + { "hd", ":Gitsigns diffthis", mode = "n", desc = "Diff This" }, + { + "hD", + function() + require("gitsigns").diffthis("~") + end, + mode = "n", + desc = "Diff This ~", + }, + { "td", ":Gitsigns toggle_deleted", mode = "n", desc = "Toggle Deleted" }, - -- Text object - { "ih", ":Gitsigns select_hunk", mode = { "o", "x" }, desc = "Select Hunk" }, - }, + -- Text object + { "ih", ":Gitsigns select_hunk", mode = { "o", "x" }, desc = "Select Hunk" }, + }, } diff --git a/.config/nvim/lua/plugins/gradlew.lua b/.config/nvim/lua/plugins/gradlew.lua index bdc3630..0f6f041 100644 --- a/.config/nvim/lua/plugins/gradlew.lua +++ b/.config/nvim/lua/plugins/gradlew.lua @@ -1,16 +1,16 @@ return { - "oclay1st/gradle.nvim", - cmd = { "Gradle", "GradleExec", "GradleInit" }, - dependencies = { - "nvim-lua/plenary.nvim", - "MunifTanjim/nui.nvim", - }, - opts = {}, -- options, see default configuration - keys = { { "G", "Gradle", desc = "Gradle" } }, - ft = { "java" }, - config = function() - require("gradle").setup({ - gradle_executable = "./gradlew", -- Example: gradle, ./gradlew or a path to Gradle executable - }) - end, + "oclay1st/gradle.nvim", + cmd = { "Gradle", "GradleExec", "GradleInit" }, + dependencies = { + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + }, + opts = {}, -- options, see default configuration + keys = { { "G", "Gradle", desc = "Gradle" } }, + ft = { "java" }, + config = function() + require("gradle").setup({ + gradle_executable = "./gradlew", -- Example: gradle, ./gradlew or a path to Gradle executable + }) + end, } diff --git a/.config/nvim/lua/plugins/grug.lua b/.config/nvim/lua/plugins/grug.lua index e90295d..52f68a4 100644 --- a/.config/nvim/lua/plugins/grug.lua +++ b/.config/nvim/lua/plugins/grug.lua @@ -1,29 +1,29 @@ return { - "MagicDuck/grug-far.nvim", - config = function() - require("grug-far").setup({}) - end, - keys = { - { - "", - function() - require("grug-far").open() - end, - desc = "Find and replace", - }, - { - "sp", - function() - require("grug-far").open() - end, - desc = "Find and replace", - }, - { - "sw", - function() - require("grug-far").open({ prefills = { search = vim.fn.expand("") } }) - end, - desc = "Find and replace word under cursor", - }, - }, + "MagicDuck/grug-far.nvim", + config = function() + require("grug-far").setup({}) + end, + keys = { + { + "", + function() + require("grug-far").open() + end, + desc = "Find and replace", + }, + { + "sp", + function() + require("grug-far").open() + end, + desc = "Find and replace", + }, + { + "sw", + function() + require("grug-far").open({ prefills = { search = vim.fn.expand("") } }) + end, + desc = "Find and replace word under cursor", + }, + }, } diff --git a/.config/nvim/lua/plugins/harpoon.lua b/.config/nvim/lua/plugins/harpoon.lua index e0395a2..05a3b47 100644 --- a/.config/nvim/lua/plugins/harpoon.lua +++ b/.config/nvim/lua/plugins/harpoon.lua @@ -1,52 +1,52 @@ return { - "ThePrimeagen/harpoon", - lazy = false, - branch = "harpoon2", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - local harpoon = require("harpoon") + "ThePrimeagen/harpoon", + lazy = false, + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local harpoon = require("harpoon") - harpoon:setup() + harpoon:setup() - vim.keymap.set("n", "a", function() - harpoon:list():add() - end, { noremap = true, silent = true, desc = "Add file to Harpoon" }) - vim.keymap.set("n", "e", function() - harpoon:list():remove() - end, { noremap = true, silent = true, desc = "Remove file from Harpoon" }) - -- vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu() end, { noremap = true, silent = true }) - vim.keymap.set("n", "1", function() - harpoon:list():select(1) - end, { noremap = true, silent = true, desc = "Select Harpoon file 1" }) - vim.keymap.set("n", "2", function() - harpoon:list():select(2) - end, { noremap = true, silent = true, desc = "Select Harpoon file 2" }) - vim.keymap.set("n", "3", function() - harpoon:list():select(3) - end, { noremap = true, silent = true, desc = "Select Harpoon file 3" }) - vim.keymap.set("n", "4", function() - harpoon:list():select(4) - end, { noremap = true, silent = true, desc = "Select Harpoon file 4" }) - vim.keymap.set("n", "5", function() - harpoon:list():select(5) - end, { noremap = true, silent = true, desc = "Select Harpoon file 5" }) - vim.keymap.set("n", "6", function() - harpoon:list():select(6) - end, { noremap = true, silent = true, desc = "Select Harpoon file 6" }) - vim.keymap.set("n", "7", function() - harpoon:list():select(7) - end, { noremap = true, silent = true, desc = "Select Harpoon file 7" }) - vim.keymap.set("n", "8", function() - harpoon:list():select(8) - end, { noremap = true, silent = true, desc = "Select Harpoon file 8" }) - vim.keymap.set("n", "9", function() - harpoon:list():select(9) - end, { noremap = true, silent = true, desc = "Select Harpoon file 9" }) - vim.keymap.set("n", "", function() - harpoon:list():next() - end, { desc = "Next Harpoon file" }) - vim.keymap.set("n", "", function() - harpoon:list():prev() - end, { desc = "Previous Harpoon file" }) - end, + vim.keymap.set("n", "a", function() + harpoon:list():add() + end, { noremap = true, silent = true, desc = "Add file to Harpoon" }) + vim.keymap.set("n", "e", function() + harpoon:list():remove() + end, { noremap = true, silent = true, desc = "Remove file from Harpoon" }) + -- vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu() end, { noremap = true, silent = true }) + vim.keymap.set("n", "1", function() + harpoon:list():select(1) + end, { noremap = true, silent = true, desc = "Select Harpoon file 1" }) + vim.keymap.set("n", "2", function() + harpoon:list():select(2) + end, { noremap = true, silent = true, desc = "Select Harpoon file 2" }) + vim.keymap.set("n", "3", function() + harpoon:list():select(3) + end, { noremap = true, silent = true, desc = "Select Harpoon file 3" }) + vim.keymap.set("n", "4", function() + harpoon:list():select(4) + end, { noremap = true, silent = true, desc = "Select Harpoon file 4" }) + vim.keymap.set("n", "5", function() + harpoon:list():select(5) + end, { noremap = true, silent = true, desc = "Select Harpoon file 5" }) + vim.keymap.set("n", "6", function() + harpoon:list():select(6) + end, { noremap = true, silent = true, desc = "Select Harpoon file 6" }) + vim.keymap.set("n", "7", function() + harpoon:list():select(7) + end, { noremap = true, silent = true, desc = "Select Harpoon file 7" }) + vim.keymap.set("n", "8", function() + harpoon:list():select(8) + end, { noremap = true, silent = true, desc = "Select Harpoon file 8" }) + vim.keymap.set("n", "9", function() + harpoon:list():select(9) + end, { noremap = true, silent = true, desc = "Select Harpoon file 9" }) + vim.keymap.set("n", "", function() + harpoon:list():next() + end, { desc = "Next Harpoon file" }) + vim.keymap.set("n", "", function() + harpoon:list():prev() + end, { desc = "Previous Harpoon file" }) + end, } diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index 45ed268..9c7fe0c 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua @@ -3,11 +3,10 @@ return { dependencies = { "nvim-tree/nvim-web-devicons" }, lazy = false, config = function() - -- Eviline config for lualine -- Author: shadmansaleh -- Credit: glepnir - local lualine = require('lualine') + local lualine = require("lualine") -- Color table for highlights -- stylua: ignore @@ -57,14 +56,14 @@ return { local conditions = { buffer_not_empty = function() - return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 + return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 end, hide_in_width = function() return vim.fn.winwidth(0) > 80 end, check_git_workspace = function() - local filepath = vim.fn.expand('%:p:h') - local gitdir = vim.fn.finddir('.git', filepath .. ';') + local filepath = vim.fn.expand("%:p:h") + local gitdir = vim.fn.finddir(".git", filepath .. ";") return gitdir and #gitdir > 0 and #gitdir < #filepath end, } @@ -73,8 +72,8 @@ return { local config = { options = { -- Disable sections and component separators - component_separators = '', - section_separators = '', + component_separators = "", + section_separators = "", theme = { -- We are going to use lualine_c an lualine_x as left and -- right section. Both are highlighted by c theme . So we @@ -116,18 +115,18 @@ return { table.insert(config.sections.lualine_x, component) end - ins_left { + ins_left({ function() - return '▊' + return "▊" end, color = { fg = colors.blue }, -- Sets highlighting of component padding = { left = 0, right = 1 }, -- We don't need space before this - } + }) - ins_left { + ins_left({ -- mode component function() - return '󰊠' + return "󰊠" end, color = function() -- auto change color according to neovims mode @@ -135,13 +134,13 @@ return { n = colors.red, i = colors.green, v = colors.blue, - [''] = colors.blue, + [""] = colors.blue, V = colors.blue, c = colors.magenta, no = colors.red, s = colors.orange, S = colors.orange, - [''] = colors.orange, + [""] = colors.orange, ic = colors.yellow, R = colors.violet, Rv = colors.violet, @@ -149,55 +148,55 @@ return { ce = colors.red, r = colors.cyan, rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.red, + ["r?"] = colors.cyan, + ["!"] = colors.red, t = colors.red, } return { fg = mode_color[vim.fn.mode()] } end, padding = { right = 1 }, - } + }) - ins_left { + ins_left({ -- filesize component - 'filesize', + "filesize", cond = conditions.buffer_not_empty, - } + }) - ins_left { - 'filename', + ins_left({ + "filename", cond = conditions.buffer_not_empty, - color = { fg = colors.magenta, gui = 'bold' }, - } + color = { fg = colors.magenta, gui = "bold" }, + }) - ins_left { 'location' } + ins_left({ "location" }) - ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } } + ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } }) - ins_left { - 'diagnostics', - sources = { 'nvim_diagnostic' }, - symbols = { error = ' ', warn = ' ', info = ' ' }, + ins_left({ + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { error = " ", warn = " ", info = " " }, diagnostics_color = { error = { fg = colors.red }, warn = { fg = colors.yellow }, info = { fg = colors.cyan }, }, - } + }) -- Insert mid section. You can make any number of sections in neovim :) -- for lualine it's any number greater then 2 - ins_left { + ins_left({ function() - return '%=' + return "%=" end, - } + }) - ins_left { + ins_left({ -- Lsp server name . function() - local msg = 'No Active Lsp' - local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 }) + local msg = "No Active Lsp" + local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) local clients = vim.lsp.get_clients() if next(clients) == nil then return msg @@ -210,97 +209,94 @@ return { end return msg end, - icon = ' LSP:', - color = { fg = '#ffffff', gui = 'bold' }, - } + icon = " LSP:", + color = { fg = "#ffffff", gui = "bold" }, + }) -- Add components to right sections - ins_right { - 'o:encoding', -- option component same as &encoding in viml + ins_right({ + "o:encoding", -- option component same as &encoding in viml fmt = string.upper, -- I'm not sure why it's upper case either ;) cond = conditions.hide_in_width, - color = { fg = colors.green, gui = 'bold' }, - } + color = { fg = colors.green, gui = "bold" }, + }) - ins_right { - 'fileformat', + ins_right({ + "fileformat", fmt = string.upper, icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh - color = { fg = colors.green, gui = 'bold' }, - } + color = { fg = colors.green, gui = "bold" }, + }) - ins_right { - 'branch', - icon = '', - color = { fg = colors.violet, gui = 'bold' }, - } + ins_right({ + "branch", + icon = "", + color = { fg = colors.violet, gui = "bold" }, + }) - ins_right { - 'diff', + ins_right({ + "diff", -- Is it me or the symbol for modified us really weird - symbols = { added = ' ', modified = '󰝤 ', removed = ' ' }, + symbols = { added = " ", modified = "󰝤 ", removed = " " }, diff_color = { added = { fg = colors.green }, modified = { fg = colors.orange }, removed = { fg = colors.red }, }, cond = conditions.hide_in_width, - } + }) - ins_right { + ins_right({ function() - return '▊' + return "▊" end, color = { fg = colors.blue }, padding = { left = 1 }, - } + }) -- Now don't forget to initialize lualine lualine.setup(config) - - - -- require("lualine").setup({ - -- options = { - -- icons_enabled = true, - -- -- theme = 'ayu_light', - -- component_separators = { left = "", right = "" }, - -- section_separators = { left = "", right = "" }, - -- disabled_filetypes = { - -- statusline = {}, - -- winbar = {}, - -- }, - -- ignore_focus = {}, - -- always_divide_middle = true, - -- always_show_tabline = true, - -- globalstatus = false, - -- refresh = { - -- statusline = 100, - -- tabline = 100, - -- winbar = 100, - -- }, - -- }, - -- sections = { - -- lualine_a = { "mode" }, - -- lualine_b = { "branch", "diff", "diagnostics" }, - -- lualine_c = { "filename" }, - -- lualine_x = { "fileformat", "filetype" }, - -- lualine_y = { "progress" }, - -- lualine_z = { "location" }, - -- }, - -- inactive_sections = { - -- lualine_a = {}, - -- lualine_b = {}, - -- lualine_c = { "filename" }, - -- lualine_x = { "location" }, - -- lualine_y = {}, - -- lualine_z = {}, - -- }, - -- tabline = {}, - -- winbar = {}, - -- inactive_winbar = {}, - -- extensions = {}, - -- }) - end, - } + -- options = { + -- icons_enabled = true, + -- -- theme = 'ayu_light', + -- component_separators = { left = "", right = "" }, + -- section_separators = { left = "", right = "" }, + -- disabled_filetypes = { + -- statusline = {}, + -- winbar = {}, + -- }, + -- ignore_focus = {}, + -- always_divide_middle = true, + -- always_show_tabline = true, + -- globalstatus = false, + -- refresh = { + -- statusline = 100, + -- tabline = 100, + -- winbar = 100, + -- }, + -- }, + -- sections = { + -- lualine_a = { "mode" }, + -- lualine_b = { "branch", "diff", "diagnostics" }, + -- lualine_c = { "filename" }, + -- lualine_x = { "fileformat", "filetype" }, + -- lualine_y = { "progress" }, + -- lualine_z = { "location" }, + -- }, + -- inactive_sections = { + -- lualine_a = {}, + -- lualine_b = {}, + -- lualine_c = { "filename" }, + -- lualine_x = { "location" }, + -- lualine_y = {}, + -- lualine_z = {}, + -- }, + -- tabline = {}, + -- winbar = {}, + -- inactive_winbar = {}, + -- extensions = {}, + -- }) + end, +} diff --git a/.config/nvim/lua/plugins/markdown.lua b/.config/nvim/lua/plugins/markdown.lua index fdcdc44..9b105d8 100644 --- a/.config/nvim/lua/plugins/markdown.lua +++ b/.config/nvim/lua/plugins/markdown.lua @@ -9,19 +9,19 @@ return { ft = { "markdown" }, }, - -- "tadmccorkle/markdown.nvim", - -- ft = "markdown", -- or 'event = "VeryLazy"' - -- opts = { - -- -- configuration here or empty for defaults - -- }, - -- { - -- "MeanderingProgrammer/render-markdown.nvim", - -- dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite - -- -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins - -- -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons - -- ---@module 'render-markdown' - -- ---@type render.md.UserConfig - -- opts = {}, - -- ft = "markdown", - -- }, + -- "tadmccorkle/markdown.nvim", + -- ft = "markdown", -- or 'event = "VeryLazy"' + -- opts = { + -- -- configuration here or empty for defaults + -- }, + -- { + -- "MeanderingProgrammer/render-markdown.nvim", + -- dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite + -- -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins + -- -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + -- ---@module 'render-markdown' + -- ---@type render.md.UserConfig + -- opts = {}, + -- ft = "markdown", + -- }, } diff --git a/.config/nvim/lua/plugins/maximize.lua b/.config/nvim/lua/plugins/maximize.lua index 00b58ca..30183df 100644 --- a/.config/nvim/lua/plugins/maximize.lua +++ b/.config/nvim/lua/plugins/maximize.lua @@ -1,10 +1,10 @@ return { - "declancm/maximize.nvim", - config = true, - cmd = { - "Maximize", - }, - keys = { - { "z", "Maximize", desc = "Maximize" }, - }, + "declancm/maximize.nvim", + config = true, + cmd = { + "Maximize", + }, + keys = { + { "z", "Maximize", desc = "Maximize" }, + }, } diff --git a/.config/nvim/lua/plugins/mini-cursorword.lua b/.config/nvim/lua/plugins/mini-cursorword.lua index 8f5f2f1..8c598ec 100644 --- a/.config/nvim/lua/plugins/mini-cursorword.lua +++ b/.config/nvim/lua/plugins/mini-cursorword.lua @@ -1,10 +1,10 @@ return { - "echasnovski/mini.cursorword", - version = false, - lazy = false, - config = function() - require("mini.cursorword").setup({ - delay = 10, - }) - end, + "echasnovski/mini.cursorword", + version = false, + lazy = false, + config = function() + require("mini.cursorword").setup({ + delay = 10, + }) + end, } diff --git a/.config/nvim/lua/plugins/neogit.lua b/.config/nvim/lua/plugins/neogit.lua index 4420659..843d8f8 100644 --- a/.config/nvim/lua/plugins/neogit.lua +++ b/.config/nvim/lua/plugins/neogit.lua @@ -1,16 +1,16 @@ return { - "NeogitOrg/neogit", - dependencies = { - "nvim-lua/plenary.nvim", - "sindrets/diffview.nvim", - "nvim-telescope/telescope.nvim", - }, - keys = { - { "g", "Neogit", desc = "Neogit" }, - }, - config = function() - require("neogit").setup({ - graph_style = "unicode", - }) - end, + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + "nvim-telescope/telescope.nvim", + }, + keys = { + { "g", "Neogit", desc = "Neogit" }, + }, + config = function() + require("neogit").setup({ + graph_style = "unicode", + }) + end, } diff --git a/.config/nvim/lua/plugins/neotest.lua b/.config/nvim/lua/plugins/neotest.lua index 4830205..3694f31 100644 --- a/.config/nvim/lua/plugins/neotest.lua +++ b/.config/nvim/lua/plugins/neotest.lua @@ -8,7 +8,7 @@ return { "olimorris/neotest-rspec", "zidhuss/neotest-minitest", "rcasia/neotest-java", - 'mfussenegger/nvim-jdtls', + "mfussenegger/nvim-jdtls", "adrigzr/neotest-mocha", }, config = function() @@ -43,19 +43,19 @@ return { require("neotest-rspec")({ rspec_cmd = function() return { "mise", "exec", "--", "bundle", "exec", "rspec" } - end + end, }), - require("neotest-java") { + require("neotest-java")({ ignore_wrapper = true, - } + }), }, }) end, keys = { - { "tt", "Neotest run file", desc = "Test file" }, - { "tr", "Neotest run", desc = "Run closest test" }, - { "to", "Neotest output", desc = "Test output" }, + { "tt", "Neotest run file", desc = "Test file" }, + { "tr", "Neotest run", desc = "Run closest test" }, + { "to", "Neotest output", desc = "Test output" }, { "tO", "Neotest output-panel", desc = "Test output panel" }, - { "ts", "Neotest stop", desc = "Stop test" }, + { "ts", "Neotest stop", desc = "Stop test" }, }, } diff --git a/.config/nvim/lua/plugins/nvim-asciidoc-preview.lua b/.config/nvim/lua/plugins/nvim-asciidoc-preview.lua index c8d1c2b..52e843f 100644 --- a/.config/nvim/lua/plugins/nvim-asciidoc-preview.lua +++ b/.config/nvim/lua/plugins/nvim-asciidoc-preview.lua @@ -1,7 +1,7 @@ return { - 'tigion/nvim-asciidoc-preview', - ft = { 'asciidoc' }, - build = 'cd server && npm install --omit=dev', + "tigion/nvim-asciidoc-preview", + ft = { "asciidoc" }, + build = "cd server && npm install --omit=dev", opts = { -- Add user configuration here }, diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua index 637ebf7..170ce71 100644 --- a/.config/nvim/lua/plugins/nvim-cmp.lua +++ b/.config/nvim/lua/plugins/nvim-cmp.lua @@ -1,97 +1,97 @@ return { - "hrsh7th/nvim-cmp", - lazy = false, - dependencies = { - "hrsh7th/nvim-cmp", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "ray-x/cmp-treesitter", - "neovim/nvim-lspconfig", - "saadparwaiz1/cmp_luasnip", - "rafamadriz/friendly-snippets", - "L3MON4D3/LuaSnip", - }, - config = function() - local cmp = require("cmp") - require("luasnip.loaders.from_vscode").lazy_load() + "hrsh7th/nvim-cmp", + lazy = false, + dependencies = { + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "ray-x/cmp-treesitter", + "neovim/nvim-lspconfig", + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + "L3MON4D3/LuaSnip", + }, + config = function() + local cmp = require("cmp") + require("luasnip.loaders.from_vscode").lazy_load() - local luasnip = require("luasnip") + local luasnip = require("luasnip") - cmp.setup({ - snippet = { - -- expand = function(args) - -- require('luasnip').lsp_expand(args.body) - -- end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - -- [''] = cmp.mapping.confirm({ select = true }), - -- https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#luasnip + cmp.setup({ + snippet = { + -- expand = function(args) + -- require('luasnip').lsp_expand(args.body) + -- end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + -- [''] = cmp.mapping.confirm({ select = true }), + -- https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#luasnip - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - if luasnip.expandable() then - luasnip.expand() - else - cmp.confirm({ - select = true, - }) - end - else - fallback() - end - end), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + if luasnip.expandable() then + luasnip.expand() + else + cmp.confirm({ + select = true, + }) + end + else + fallback() + end + end), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.locally_jumpable(1) then - luasnip.jump(1) - else - fallback() - end - end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.locally_jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - -- { name = 'treesitter' }, - { name = "luasnip" }, - }, { - { name = 'buffer' }, - { name = "path" }, - }), - }) + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + -- { name = 'treesitter' }, + { name = "luasnip" }, + }, { + { name = "buffer" }, + { name = "path" }, + }), + }) - cmp.setup.cmdline({ "/", "?" }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" }, - }, - }) + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) - cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" }, - }, { - { name = "cmdline" }, - }), - matching = { disallow_symbol_nonprefix_matching = false }, - }) - end, + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + matching = { disallow_symbol_nonprefix_matching = false }, + }) + end, } diff --git a/.config/nvim/lua/plugins/nvim-lspconfig.lua b/.config/nvim/lua/plugins/nvim-lspconfig.lua index 8850131..1e694d5 100644 --- a/.config/nvim/lua/plugins/nvim-lspconfig.lua +++ b/.config/nvim/lua/plugins/nvim-lspconfig.lua @@ -1,80 +1,77 @@ return { - "neovim/nvim-lspconfig", - lazy = false, - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "VonHeikemen/lsp-zero.nvim", - { - "williamboman/mason.nvim", - config = function() - require("mason").setup() - end, - }, - { - "williamboman/mason-lspconfig.nvim", - dependencies = { "williamboman/mason.nvim" }, - }, - }, - keys = { - { "li", "LspInfo", desc = "Lsp info" }, - { "ll", "LspLog", desc = "Lsp log" }, - }, - config = function() - -- Setup mason-lspconfig with v2.0 API - require("mason-lspconfig").setup({ - ensure_installed = { "lua_ls", "rust_analyzer" }, - automatic_enable = true, -- This automatically enables installed servers - }) + "neovim/nvim-lspconfig", + lazy = false, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "VonHeikemen/lsp-zero.nvim", + { + "williamboman/mason.nvim", + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", + dependencies = { "williamboman/mason.nvim" }, + }, + }, + keys = { + { "li", "LspInfo", desc = "Lsp info" }, + { "ll", "LspLog", desc = "Lsp log" }, + }, + config = function() + -- Setup mason-lspconfig with v2.0 API + require("mason-lspconfig").setup({ + ensure_installed = { "lua_ls", "rust_analyzer" }, + automatic_enable = true, -- This automatically enables installed servers + }) - -- Setup LSP capabilities for autocompletion - local lspconfig = require("lspconfig") - local lspconfig_defaults = lspconfig.util.default_config - lspconfig_defaults.capabilities = vim.tbl_deep_extend( - "force", - lspconfig_defaults.capabilities, - require("cmp_nvim_lsp").default_capabilities() - ) + -- Setup LSP capabilities for autocompletion + local lspconfig = require("lspconfig") + local lspconfig_defaults = lspconfig.util.default_config + lspconfig_defaults.capabilities = + vim.tbl_deep_extend("force", lspconfig_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities()) - -- Configure ruby-lsp using the new vim.lsp.config API - vim.lsp.config('ruby-lsp', { - init_options = { + -- Configure ruby-lsp using the new vim.lsp.config API + vim.lsp.config("ruby-lsp", { + init_options = { addonSettings = { ["Ruby LSP Rails"] = { enablePendingMigrationsPrompt = false, }, }, - settings = { + settings = { formatter = { - enabled = true - } - } - } - }) + enabled = true, + }, + }, + }, + }) -- herb? - vim.lsp.config('herb_ls', { + vim.lsp.config("herb_ls", { cmd = { "herb-language-server", "--stdio" }, - filetypes = { 'erb'}, - }) + filetypes = { "erb" }, + }) - -- LSP keymaps and autocmds - vim.api.nvim_create_autocmd("LspAttach", { - desc = "LSP actions", - callback = function(event) - local opts = { buffer = event.buf } - vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Show hover information" }) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Go to declaration" }) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" }) - vim.keymap.set("n", "go", vim.lsp.buf.type_definition, { desc = "Go to type definition" }) - vim.keymap.set("n", "gr", vim.lsp.buf.references, { desc = "Show references" }) - vim.keymap.set("n", "gs", vim.lsp.buf.signature_help, { desc = "Show signature help" }) - vim.keymap.set("n", "cn", vim.lsp.buf.rename, { desc = "Rename symbol" }) - vim.keymap.set({ "n", "x" }, "F", function() - vim.lsp.buf.format({ async = true }) -- TODO: add desc - end, opts) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, opts) - end, - }) - end, + -- LSP keymaps and autocmds + vim.api.nvim_create_autocmd("LspAttach", { + desc = "LSP actions", + callback = function(event) + local opts = { buffer = event.buf } + vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Show hover information" }) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Go to declaration" }) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" }) + vim.keymap.set("n", "go", vim.lsp.buf.type_definition, { desc = "Go to type definition" }) + vim.keymap.set("n", "gr", vim.lsp.buf.references, { desc = "Show references" }) + vim.keymap.set("n", "gs", vim.lsp.buf.signature_help, { desc = "Show signature help" }) + vim.keymap.set("n", "cn", vim.lsp.buf.rename, { desc = "Rename symbol" }) + vim.keymap.set({ "n", "x" }, "F", function() + vim.lsp.buf.format({ async = true }) -- TODO: add desc + end, opts) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, opts) + end, + }) + end, } diff --git a/.config/nvim/lua/plugins/nvim-surround.lua b/.config/nvim/lua/plugins/nvim-surround.lua index 08ac0f2..e859c19 100644 --- a/.config/nvim/lua/plugins/nvim-surround.lua +++ b/.config/nvim/lua/plugins/nvim-surround.lua @@ -1,8 +1,8 @@ return { - "kylechui/nvim-surround", - version = "*", - event = "VeryLazy", - config = function() - require("nvim-surround").setup() - end, + "kylechui/nvim-surround", + version = "*", + event = "VeryLazy", + config = function() + require("nvim-surround").setup() + end, } diff --git a/.config/nvim/lua/plugins/nvim-treesitter-endwise.lua b/.config/nvim/lua/plugins/nvim-treesitter-endwise.lua index 64b8e4a..00de681 100644 --- a/.config/nvim/lua/plugins/nvim-treesitter-endwise.lua +++ b/.config/nvim/lua/plugins/nvim-treesitter-endwise.lua @@ -1,11 +1,11 @@ return { - "RRethy/nvim-treesitter-endwise", - event = { "BufReadPre", "BufNewFile" }, - config = function() - require("nvim-treesitter.configs").setup({ - endwise = { - enable = true, - }, - }) - end, + "RRethy/nvim-treesitter-endwise", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("nvim-treesitter.configs").setup({ + endwise = { + enable = true, + }, + }) + end, } diff --git a/.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua b/.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua index b8dadeb..8aad996 100644 --- a/.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua +++ b/.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua @@ -1,74 +1,74 @@ -- https://www.josean.com/posts/nvim-treesitter-and-textobjects return { - "nvim-treesitter/nvim-treesitter-textobjects", - lazy = true, - config = function() - require("nvim-treesitter.configs").setup({ - textobjects = { - select = { - enable = true, + "nvim-treesitter/nvim-treesitter-textobjects", + lazy = true, + config = function() + require("nvim-treesitter.configs").setup({ + textobjects = { + select = { + enable = true, - -- Automatically jump forward to textobj, similar to targets.vim - lookahead = true, + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" }, - ["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" }, - ["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" }, - ["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" }, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" }, + ["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" }, + ["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" }, + ["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" }, - -- works for javascript/typescript files (custom captures I created in after/queries/ecma/textobjects.scm) - ["a:"] = { query = "@property.outer", desc = "Select outer part of an object property" }, - ["i:"] = { query = "@property.inner", desc = "Select inner part of an object property" }, - ["l:"] = { query = "@property.lhs", desc = "Select left part of an object property" }, - ["r:"] = { query = "@property.rhs", desc = "Select right part of an object property" }, + -- works for javascript/typescript files (custom captures I created in after/queries/ecma/textobjects.scm) + ["a:"] = { query = "@property.outer", desc = "Select outer part of an object property" }, + ["i:"] = { query = "@property.inner", desc = "Select inner part of an object property" }, + ["l:"] = { query = "@property.lhs", desc = "Select left part of an object property" }, + ["r:"] = { query = "@property.rhs", desc = "Select right part of an object property" }, - ["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" }, - ["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" }, + ["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" }, + ["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" }, - ["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" }, - ["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" }, + ["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" }, + ["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" }, - ["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" }, - ["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" }, + ["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" }, + ["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" }, - ["af"] = { query = "@call.outer", desc = "Select outer part of a function call" }, - ["if"] = { query = "@call.inner", desc = "Select inner part of a function call" }, + ["af"] = { query = "@call.outer", desc = "Select outer part of a function call" }, + ["if"] = { query = "@call.inner", desc = "Select inner part of a function call" }, - ["am"] = { - query = "@function.outer", - desc = "Select outer part of a method/function definition", - }, - ["im"] = { - query = "@function.inner", - desc = "Select inner part of a method/function definition", - }, + ["am"] = { + query = "@function.outer", + desc = "Select outer part of a method/function definition", + }, + ["im"] = { + query = "@function.inner", + desc = "Select inner part of a method/function definition", + }, - ["ab"] = { query = "@block.outer", desc = "Select outer part of a block definition" }, - ["ib"] = { query = "@block.inner", desc = "Select inner part of a block definition" }, + ["ab"] = { query = "@block.outer", desc = "Select outer part of a block definition" }, + ["ib"] = { query = "@block.inner", desc = "Select inner part of a block definition" }, - ["ac"] = { query = "@class.outer", desc = "Select outer part of a class" }, - ["ic"] = { query = "@class.inner", desc = "Select inner part of a class" }, + ["ac"] = { query = "@class.outer", desc = "Select outer part of a class" }, + ["ic"] = { query = "@class.inner", desc = "Select inner part of a class" }, - ["a/"] = { query = "@comment.outer", desc = "Select outer part of a comment" }, - ["i/"] = { query = "@comment.inner", desc = "Select inner part of a comment" }, - }, - }, - swap = { - enable = true, - swap_next = { - ["na"] = "@parameter.inner", -- swap parameters/argument with next - ["n:"] = "@property.outer", -- swap object property with next - ["nm"] = "@function.outer", -- swap function with next - }, - swap_previous = { - ["Pa"] = "@parameter.inner", -- swap parameters/argument with prev - ["P:"] = "@property.outer", -- swap object property with prev - ["Pm"] = "@function.outer", -- swap function with previous - }, - }, - }, - }) - end, + ["a/"] = { query = "@comment.outer", desc = "Select outer part of a comment" }, + ["i/"] = { query = "@comment.inner", desc = "Select inner part of a comment" }, + }, + }, + swap = { + enable = true, + swap_next = { + ["na"] = "@parameter.inner", -- swap parameters/argument with next + ["n:"] = "@property.outer", -- swap object property with next + ["nm"] = "@function.outer", -- swap function with next + }, + swap_previous = { + ["Pa"] = "@parameter.inner", -- swap parameters/argument with prev + ["P:"] = "@property.outer", -- swap object property with prev + ["Pm"] = "@function.outer", -- swap function with previous + }, + }, + }, + }) + end, } diff --git a/.config/nvim/lua/plugins/nvim-treesitter.lua b/.config/nvim/lua/plugins/nvim-treesitter.lua index 42d8abd..0c99b7b 100644 --- a/.config/nvim/lua/plugins/nvim-treesitter.lua +++ b/.config/nvim/lua/plugins/nvim-treesitter.lua @@ -1,36 +1,36 @@ return { - "nvim-treesitter/nvim-treesitter", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - -- "nvim-treesitter/nvim-treesitter-context", - "nvim-treesitter/nvim-treesitter-textobjects", - }, - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { - "lua", - "yaml", - "vim", - "vimdoc", - "query", - "markdown", - "markdown_inline", - "ruby", - "javascript", - "rust", - "html", - "embedded_template", - }, - incremental_selection = { - enable = true, - keymaps = { - node_incremental = "tab", - node_decremental = "", - }, - }, - highlight = { - enable = true, - }, - }) - end, + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + -- "nvim-treesitter/nvim-treesitter-context", + "nvim-treesitter/nvim-treesitter-textobjects", + }, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "lua", + "yaml", + "vim", + "vimdoc", + "query", + "markdown", + "markdown_inline", + "ruby", + "javascript", + "rust", + "html", + "embedded_template", + }, + incremental_selection = { + enable = true, + keymaps = { + node_incremental = "tab", + node_decremental = "", + }, + }, + highlight = { + enable = true, + }, + }) + end, } diff --git a/.config/nvim/lua/plugins/nvim-ts-autotag.lua b/.config/nvim/lua/plugins/nvim-ts-autotag.lua index 2354857..cfe911d 100644 --- a/.config/nvim/lua/plugins/nvim-ts-autotag.lua +++ b/.config/nvim/lua/plugins/nvim-ts-autotag.lua @@ -1,23 +1,23 @@ return { - "windwp/nvim-ts-autotag", - lazy = false, - -- event = { "BufReadPre", "BufNewFile" }, - config = function() - require("nvim-ts-autotag").setup({ - opts = { - -- Defaults - enable_close = true, -- Auto close tags - enable_rename = true, -- Auto rename pairs of tags - enable_close_on_slash = false, -- Auto close on trailing "] = "actions.select", - [""] = { - "actions.select", - opts = { vertical = true }, - desc = "Open the entry in a vertical split", - }, - [""] = { - "actions.select", - opts = { horizontal = true }, - desc = "Open the entry in a horizontal split", - }, - [""] = { "actions.select", opts = { tab = true }, desc = "Open the entry in new tab" }, - [""] = "actions.preview", - ["-"] = "actions.parent", - ["_"] = "actions.open_cwd", - ["`"] = "actions.cd", - ["gs"] = "actions.change_sort", - [""] = { - "actions.open_cmdline", - opts = { - modify = ":! open", - }, - desc = "Open file", - }, - ["K"] = "actions.preview_scroll_up", - ["J"] = "actions.preview_scroll_down", - }, - use_default_keymaps = false, - view_options = { - show_hidden = true, - }, - lsp_file_methods = { - enabled = false, - }, - }) - end, - keys = { - { mode = "n", "-", "Oil" }, - }, + -- "stevearc/oil.nvim", -- revert to original repository once https://github.com/stevearc/oil.nvim/issues/435 is resolved + "jelmansouri/oil.nvim", -- revert to original repository once https://github.com/stevearc/oil.nvim/issues/435 is resolved + branch = "feat/scratch-preview", -- revert to original repository once https://github.com/stevearc/oil.nvim/issues/435 is resolved + dependencies = { { "echasnovski/mini.icons", opts = {} } }, + lazy = false, -- nvim /dir/name does not work otherwise + config = function() + require("oil").setup({ + columns = { + -- "icon", + -- "permissions", + -- "size", + -- "mtime", + }, + constrain_cursor = "name", + skip_confirm_for_simple_edits = true, + prompt_save_on_select_new_entry = true, + watch_for_changes = false, + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = { + "actions.select", + opts = { vertical = true }, + desc = "Open the entry in a vertical split", + }, + [""] = { + "actions.select", + opts = { horizontal = true }, + desc = "Open the entry in a horizontal split", + }, + [""] = { "actions.select", opts = { tab = true }, desc = "Open the entry in new tab" }, + [""] = "actions.preview", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["gs"] = "actions.change_sort", + [""] = { + "actions.open_cmdline", + opts = { + modify = ":! open", + }, + desc = "Open file", + }, + ["K"] = "actions.preview_scroll_up", + ["J"] = "actions.preview_scroll_down", + }, + use_default_keymaps = false, + view_options = { + show_hidden = true, + }, + lsp_file_methods = { + enabled = false, + }, + }) + end, + keys = { + { mode = "n", "-", "Oil" }, + }, } diff --git a/.config/nvim/lua/plugins/plantuml.lua b/.config/nvim/lua/plugins/plantuml.lua index 511b024..dfb4e9b 100644 --- a/.config/nvim/lua/plugins/plantuml.lua +++ b/.config/nvim/lua/plugins/plantuml.lua @@ -1,8 +1,8 @@ return { - "weirongxu/plantuml-previewer.vim", - dependencies = { "tyru/open-browser.vim", "aklt/plantuml-syntax" }, - lazy = false, - config = function() - vim.g.plantuml_previewer_plantuml_jar_path = "/opt/homebrew/bin/plantuml" - end, + "weirongxu/plantuml-previewer.vim", + dependencies = { "tyru/open-browser.vim", "aklt/plantuml-syntax" }, + lazy = false, + config = function() + vim.g.plantuml_previewer_plantuml_jar_path = "/opt/homebrew/bin/plantuml" + end, } diff --git a/.config/nvim/lua/plugins/refactoring.lua b/.config/nvim/lua/plugins/refactoring.lua index 08477ba..7c3e917 100644 --- a/.config/nvim/lua/plugins/refactoring.lua +++ b/.config/nvim/lua/plugins/refactoring.lua @@ -1,11 +1,11 @@ - return { - "ThePrimeagen/refactoring.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-treesitter/nvim-treesitter", - }, - lazy = false, - config = function() - require("refactoring").setup() - end, - } +return { + "ThePrimeagen/refactoring.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + lazy = false, + config = function() + require("refactoring").setup() + end, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index fd8bc1b..3a8fff6 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -22,8 +22,7 @@ return { file_ignore_patterns = { ".git/" }, -- Ignore the .git directory mappings = { n = { - [""] = require("telescope.actions").send_selected_to_qflist - + require("telescope.actions").open_qflist, + [""] = require("telescope.actions").send_selected_to_qflist + require("telescope.actions").open_qflist, }, }, }, @@ -42,16 +41,16 @@ return { end require("telescope.pickers") - .new({}, { - prompt_title = "Harpoon", - finder = require("telescope.finders").new_table({ - results = file_paths, - }), - layout_strategy = "center", - previewer = conf.file_previewer({}), - sorter = conf.generic_sorter({}), - }) - :find() + .new({}, { + prompt_title = "Harpoon", + finder = require("telescope.finders").new_table({ + results = file_paths, + }), + layout_strategy = "center", + previewer = conf.file_previewer({}), + sorter = conf.generic_sorter({}), + }) + :find() end vim.keymap.set("n", "", function() @@ -59,13 +58,13 @@ return { end, { desc = "Open harpoon window" }) end, keys = { - { "", 'Telescope find_files path_display={"smart"}', desc = "Find files" }, - { "", "Telescope buffers", desc = "Find buffer" }, - { "C", "Telescope commands", desc = "Find commands" }, - { "", "Telescope lsp_document_symbols", desc = "Find symbols" }, - { "f", "Telescope find_files hidden=true", desc = "Find files" }, + { "", 'Telescope find_files path_display={"smart"}', desc = "Find files" }, + { "", "Telescope buffers", desc = "Find buffer" }, + { "C", "Telescope commands", desc = "Find commands" }, + { "", "Telescope lsp_document_symbols", desc = "Find symbols" }, + { "f", "Telescope find_files hidden=true", desc = "Find files" }, -- { "e", "Telescope find_files hidden=false", desc = "Find all files" }, - { "w", "Telescope live_grep", desc = "Find substring" }, + { "w", "Telescope live_grep", desc = "Find substring" }, { "r", function() @@ -73,7 +72,7 @@ return { require("telescope.builtin").grep_string({ search = current_word }) end, }, - { "cc", "Telescope git_commits", desc = "Find git commits" }, + { "cc", "Telescope git_commits", desc = "Find git commits" }, { "ac", "Telescope find_files prompt_title=Controllers cwd=app/controllers/ hidden=true", @@ -109,6 +108,6 @@ return { "Telescope find_files prompt_title=Views cwd=app/views hidden=true", desc = "Find Rails views", }, - { "l", "Telescope lsp_document_symbols", desc = "Find symbols" }, + { "l", "Telescope lsp_document_symbols", desc = "Find symbols" }, }, } diff --git a/.config/nvim/lua/plugins/text-case.lua b/.config/nvim/lua/plugins/text-case.lua index 32a7a21..9512abc 100644 --- a/.config/nvim/lua/plugins/text-case.lua +++ b/.config/nvim/lua/plugins/text-case.lua @@ -1,19 +1,19 @@ return { - "johmsalas/text-case.nvim", - dependencies = { "nvim-telescope/telescope.nvim" }, - config = function() - require("textcase").setup({}) - require("telescope").load_extension("textcase") - end, - keys = { - { "co", "TextCaseOpenTelescope", mode = { "n", "x" }, desc = "Open TextCase Telescope" }, - }, - cmd = { - "Subs", - "TextCaseOpenTelescope", - "TextCaseOpenTelescopeQuickChange", - "TextCaseOpenTelescopeLSPChange", - "TextCaseStartReplacingCommand", - }, - lazy = false, + "johmsalas/text-case.nvim", + dependencies = { "nvim-telescope/telescope.nvim" }, + config = function() + require("textcase").setup({}) + require("telescope").load_extension("textcase") + end, + keys = { + { "co", "TextCaseOpenTelescope", mode = { "n", "x" }, desc = "Open TextCase Telescope" }, + }, + cmd = { + "Subs", + "TextCaseOpenTelescope", + "TextCaseOpenTelescopeQuickChange", + "TextCaseOpenTelescopeLSPChange", + "TextCaseStartReplacingCommand", + }, + lazy = false, } diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua index fc29597..3741f30 100644 --- a/.config/nvim/lua/plugins/trouble.lua +++ b/.config/nvim/lua/plugins/trouble.lua @@ -1,37 +1,37 @@ return { - "folke/trouble.nvim", - opts = {}, -- for default options, refer to the configuration section for custom setup. - cmd = "Trouble", - keys = { - { - "xx", - "Trouble diagnostics toggle", - desc = "Diagnostics (Trouble)", - }, - { - "xX", - "Trouble diagnostics toggle filter.buf=0", - desc = "Buffer Diagnostics (Trouble)", - }, - { - "cs", - "Trouble symbols toggle focus=false", - desc = "Symbols (Trouble)", - }, - { - "cl", - "Trouble lsp toggle focus=false win.position=right", - desc = "LSP Definitions / references / ... (Trouble)", - }, - { - "xL", - "Trouble loclist toggle", - desc = "Location List (Trouble)", - }, - { - "xQ", - "Trouble qflist toggle", - desc = "Quickfix List (Trouble)", - }, - }, + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, } diff --git a/.config/nvim/lua/plugins/undotree.lua b/.config/nvim/lua/plugins/undotree.lua index 30b83e9..fb491a7 100644 --- a/.config/nvim/lua/plugins/undotree.lua +++ b/.config/nvim/lua/plugins/undotree.lua @@ -1,30 +1,30 @@ return { - "jiaoshijie/undotree", - dependencies = "nvim-lua/plenary.nvim", - keys = { -- load the plugin only when using it's keybinding: - { "u", "lua require('undotree').toggle()", desc = "Undotree" }, - }, - config = function() - local undotree = require("undotree") + "jiaoshijie/undotree", + dependencies = "nvim-lua/plenary.nvim", + keys = { -- load the plugin only when using it's keybinding: + { "u", "lua require('undotree').toggle()", desc = "Undotree" }, + }, + config = function() + local undotree = require("undotree") - undotree.setup({ - float_diff = true, -- using float window previews diff, set this `true` will disable layout option - layout = "left_bottom", -- "left_bottom", "left_left_bottom" - position = "left", -- "right", "bottom" - ignore_filetype = { "undotree", "undotreeDiff", "qf", "TelescopePrompt", "spectre_panel", "tsplayground" }, - window = { - winblend = 30, - }, - keymaps = { - ["j"] = "move_next", - ["k"] = "move_prev", - ["gj"] = "move2parent", - ["J"] = "move_change_next", - ["K"] = "move_change_prev", - [""] = "action_enter", - ["p"] = "enter_diffbuf", - ["q"] = "quit", - }, - }) - end, + undotree.setup({ + float_diff = true, -- using float window previews diff, set this `true` will disable layout option + layout = "left_bottom", -- "left_bottom", "left_left_bottom" + position = "left", -- "right", "bottom" + ignore_filetype = { "undotree", "undotreeDiff", "qf", "TelescopePrompt", "spectre_panel", "tsplayground" }, + window = { + winblend = 30, + }, + keymaps = { + ["j"] = "move_next", + ["k"] = "move_prev", + ["gj"] = "move2parent", + ["J"] = "move_change_next", + ["K"] = "move_change_prev", + [""] = "action_enter", + ["p"] = "enter_diffbuf", + ["q"] = "quit", + }, + }) + end, } diff --git a/.config/nvim/lua/plugins/vim-case-convert.lua b/.config/nvim/lua/plugins/vim-case-convert.lua index 41b5f38..5335a6c 100644 --- a/.config/nvim/lua/plugins/vim-case-convert.lua +++ b/.config/nvim/lua/plugins/vim-case-convert.lua @@ -1,4 +1,4 @@ return { - "chiedo/vim-case-convert", - lazy = false, + "chiedo/vim-case-convert", + lazy = false, } diff --git a/.config/nvim/lua/plugins/vim-fetch.lua b/.config/nvim/lua/plugins/vim-fetch.lua index eb53d3b..64e76e5 100644 --- a/.config/nvim/lua/plugins/vim-fetch.lua +++ b/.config/nvim/lua/plugins/vim-fetch.lua @@ -1,4 +1,4 @@ return { "wsdjeg/vim-fetch", - lazy=false + lazy = false, } diff --git a/.config/nvim/lua/plugins/vim-fugitive.lua b/.config/nvim/lua/plugins/vim-fugitive.lua index 1099ca1..c38fbcf 100644 --- a/.config/nvim/lua/plugins/vim-fugitive.lua +++ b/.config/nvim/lua/plugins/vim-fugitive.lua @@ -1,13 +1,13 @@ return { - "tpope/vim-fugitive", - config = function() - require("vim-fugitive").setup() - end, - commands = { - { "G", "Git" }, - { "Gblame", "Git blame" }, - { "Gdiff", "Git diff" }, - { "Glog", "Git log" }, - { "Gstatus", "Git status" }, - }, + "tpope/vim-fugitive", + config = function() + require("vim-fugitive").setup() + end, + commands = { + { "G", "Git" }, + { "Gblame", "Git blame" }, + { "Gdiff", "Git diff" }, + { "Glog", "Git log" }, + { "Gstatus", "Git status" }, + }, } diff --git a/.config/nvim/lua/plugins/vim-rails.lua b/.config/nvim/lua/plugins/vim-rails.lua index 4b85a73..1586b7a 100644 --- a/.config/nvim/lua/plugins/vim-rails.lua +++ b/.config/nvim/lua/plugins/vim-rails.lua @@ -1,5 +1,5 @@ return { - "tpope/vim-rails", + "tpope/vim-rails", lazy = false, - ft = { "ruby" }, + ft = { "ruby" }, } diff --git a/.config/nvim/lua/plugins/vim-tmux-navigator.lua b/.config/nvim/lua/plugins/vim-tmux-navigator.lua index 31321a6..11c99cd 100644 --- a/.config/nvim/lua/plugins/vim-tmux-navigator.lua +++ b/.config/nvim/lua/plugins/vim-tmux-navigator.lua @@ -1,18 +1,18 @@ return { - "christoomey/vim-tmux-navigator", - cmd = { - "TmuxNavigateLeft", - "TmuxNavigateDown", - "TmuxNavigateUp", - "TmuxNavigateRight", - "TmuxNavigatePrevious", - "TmuxNavigatorProcessList", - }, - keys = { - { "", "TmuxNavigateLeft" }, - { "", "TmuxNavigateDown" }, - { "", "TmuxNavigateUp" }, - { "", "TmuxNavigateRight" }, - { "", "TmuxNavigatePrevious" }, - }, + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + "TmuxNavigatorProcessList", + }, + keys = { + { "", "TmuxNavigateLeft" }, + { "", "TmuxNavigateDown" }, + { "", "TmuxNavigateUp" }, + { "", "TmuxNavigateRight" }, + { "", "TmuxNavigatePrevious" }, + }, } diff --git a/.config/nvim/lua/plugins/visual-multi.lua b/.config/nvim/lua/plugins/visual-multi.lua index 7948c42..01d1d04 100644 --- a/.config/nvim/lua/plugins/visual-multi.lua +++ b/.config/nvim/lua/plugins/visual-multi.lua @@ -1,4 +1,4 @@ return { - "mg979/vim-visual-multi", - lazy = false, + "mg979/vim-visual-multi", + lazy = false, } diff --git a/.config/nvim/lua/plugins/yaml.lua b/.config/nvim/lua/plugins/yaml.lua index 16fdd32..68c982c 100644 --- a/.config/nvim/lua/plugins/yaml.lua +++ b/.config/nvim/lua/plugins/yaml.lua @@ -5,6 +5,6 @@ return { "nvim-treesitter/nvim-treesitter", "folke/snacks.nvim", -- optional "nvim-telescope/telescope.nvim", -- optional - "ibhagwan/fzf-lua" -- optional + "ibhagwan/fzf-lua", -- optional }, } diff --git a/.config/nvim/lua/plugins/zj-navigator.lua b/.config/nvim/lua/plugins/zj-navigator.lua index 32e0bfc..6ddf0ad 100644 --- a/.config/nvim/lua/plugins/zj-navigator.lua +++ b/.config/nvim/lua/plugins/zj-navigator.lua @@ -1,12 +1,12 @@ return { - -- 'dynamotn/Navigator.nvim', - -- lazy = false, - -- config = function() - -- require('Navigator').setup() - -- vim.keymap.set({'n', 't'}, '', 'NavigatorLeft') - -- vim.keymap.set({'n', 't'}, '', 'NavigatorRight') - -- vim.keymap.set({'n', 't'}, '', 'NavigatorUp') - -- vim.keymap.set({'n', 't'}, '', 'NavigatorDown') - -- vim.keymap.set({'n', 't'}, '', 'NavigatorPrevious') - -- end + -- 'dynamotn/Navigator.nvim', + -- lazy = false, + -- config = function() + -- require('Navigator').setup() + -- vim.keymap.set({'n', 't'}, '', 'NavigatorLeft') + -- vim.keymap.set({'n', 't'}, '', 'NavigatorRight') + -- vim.keymap.set({'n', 't'}, '', 'NavigatorUp') + -- vim.keymap.set({'n', 't'}, '', 'NavigatorDown') + -- vim.keymap.set({'n', 't'}, '', 'NavigatorPrevious') + -- end } diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index ba78712..2ddf614 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -74,7 +74,7 @@ vim.keymap.set("n", "cp", "cp :let @+=expand('%:p')") vim.keymap.set("n", "cm", ":cnext") vim.keymap.set("n", "cl", ":cprev") -vim.api.nvim_create_user_command('Kms', 'execute "SessionDelete" | quit', {}) +vim.api.nvim_create_user_command("Kms", 'execute "SessionDelete" | quit', {}) -- splits @@ -88,28 +88,28 @@ vim.keymap.set("n", "", ":wincmd =", { silent = true }) vim.keymap.set("n", "v", ":wincmd v", { silent = true }) vim.keymap.set("n", "V", ":wincmd s", { noremap = true, silent = true }) vim.keymap.set("n", "o", function() - -- get the current line content - local line = vim.api.nvim_get_current_line() + -- get the current line content + local line = vim.api.nvim_get_current_line() - -- extract the string (either single-quoted or double-quoted) - local str = line:match("'(.-)'") or line:match('"(.-)"') + -- extract the string (either single-quoted or double-quoted) + local str = line:match("'(.-)'") or line:match('"(.-)"') - if str then - -- Construct the GitHub URL - local url = "https://github.com/" .. str + if str then + -- Construct the GitHub URL + local url = "https://github.com/" .. str - -- use the open shell command to open the URL - os.execute("open " .. url) - else - print("No valid string found on the current line.") - end + -- use the open shell command to open the URL + os.execute("open " .. url) + else + print("No valid string found on the current line.") + end end) -- vim.keymap.set('n', '', ':let @+ = "rspec " . substitute(expand("%:p"), getcwd() . "/", "", "") . ":" . line(".")') -vim.keymap.set('n', '', ':let @+ = "rspec " . substitute(expand("%:p"), getcwd() . "/", "", "")') -vim.keymap.set('n', '', ':let @+ = "rubocop " . substitute(expand("%:p"), getcwd() . "/", "", "")') +vim.keymap.set("n", "", ':let @+ = "rspec " . substitute(expand("%:p"), getcwd() . "/", "", "")') +vim.keymap.set("n", "", ':let @+ = "rubocop " . substitute(expand("%:p"), getcwd() . "/", "", "")') -vim.keymap.set('n', '', ':let @+ = substitute(expand("%:p"), getcwd() . "/", "", "")') +vim.keymap.set("n", "", ':let @+ = substitute(expand("%:p"), getcwd() . "/", "", "")') -- vim.keymap.set('n', '', ':let @+ = expand("%:p")') -vim.api.nvim_create_user_command('Trim', ':%s/\\s\\+$//e', {}) +vim.api.nvim_create_user_command("Trim", ":%s/\\s\\+$//e", {}) diff --git a/.config/nvim/lua/theme.lua b/.config/nvim/lua/theme.lua index 2652fd3..2b007a2 100644 --- a/.config/nvim/lua/theme.lua +++ b/.config/nvim/lua/theme.lua @@ -1,14 +1,14 @@ if vim.o.background == "dark" then - vim.g.tokyonight_style = "night" - vim.g.tokyonight_transparent_background = 1 - vim.g.tokyonight_enable_italic = 1 - vim.cmd("colorscheme gruvbox") - -- vim.cmd("colorscheme vim") - vim.cmd("set bg=dark") + vim.g.tokyonight_style = "night" + vim.g.tokyonight_transparent_background = 1 + vim.g.tokyonight_enable_italic = 1 + vim.cmd("colorscheme gruvbox") + -- vim.cmd("colorscheme vim") + vim.cmd("set bg=dark") else - vim.o.background = "light" - -- vim.cmd("colorscheme solarized") - -- vim.cmd("colorscheme wildcharm") - vim.cmd("colorscheme polar") - vim.cmd("set bg=light") + vim.o.background = "light" + -- vim.cmd("colorscheme solarized") + -- vim.cmd("colorscheme wildcharm") + vim.cmd("colorscheme polar") + vim.cmd("set bg=light") end diff --git a/.config/nvim/lua/util.lua b/.config/nvim/lua/util.lua index 3f41d32..f98b06a 100644 --- a/.config/nvim/lua/util.lua +++ b/.config/nvim/lua/util.lua @@ -1,56 +1,56 @@ local function get_current_line() - return vim.api.nvim_get_current_line() + return vim.api.nvim_get_current_line() end local function extract_attribute_name(line) - return line:match("%s*(%w+)%s*;") + return line:match("%s*(%w+)%s*;") end vim.api.nvim_create_autocmd("TextYankPost", { - group = vim.api.nvim_create_augroup("highlight_yank", {}), - desc = "Hightlight selection on yank", - pattern = "*", - callback = function() - vim.highlight.on_yank({ higroup = "IncSearch", timeout = 100 }) - end, + group = vim.api.nvim_create_augroup("highlight_yank", {}), + desc = "Hightlight selection on yank", + pattern = "*", + callback = function() + vim.highlight.on_yank({ higroup = "IncSearch", timeout = 100 }) + end, }) local numbertoggle_group = vim.api.nvim_create_augroup("numbertoggle", { clear = true }) vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, { - group = numbertoggle_group, - pattern = "*", - callback = function() - if vim.wo.number and vim.fn.mode() ~= "i" then - vim.wo.relativenumber = true - end - end, + group = numbertoggle_group, + pattern = "*", + callback = function() + if vim.wo.number and vim.fn.mode() ~= "i" then + vim.wo.relativenumber = true + end + end, }) vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" }, { - group = numbertoggle_group, - pattern = "*", - callback = function() - if vim.wo.number then - vim.wo.relativenumber = false - end - end, + group = numbertoggle_group, + pattern = "*", + callback = function() + if vim.wo.number then + vim.wo.relativenumber = false + end + end, }) function toggle_terminal() - local term_bufnr = nil - for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do - if vim.api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then - term_bufnr = bufnr - break - end - end - - if term_bufnr then - vim.api.nvim_buf_delete(term_bufnr, { force = true }) - else - vim.cmd("vsplit | terminal") - end + local term_bufnr = nil + for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do + if vim.api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then + term_bufnr = bufnr + break + end + end + + if term_bufnr then + vim.api.nvim_buf_delete(term_bufnr, { force = true }) + else + vim.cmd("vsplit | terminal") + end end vim.keymap.set("n", "", toggle_terminal, { noremap = true, silent = true }) diff --git a/.config/nvim/stylua.toml b/.config/nvim/stylua.toml new file mode 100644 index 0000000..6090f42 --- /dev/null +++ b/.config/nvim/stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "Always" diff --git a/.config/nvim/vscode.lua b/.config/nvim/vscode.lua index 5ae03b3..b40ec9c 100644 --- a/.config/nvim/vscode.lua +++ b/.config/nvim/vscode.lua @@ -7,26 +7,26 @@ vim.g.maplocalleader = "," local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", - lazypath, - }) + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) end vim.opt.rtp:prepend(lazypath) local plugins = { - { - { - "tpope/vim-rails", - lazy = false, - ft = { "ruby" }, - }, - }, + { + { + "tpope/vim-rails", + lazy = false, + ft = { "ruby" }, + }, + }, } local opts = { defaults = { lazy = true }, change_detection = { notify = false } } @@ -44,16 +44,16 @@ local keymap = vim.api.nvim_set_keymap M.my_vscode = augroup("MyVSCode", {}) vim.filetype.add({ - pattern = { - [".*%.ipynb.*"] = "python", - }, + pattern = { + [".*%.ipynb.*"] = "python", + }, }) local function notify(cmd) - return string.format("call VSCodeNotify('%s')", cmd) + return string.format("call VSCodeNotify('%s')", cmd) end local function v_notify(cmd) - return string.format("call VSCodeNotifyVisual('%s', 1)", cmd) + return string.format("call VSCodeNotifyVisual('%s', 1)", cmd) end keymap("n", "xr", notify("references-view.findReferences"), { silent = true }) -- language references diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..e6fd4dd --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,69 @@ +name: Format Check + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + format-check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: 'stable' + + - name: Install formatters + run: | + # Install StyLua for Lua formatting + cargo install stylua + + # Install shfmt for shell formatting + go install mvdan.cc/sh/v3/cmd/shfmt@latest + + # Install prettier for TypeScript/JavaScript + npm install -g prettier + + # Add Go bin to PATH + echo "$HOME/go/bin" >> $GITHUB_PATH + + - name: Create directories for fastcheck scripts + run: | + mkdir -p bin + mkdir -p neovim + mkdir -p scripts + + - name: Run bin/fastcheck + run: ./bin/fastcheck + + - name: Run neovim/fastcheck + run: ./neovim/fastcheck + + - name: Run scripts/fastcheck + run: ./scripts/fastcheck + + - name: Check if files were modified + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Files were modified by formatting. Please run the fastcheck scripts locally and commit the changes." + git diff + exit 1 + else + echo "All files are properly formatted!" + fi \ No newline at end of file diff --git a/bin/fastcheck b/bin/fastcheck new file mode 100755 index 0000000..9f49b1b --- /dev/null +++ b/bin/fastcheck @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "🔍 Running format checks for shell files..." + +# Find and format shell scripts +find . -type f \( -name "*.sh" -o -name "*.bash" -o -name "*.zsh" \) -not -path "./.git/*" -not -path "./node_modules/*" | while read -r file; do + echo "Formatting: $file" + + # Use shfmt for shell script formatting + if command -v shfmt >/dev/null 2>&1; then + shfmt -i 2 -ci -w "$file" + else + echo "Warning: shfmt not found, skipping shell formatting" + fi +done + +# Format .zshrc specifically (skip if it has syntax issues) +if [[ -f ".zshrc" ]]; then + echo "Checking .zshrc..." + if command -v shfmt >/dev/null 2>&1; then + if shfmt -d .zshrc >/dev/null 2>&1; then + shfmt -i 2 -ci -w .zshrc + echo "Formatted .zshrc" + else + echo "Warning: .zshrc has syntax issues, skipping formatting" + fi + fi +fi + +echo "✅ Shell file formatting complete!" + +# Run other fastcheck scripts +echo "" +echo "🔄 Running neovim/fastcheck..." +./neovim/fastcheck + +echo "" +echo "🔄 Running scripts/fastcheck..." +./scripts/fastcheck + +echo "" +echo "🎉 All fastcheck scripts completed!" diff --git a/change_theme.sh b/change_theme.sh index 857229e..bb9902a 100755 --- a/change_theme.sh +++ b/change_theme.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash if [[ "$OSTYPE" == "darwin"* ]]; then - SED_COMMAND='sed -i ""' + SED_COMMAND='sed -i ""' else - SED_COMMAND='sed -i' + SED_COMMAND='sed -i' fi replace() { - $SED_COMMAND "s|$1|$2|g" "$3" + $SED_COMMAND "s|$1|$2|g" "$3" } ALACRITTY_LIGHT_THEME="solarized_light" @@ -15,8 +15,8 @@ ALACRITTY_DARK_THEME="tokyonight" ALACRITTY_CONFIG_FILE="$HOME/.config/alacritty/current-theme.toml" if [ ! -f "$ALACRITTY_CONFIG_FILE" ]; then - echo "File not found: $ALACRITTY_CONFIG_FILE" - exit 1 + echo "File not found: $ALACRITTY_CONFIG_FILE" + exit 1 fi NVIM_THEME_FILE="$HOME/.config/nvim/lua/theme.lua" @@ -24,26 +24,26 @@ NVIM_LIGHT_THEME='solarized' NVIM_DARK_THEME='tokyodark' if [ ! -f "$NVIM_THEME_FILE" ]; then - echo "File not found: $NVIM_THEME_FILE" - exit 1 + echo "File not found: $NVIM_THEME_FILE" + exit 1 fi NVIM_SERVERS=$(nvr --serverlist) if grep -q "$ALACRITTY_LIGHT_THEME" "$ALACRITTY_CONFIG_FILE"; then - # switch to dark theme - replace "$ALACRITTY_LIGHT_THEME" "$ALACRITTY_DARK_THEME" "$ALACRITTY_CONFIG_FILE" - replace "local USE_DARKMODE = false" "local USE_DARKMODE = true" "$NVIM_THEME_FILE" - for server in $NVIM_SERVERS; do - nvr --servername $server --remote-send ":colorscheme $NVIM_DARK_THEME:set background=dark" - done - echo "Changed to dark theme" + # switch to dark theme + replace "$ALACRITTY_LIGHT_THEME" "$ALACRITTY_DARK_THEME" "$ALACRITTY_CONFIG_FILE" + replace "local USE_DARKMODE = false" "local USE_DARKMODE = true" "$NVIM_THEME_FILE" + for server in $NVIM_SERVERS; do + nvr --servername $server --remote-send ":colorscheme $NVIM_DARK_THEME:set background=dark" + done + echo "Changed to dark theme" else - # switch to light theme - replace "$ALACRITTY_DARK_THEME" "$ALACRITTY_LIGHT_THEME" "$ALACRITTY_CONFIG_FILE" - replace "local USE_DARKMODE = true" "local USE_DARKMODE = false" "$NVIM_THEME_FILE" - for server in $NVIM_SERVERS; do - nvr --servername $server --remote-send ":colorscheme $NVIM_LIGHT_THEME:set background=light" - done - echo "Changed to light theme" + # switch to light theme + replace "$ALACRITTY_DARK_THEME" "$ALACRITTY_LIGHT_THEME" "$ALACRITTY_CONFIG_FILE" + replace "local USE_DARKMODE = true" "local USE_DARKMODE = false" "$NVIM_THEME_FILE" + for server in $NVIM_SERVERS; do + nvr --servername $server --remote-send ":colorscheme $NVIM_LIGHT_THEME:set background=light" + done + echo "Changed to light theme" fi diff --git a/create_linux_symlinx.sh b/create_linux_symlinx.sh index 371197d..39ab6e7 100644 --- a/create_linux_symlinx.sh +++ b/create_linux_symlinx.sh @@ -1,2 +1 @@ #/bin/zsh - diff --git a/neovim/fastcheck b/neovim/fastcheck new file mode 100755 index 0000000..6f0d03f --- /dev/null +++ b/neovim/fastcheck @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "🔍 Running format checks for Neovim Lua files..." + +# Find and format Lua files in .config/nvim +find .config/nvim -type f -name "*.lua" | while read -r file; do + echo "Formatting: $file" + + # Use stylua for Lua formatting + if command -v stylua >/dev/null 2>&1; then + stylua --config-path .config/nvim/stylua.toml "$file" 2>/dev/null || stylua "$file" + else + echo "Warning: stylua not found, skipping Lua formatting" + fi +done + +echo "✅ Neovim Lua file formatting complete!" \ No newline at end of file diff --git a/scripts/branch-checkout.ts b/scripts/branch-checkout.ts index d81211d..deee886 100755 --- a/scripts/branch-checkout.ts +++ b/scripts/branch-checkout.ts @@ -1,6 +1,6 @@ #!/usr/bin/env node -import { execSync } from 'child_process'; +import { execSync } from "child_process"; // copilot prompt: // this script gets a branch name from the command line @@ -12,12 +12,15 @@ const branchName = process.argv[2]; if (!branchName) { // get branches console.log("Please provide a branch name"); - const branches = execSync('git branch').toString().split('\n'); + const branches = execSync("git branch").toString().split("\n"); console.log(branches); process.exit(1); } -const branches = execSync(`git branch | grep ${branchName}`).toString().split('\n').filter(b => b.length > 0); +const branches = execSync(`git branch | grep ${branchName}`) + .toString() + .split("\n") + .filter((b) => b.length > 0); if (branches.length === 0) { console.log(`No branch found containing ${branchName}`); @@ -26,11 +29,10 @@ if (branches.length === 0) { if (branches.length > 1) { console.log(`Found ${branches.length} branches containing ${branchName}`); - console.log(branches) + console.log(branches); } else { const branch = branches[0].trim(); console.log(`Found branch ${branch}`); console.log(`Checking out ${branch}`); execSync(`git checkout ${branch}`); } - diff --git a/scripts/clone_praktikum.sh b/scripts/clone_praktikum.sh index 1a7bfb3..dd2ce34 100755 --- a/scripts/clone_praktikum.sh +++ b/scripts/clone_praktikum.sh @@ -5,7 +5,7 @@ GH_USER="bengldan" GH_HOST="github.zhaw.ch" for cmd in gh jq fzf; do - if ! command -v $cmd &> /dev/null; then + if ! command -v $cmd &>/dev/null; then echo "Error: $cmd is not installed." >&2 exit 1 fi diff --git a/scripts/copy-ticket-number.ts b/scripts/copy-ticket-number.ts index ada34fd..cc3fd17 100755 --- a/scripts/copy-ticket-number.ts +++ b/scripts/copy-ticket-number.ts @@ -1,28 +1,31 @@ #!/usr/bin/env bun -import { execSync } from 'child_process'; +import { execSync } from "child_process"; -const pipe = (...fns: Array<(arg: T) => T>) => (value: T) => fns.reduce((acc, fn) => fn(acc), value); +const pipe = + (...fns: Array<(arg: T) => T>) => + (value: T) => + fns.reduce((acc, fn) => fn(acc), value); try { - execSync('git status') + execSync("git status"); } catch (e) { - console.log('Not a git repository') - process.exit(1) + console.log("Not a git repository"); + process.exit(1); } -const branchPattern = /feature\/(\d+)/ +const branchPattern = /feature\/(\d+)/; const openGitInBrowser = pipe( () => execSync('git branch --list | grep "*"'), (branch) => branchPattern.exec(branch.toString()), (matches) => { - if (!matches?.[1]) throw new Error('Current branch invalid') - return matches[1] + if (!matches?.[1]) throw new Error("Current branch invalid"); + return matches[1]; }, (ticketNumber) => `echo ${ticketNumber} | pbcopy`, (command: string) => execSync(command), - () => execSync('echo "The PR template has been copied to your clipboard\!"') -) + () => execSync('echo "The PR template has been copied to your clipboard\!"'), +); -openGitInBrowser('') +openGitInBrowser(""); diff --git a/scripts/create_executable_script.sh b/scripts/create_executable_script.sh index a7dd75f..e3bfcd3 100755 --- a/scripts/create_executable_script.sh +++ b/scripts/create_executable_script.sh @@ -3,8 +3,8 @@ # Check if both the directory and script name are provided as arguments if [ $# -lt 2 ]; then - echo "Usage: create_executable_script.sh directory_name script_name" - exit 1 + echo "Usage: create_executable_script.sh directory_name script_name" + exit 1 fi # Extract directory name and script name from input arguments @@ -13,7 +13,7 @@ script_name="$2" # Create the directory if it doesn't exist if [ ! -d "$directory_name" ]; then - mkdir -p "$directory_name" + mkdir -p "$directory_name" fi # Change to the specified directory @@ -21,8 +21,8 @@ cd "$directory_name" || exit # Check if the script name already exists if [ -f "$script_name" ]; then - echo "A script with the name $script_name already exists in the directory $directory_name." - exit 1 + echo "A script with the name $script_name already exists in the directory $directory_name." + exit 1 fi # Create the new script file diff --git a/scripts/fastcheck b/scripts/fastcheck new file mode 100755 index 0000000..8fc313c --- /dev/null +++ b/scripts/fastcheck @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "🔍 Running format checks for scripts directory..." + +# Find and format shell scripts in scripts/ +find scripts -type f \( -name "*.sh" -o -name "*.bash" \) | while read -r file; do + echo "Formatting: $file" + + # Use shfmt for shell script formatting + if command -v shfmt >/dev/null 2>&1; then + shfmt -i 2 -ci -w "$file" + else + echo "Warning: shfmt not found, skipping shell formatting" + fi +done + +# Check TypeScript files for basic formatting (if prettier is available) +if command -v prettier >/dev/null 2>&1; then + find scripts -type f -name "*.ts" -not -path "*/node_modules/*" | while read -r file; do + echo "Formatting TypeScript: $file" + prettier --write "$file" + done +else + echo "Note: prettier not found, skipping TypeScript formatting" +fi + +# Check Ruby files for basic formatting (use standardrb for autofix) +if command -v standardrb >/dev/null 2>&1; then + find scripts -type f -name "*.rb" | while read -r file; do + echo "Formatting Ruby: $file" + standardrb --fix "$file" || echo "Warning: standardrb failed on $file" + done +else + echo "Note: standardrb not found, skipping Ruby formatting" +fi + +echo "✅ Scripts directory formatting complete!" \ No newline at end of file diff --git a/scripts/format_url.sh b/scripts/format_url.sh index 0d02b4d..770c7c4 100755 --- a/scripts/format_url.sh +++ b/scripts/format_url.sh @@ -11,17 +11,17 @@ FORMAT="" # Extract necessary parts based on the URL structure if [[ $URL =~ https?://[^/]+\.atlassian\.net/browse/([^ ]+) ]]; then - TICKET="${BASH_REMATCH[1]}" - FORMAT="$TICKET" + TICKET="${BASH_REMATCH[1]}" + FORMAT="$TICKET" elif [[ $URL =~ https?://[^/]+\.bitbucket\.org/[^/]+/pull-requests/([0-9]+) ]]; then - PR_NUMBER="${BASH_REMATCH[1]}" - FORMAT="#$PR_NUMBER" + PR_NUMBER="${BASH_REMATCH[1]}" + FORMAT="#$PR_NUMBER" elif [[ $URL =~ https?://[^/]+\.bitbucket\.org/[^/]+/commits/([0-9a-f]+) ]]; then - COMMIT_HASH="${BASH_REMATCH[1]}" - FORMAT="${COMMIT_HASH:0:7}" + COMMIT_HASH="${BASH_REMATCH[1]}" + FORMAT="${COMMIT_HASH:0:7}" else - echo "Unsupported URL structure." - exit 1 + echo "Unsupported URL structure." + exit 1 fi # Copy the formatted string to the clipboard diff --git a/scripts/get-pr-template.ts b/scripts/get-pr-template.ts index 63d9b56..772e02b 100755 --- a/scripts/get-pr-template.ts +++ b/scripts/get-pr-template.ts @@ -1,32 +1,35 @@ #!/usr/bin/env bun -import { execSync } from 'child_process'; +import { execSync } from "child_process"; -const pipe = (...fns: Array<(arg: T) => T>) => (value: T) => fns.reduce((acc, fn) => fn(acc), value); +const pipe = + (...fns: Array<(arg: T) => T>) => + (value: T) => + fns.reduce((acc, fn) => fn(acc), value); try { - execSync('git status') + execSync("git status"); } catch (e) { - console.log('Not a git repository') - process.exit(1) + console.log("Not a git repository"); + process.exit(1); } -const redmineBaseUrl = 'https://redmine.renuo.ch/issues/' -const branchPattern = /feature\/(\d+)/ +const redmineBaseUrl = "https://redmine.renuo.ch/issues/"; +const branchPattern = /feature\/(\d+)/; const copyTicket = pipe( () => execSync('git branch --list | grep "*"'), (branch) => branchPattern.exec(branch.toString()), (matches) => { - if (!matches?.[1]) throw new Error('Current branch invalid') - return matches[1] + if (!matches?.[1]) throw new Error("Current branch invalid"); + return matches[1]; }, (ticketNumber) => { - return `TICKET-${ticketNumber}` + return `TICKET-${ticketNumber}`; }, (prTemplate) => `echo ${JSON.stringify(prTemplate)} | pbcopy`, (command) => execSync(command), - () => execSync('echo "The PR template has been copied to your clipboard\!"') -) + () => execSync('echo "The PR template has been copied to your clipboard\!"'), +); -copyTicket('') +copyTicket(""); diff --git a/scripts/git-smart-log.ts b/scripts/git-smart-log.ts index 64ca626..4ea7db6 100755 --- a/scripts/git-smart-log.ts +++ b/scripts/git-smart-log.ts @@ -1,80 +1,82 @@ #!/usr/bin/env bun import { execSync } from "child_process"; -import { printTable } from 'console-table-printer'; -import simpleGit from 'simple-git'; +import { printTable } from "console-table-printer"; +import simpleGit from "simple-git"; -const params = process.argv.slice(2) -let filterDate = new Date() +const params = process.argv.slice(2); +let filterDate = new Date(); -if (params[0] === '--help' || params[0] === '-h') { +if (params[0] === "--help" || params[0] === "-h") { console.log(` Usage: git-smart-log [date] date: Date in format dd.mm.yyyy - `) - process.exit(0) + `); + process.exit(0); } if (params.length) { - const [day, month, year] = params[0].split('.').map(Number) + const [day, month, year] = params[0].split(".").map(Number); filterDate = new Date( year ?? new Date().getFullYear(), month ? month - 1 : new Date().getMonth(), - day ?? new Date().getDate() - ) + day ?? new Date().getDate(), + ); if (isNaN(filterDate.getTime())) { - throw new Error('Invalid date') + throw new Error("Invalid date"); } } const cwd = process.cwd(); -const { all } = await simpleGit().cwd(cwd).log(['--all']) +const { all } = await simpleGit().cwd(cwd).log(["--all"]); -const filteredCommits = all.filter(commit => { - const date = new Date(commit.date) - return date.toDateString() === filterDate.toDateString() -}) +const filteredCommits = all.filter((commit) => { + const date = new Date(commit.date); + return date.toDateString() === filterDate.toDateString(); +}); -const commits = filteredCommits.map(commit => { +const commits = filteredCommits.map((commit) => { const branch = execSync(`git branch --contains ${commit.hash}`, { cwd }) .toString() - .split('\n')[0] + .split("\n")[0] .trim() - .replace('* ', '') - .replace(/^\s+/, '') + .replace("* ", "") + .replace(/^\s+/, ""); return { ...commit, - branch - } -}) + branch, + }; +}); const sortedCommits = commits.sort((a, b) => { - const dateA = new Date(a.date) - const dateB = new Date(b.date) - return dateA.getTime() - dateB.getTime() -}) + const dateA = new Date(a.date); + const dateB = new Date(b.date); + return dateA.getTime() - dateB.getTime(); +}); const textElipsis = (str: string, maxLength: number) => { - if (str.length < maxLength) return str + if (str.length < maxLength) return str; - return str.substring(0, maxLength) + '...' -} + return str.substring(0, maxLength) + "..."; +}; -const formatedCommits = sortedCommits.map(commit => { - const formatedDate = new Date(commit.date).toLocaleTimeString() +const formatedCommits = sortedCommits.map((commit) => { + const formatedDate = new Date(commit.date).toLocaleTimeString(); return { branch: textElipsis(commit.branch, 40), author: textElipsis(commit.author_name, 10), hash: commit.hash.slice(0, 7), date: formatedDate, - message: textElipsis(commit.message, 80) - } -}) + message: textElipsis(commit.message, 80), + }; +}); -console.log(`${formatedCommits.length} commits found for ${filterDate.toDateString()}`) +console.log( + `${formatedCommits.length} commits found for ${filterDate.toDateString()}`, +); -printTable(formatedCommits) +printTable(formatedCommits); diff --git a/scripts/index.ts b/scripts/index.ts index 498795f..6933ff8 100755 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -7,10 +7,10 @@ import chalk from "chalk"; const { log } = console; const filename = process.argv[2]; -const pretendDayEnd = process.argv[3] === 'y'; +const pretendDayEnd = process.argv[3] === "y"; -const columns = ['Project', 'Date', 'Hours', 'Issue']; -const indicies: Record = {}; +const columns = ["Project", "Date", "Hours", "Issue"]; +const indicies: Record<(typeof columns)[number], number> = {}; const dateDict: Record = {}; // use a dict to aggregate hours by date @@ -43,7 +43,7 @@ createReadStream(filename) dateList.forEach(([date, hours], index) => { if (index === 0 && hours < 8.4 && pretendDayEnd) { totalHours += 8.4; - log(chalk.magenta(`${date}: ${format(hours)}, counted as 8.4`)) + log(chalk.magenta(`${date}: ${format(hours)}, counted as 8.4`)); } else { totalHours += hours; @@ -56,11 +56,13 @@ createReadStream(filename) }); log(`\nTotal hours: ${format(totalHours)}`); - log(`Expected hours: ${format(8.4 * dateList.length)}`) - log(`\nOvertime in this period: ${format(totalHours - 8.4 * dateList.length)}`) + log(`Expected hours: ${format(8.4 * dateList.length)}`); + log( + `\nOvertime in this period: ${format(totalHours - 8.4 * dateList.length)}`, + ); log(`Average hours: ${format(totalHours / dateList.length)}`); - log(`Total days: ${dateList.length}`) + log(`Total days: ${dateList.length}`); }); // helpers diff --git a/scripts/open-repo-in-browser.ts b/scripts/open-repo-in-browser.ts index 8120425..456b16f 100755 --- a/scripts/open-repo-in-browser.ts +++ b/scripts/open-repo-in-browser.ts @@ -1,24 +1,27 @@ #!/usr/bin/env bun -import { execSync } from 'child_process'; +import { execSync } from "child_process"; -const pipe = (...fns: Array<(arg: T) => T>) => (value: T) => fns.reduce((acc, fn) => fn(acc), value); +const pipe = + (...fns: Array<(arg: T) => T>) => + (value: T) => + fns.reduce((acc, fn) => fn(acc), value); try { - execSync('git status') + execSync("git status"); } catch (e) { - console.log('Not a git repository') - process.exit(1) + console.log("Not a git repository"); + process.exit(1); } -const branch = execSync('git rev-parse --abbrev-ref HEAD').toString() +const branch = execSync("git rev-parse --abbrev-ref HEAD").toString(); const openGitInBrowser = pipe( - () => execSync('git remote get-url origin').toString().trim(), - (output) => output.split('@')[1].replace(':', '/'), - (path) => `https://${path.replace('.git', '')}`, + () => execSync("git remote get-url origin").toString().trim(), + (output) => output.split("@")[1].replace(":", "/"), + (path) => `https://${path.replace(".git", "")}`, (url) => `open ${url}/tree/${branch}`, - (command) => execSync(command).toString() -) + (command) => execSync(command).toString(), +); -openGitInBrowser('') +openGitInBrowser(""); diff --git a/scripts/open-ticket-in-browser.ts b/scripts/open-ticket-in-browser.ts index 49efaee..13b5fc8 100755 --- a/scripts/open-ticket-in-browser.ts +++ b/scripts/open-ticket-in-browser.ts @@ -1,29 +1,31 @@ #!/usr/bin/env bun -import { exec, execSync } from 'child_process'; +import { exec, execSync } from "child_process"; -const pipe = (...fns: Array<(arg: T) => T>) => (value: T) => fns.reduce((acc, fn) => fn(acc), value); +const pipe = + (...fns: Array<(arg: T) => T>) => + (value: T) => + fns.reduce((acc, fn) => fn(acc), value); try { - execSync('git status') + execSync("git status"); } catch (e) { - console.log('Not a git repository') - process.exit(1) + console.log("Not a git repository"); + process.exit(1); } -const redmineBaseUrl = 'https://redmine.renuo.ch/issues/' -const branchPattern = /feature\/(\d+)/ +const redmineBaseUrl = "https://redmine.renuo.ch/issues/"; +const branchPattern = /feature\/(\d+)/; const openGitInBrowser = pipe( () => execSync('git branch --list | grep "*"'), (branch) => branchPattern.exec(branch), (matches) => { - if (!matches?.[1]) throw new Error('Current branch invalid') - return matches[1] + if (!matches?.[1]) throw new Error("Current branch invalid"); + return matches[1]; }, (ticketNumber) => `open ${redmineBaseUrl}${ticketNumber}`, - (command) => execSync(command) -) - -openGitInBrowser('') + (command) => execSync(command), +); +openGitInBrowser(""); diff --git a/scripts/pretty-pulls.ts b/scripts/pretty-pulls.ts index f941ee4..c2e839c 100755 --- a/scripts/pretty-pulls.ts +++ b/scripts/pretty-pulls.ts @@ -10,32 +10,44 @@ curl -L \ https://api.github.com/repos/renuo/khw2/pulls\?state=all | ./pretty-pulls.ts > file.html && open file.html */ -let data = ''; +let data = ""; process.stdin.resume(); -process.stdin.setEncoding('utf8'); +process.stdin.setEncoding("utf8"); -process.stdin.on('data', (chunk) => { +process.stdin.on("data", (chunk) => { data += chunk; }); type PullRequest = { - html_url: string - number: number - title: string - merged_at: string | null - user: { login: string } -} + html_url: string; + number: number; + title: string; + merged_at: string | null; + user: { login: string }; +}; -const prs: { username: string, url: string, number: number, title: string, mergedAt: string | null }[] = [] +const prs: { + username: string; + url: string; + number: number; + title: string; + mergedAt: string | null; +}[] = []; -process.stdin.on('end', () => { +process.stdin.on("end", () => { try { - const pulls = JSON.parse(data) as PullRequest[] - pulls.forEach(pull => { - const { title, number, html_url, user, merged_at } = pull - prs.push({ title, number, url: html_url, username: user.login, mergedAt: merged_at }) - }) + const pulls = JSON.parse(data) as PullRequest[]; + pulls.forEach((pull) => { + const { title, number, html_url, user, merged_at } = pull; + prs.push({ + title, + number, + url: html_url, + username: user.login, + mergedAt: merged_at, + }); + }); console.log(` @@ -63,25 +75,29 @@ elements.forEach((element) => element.classList.toggle("hidden")); -${prs.map(pr => { - return ` +${prs + .map((pr) => { + return ` ${pr.title} ${pr.title}#${pr.number} ${pr.username} ${pr.mergedAt} #${pr.number} -`}).join('')} +`; + }) + .join("")} -`) +`); } catch (e) { console.error(e); } -}) - +}); diff --git a/scripts/simplecov_parser.rb b/scripts/simplecov_parser.rb index 13d4b40..ea1139e 100755 --- a/scripts/simplecov_parser.rb +++ b/scripts/simplecov_parser.rb @@ -44,22 +44,22 @@ def initialize(html_file) def parse(options = {}) @options = options - + File.open(@html_file, 'r') do |file| @doc = Nokogiri::HTML(file) end if @options[:uncovered_only] - puts "SimpleCov Coverage Report - Uncovered Issues Only" - puts "=" * 55 + puts 'SimpleCov Coverage Report - Uncovered Issues Only' + puts '=' * 55 parse_uncovered_only else - puts "SimpleCov Coverage Report" - puts "=" * 50 + puts 'SimpleCov Coverage Report' + puts '=' * 50 parse_summary parse_groups end - rescue => e + rescue StandardError => e puts "Error parsing coverage file: #{e.message}" exit 1 end @@ -75,7 +75,9 @@ def parse_summary coverage_percent = all_files_section.css('.covered_percent .green').first&.text&.strip hits_per_line = all_files_section.css('.covered_strength .green').first&.text&.strip - total_files = all_files_section.css('div').find { |div| div.text.match(/\d+ files in total/) }&.text&.match(/(\d+)/)[1] + total_files = all_files_section.css('div').find do |div| + div.text.match(/\d+ files in total/) + end&.text&.match(/(\d+)/)&.[](1) line_summary = all_files_section.css('.t-line-summary').first if line_summary @@ -94,7 +96,14 @@ def parse_summary puts "\nOverall Coverage:" puts " Files: #{total_files}" puts " Line Coverage: #{coverage_percent} (#{covered_lines}/#{relevant_lines} lines)" - puts " Branch Coverage: #{branch_summary ? calculate_branch_percentage(covered_branches, total_branches) : 'N/A'} (#{covered_branches}/#{total_branches} branches)" if branch_summary + if branch_summary + puts " Branch Coverage: #{if branch_summary + calculate_branch_percentage(covered_branches, + total_branches) + else + 'N/A' + end} (#{covered_branches}/#{total_branches} branches)" + end puts " Average Hits/Line: #{hits_per_line}" puts end @@ -112,7 +121,7 @@ def parse_groups def parse_group(section) group_name = section.css('.group_name').first&.text - + # In uncovered-only mode, check if group has any issues before showing if @options[:uncovered_only] files = section.css('.file_list tbody .t-file') @@ -125,7 +134,7 @@ def parse_group(section) end puts "Group: #{group_name}" - puts "-" * (group_name.length + 7) + puts '-' * (group_name.length + 7) unless @options[:uncovered_only] coverage_percent = section.css('.covered_percent .green').first&.text&.strip @@ -188,12 +197,12 @@ def parse_file_summary(file_row) puts " Branch Coverage: #{branch_coverage} (#{covered_branches}/#{total_branches})" if total_branches.to_i > 0 puts " Average Hits: #{avg_hits}" - if file_id + return unless file_id + parse_file_details(file_id, file_path) - end end - def parse_file_details(file_id, file_path) + def parse_file_details(file_id, _file_path) source_table = @doc.css("##{file_id}").first return unless source_table @@ -215,11 +224,11 @@ def parse_file_details(file_id, file_path) end end - if !uncovered_lines.empty? || !partial_lines.empty? - puts " Issues:" + return unless !uncovered_lines.empty? || !partial_lines.empty? + + puts ' Issues:' puts " Uncovered lines: #{uncovered_lines.join(', ')}" unless uncovered_lines.empty? puts " Partially covered lines: #{partial_lines.join(', ')}" unless partial_lines.empty? - end end def parse_uncovered_only @@ -230,12 +239,12 @@ def parse_uncovered_only if all_files_section line_summary = all_files_section.css('.t-line-summary').first branch_summary = all_files_section.css('.t-branch-summary').first - - missed_lines = line_summary&.css('.red b')&.first&.text || "0" - missed_branches = branch_summary&.css('.red b')&.first&.text || "0" + + missed_lines = line_summary&.css('.red b')&.first&.text || '0' + missed_branches = branch_summary&.css('.red b')&.first&.text || '0' total_issues = missed_lines.to_i + missed_branches.to_i - + if total_issues == 0 puts "\nPerfect coverage! No uncovered lines or branches found." return @@ -249,7 +258,8 @@ def parse_uncovered_only end def calculate_branch_percentage(covered, total) - return "0.0%" if total.to_i == 0 + return '0.0%' if total.to_i == 0 + percentage = (covered.to_f / total.to_f * 100).round(1) "#{percentage}%" end @@ -289,14 +299,14 @@ def show_help def find_coverage_file(directory, filename) path = File.join(directory, filename) return path if File.exist?(path) - + # Try some common variations variations = [ File.join(directory, 'index.html'), File.join('.', 'coverage', 'index.html'), File.join('.', 'coverage_reports', 'index.html') ] - + variations.find { |variation| File.exist?(variation) } end @@ -308,24 +318,24 @@ def find_coverage_file(directory, filename) OptionParser.new do |opts| opts.banner = "Usage: #{$0} [options] coverage_file.html" - - opts.on("-d", "--directory DIR", "Coverage directory") do |dir| + + opts.on('-d', '--directory DIR', 'Coverage directory') do |dir| coverage_dir = dir end - - opts.on("-f", "--file FILE", "Coverage HTML file") do |file| + + opts.on('-f', '--file FILE', 'Coverage HTML file') do |file| coverage_file = file end - - opts.on("-v", "--verbose", "Show verbose output") do + + opts.on('-v', '--verbose', 'Show verbose output') do options[:verbose] = true end - - opts.on("-u", "--uncovered-only", "Show only files with uncovered lines/branches") do + + opts.on('-u', '--uncovered-only', 'Show only files with uncovered lines/branches') do options[:uncovered_only] = true end - - opts.on("-h", "--help", "Show this help message") do + + opts.on('-h', '--help', 'Show this help message') do show_help exit end @@ -341,13 +351,13 @@ def find_coverage_file(directory, filename) else target_file = find_coverage_file(coverage_dir, coverage_file) unless target_file - puts "Error: Coverage file not found" - puts "Tried looking for:" + puts 'Error: Coverage file not found' + puts 'Tried looking for:' puts " #{File.join(coverage_dir, coverage_file)}" - puts " ./coverage/index.html" - puts " ./coverage_reports/index.html" + puts ' ./coverage/index.html' + puts ' ./coverage_reports/index.html' puts - puts "Make sure you have run your test suite with SimpleCov enabled." + puts 'Make sure you have run your test suite with SimpleCov enabled.' exit 1 end end @@ -356,7 +366,7 @@ def find_coverage_file(directory, filename) begin require 'nokogiri' rescue LoadError - puts "Error: nokogiri gem not found. Please install it with: gem install nokogiri" + puts 'Error: nokogiri gem not found. Please install it with: gem install nokogiri' exit 1 end @@ -364,4 +374,4 @@ def find_coverage_file(directory, filename) puts parser = SimpleCovParser.new(target_file) -parser.parse(options) +parser.parse(options) diff --git a/scripts/startup-communications.sh b/scripts/startup-communications.sh index 720df10..07ad50c 100755 --- a/scripts/startup-communications.sh +++ b/scripts/startup-communications.sh @@ -13,4 +13,3 @@ open -a "Slack" open -a "Spark Mail" - diff --git a/scripts/zip_split.sh b/scripts/zip_split.sh index 2195771..a054520 100755 --- a/scripts/zip_split.sh +++ b/scripts/zip_split.sh @@ -30,9 +30,9 @@ EOF # --- Platform-aware file size function --- file_size() { if [[ "$(uname)" == "Darwin" ]]; then - stat -f%z "$1" # macOS + stat -f%z "$1" # macOS else - stat --printf="%s" "$1" # Linux + stat --printf="%s" "$1" # Linux fi } @@ -81,12 +81,12 @@ for FILE in "$SOURCE_DIR"/*; do [[ -f "$FILE" ]] || continue SIZE=$(file_size "$FILE") - if (( SIZE > MAX_SIZE_BYTES )); then + if ((SIZE > MAX_SIZE_BYTES)); then echo "⚠️ Skipping large file: $(basename "$FILE") (${SIZE} bytes)" continue fi - if (( CURRENT_SIZE + SIZE > MAX_SIZE_BYTES && CURRENT_SIZE > 0 )); then + if ((CURRENT_SIZE + SIZE > MAX_SIZE_BYTES && CURRENT_SIZE > 0)); then ZIP_NAME="$OUTPUT_DIR/${ZIP_PREFIX}${PART_INDEX}.zip" echo "📦 Creating $ZIP_NAME..." zip -j -q "$ZIP_NAME" "${CURRENT_BATCH[@]}" @@ -99,11 +99,10 @@ for FILE in "$SOURCE_DIR"/*; do CURRENT_SIZE=$((CURRENT_SIZE + SIZE)) done -if (( ${#CURRENT_BATCH[@]} > 0 )); then +if ((${#CURRENT_BATCH[@]} > 0)); then ZIP_NAME="$OUTPUT_DIR/${ZIP_PREFIX}${PART_INDEX}.zip" echo "📦 Creating $ZIP_NAME..." zip -j -q "$ZIP_NAME" "${CURRENT_BATCH[@]}" fi echo "✅ Done! Created zip files in '$OUTPUT_DIR'." - From 83a62f7df5f69fad85cf94c39bd5e332b190b5f1 Mon Sep 17 00:00:00 2001 From: Daniel Bengl Date: Wed, 24 Sep 2025 16:39:41 +0200 Subject: [PATCH 2/3] Remove unused setup yml --- .github/workflows/setup.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/workflows/setup.yml diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml deleted file mode 100644 index 5d3b6f4..0000000 --- a/.github/workflows/setup.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Macos Install - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] -jobs: - build: - runs-on: macOS-latest - - steps: - - uses: actions/checkout@v1 - - name: Execute full install - run: ./setup.sh From 91f403e7498ef354577cf92f295dc13ff8e812ee Mon Sep 17 00:00:00 2001 From: Daniel Bengl <53896675+CuddlyBunion341@users.noreply.github.com> Date: Wed, 24 Sep 2025 16:40:10 +0200 Subject: [PATCH 3/3] Delete .config/nvim/lua/plugins/conform.lua --- .config/nvim/lua/plugins/conform.lua | 38 ---------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .config/nvim/lua/plugins/conform.lua diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua deleted file mode 100644 index 4ca3b67..0000000 --- a/.config/nvim/lua/plugins/conform.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - -- "stevearc/conform.nvim", - -- event = { "BufReadPre", "BufNewFile" }, - -- config = function() - -- local conform = require("conform") - -- - -- conform.setup({ - -- formatters_by_ft = { - -- javascript = { "prettier" }, - -- typescript = { "prettier" }, - -- javascriptreact = { "prettier" }, - -- typescriptreact = { "prettier" }, - -- svelte = { "prettier" }, - -- css = { "prettier" }, - -- html = { "prettier" }, - -- json = { "prettier" }, - -- java = { "prettier" }, - -- yaml = { "prettier" }, - -- markdown = { "prettier" }, - -- graphql = { "prettier" }, - -- lua = { "stylua" }, - -- }, - -- format_on_save = { - -- lsp_fallback = true, - -- async = false, - -- timeout_ms = 100, - -- }, - -- }) - -- - -- vim.keymap.set({ "n", "v" }, "mp", function() - -- conform.format({ - -- lsp_fallback = true, - -- async = false, - -- timeout_ms = 500, - -- }) - -- end, { desc = "Format file or range (in visual mode)" }) - -- end, -}