From e94f77a0ae45e0bc50d3ee3a2250eca7bfbaf7c8 Mon Sep 17 00:00:00 2001 From: pseudometa <73286100+chrisgrieser@users.noreply.github.com> Date: Fri, 27 Oct 2023 23:52:09 +0200 Subject: [PATCH] feat(commitMsg): spellcheck of commit msg (opt-in) --- README.md | 4 ++++ lua/tinygit/commit-and-amend.lua | 7 +++++++ lua/tinygit/config.lua | 11 ++++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 268561d..2222a0c 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,10 @@ local defaultConfig = { "style", "revert", "ci", "docs", "break", "improv", }, }, + + -- enable vim's builtin spellcheck for the commit message input field + -- (configured to ignore capitalization and correctly consider camelCase) + spellcheck = false, }, asyncOpConfirmationSound = true, -- currently macOS only issueIcons = { diff --git a/lua/tinygit/commit-and-amend.lua b/lua/tinygit/commit-and-amend.lua index 3232e68..fcd35fc 100644 --- a/lua/tinygit/commit-and-amend.lua +++ b/lua/tinygit/commit-and-amend.lua @@ -96,6 +96,13 @@ local function setGitCommitAppearance() -- activate styling of statusline plugins vim.api.nvim_buf_set_name(0, "COMMIT_EDITMSG") + + -- spellcheck + if conf.spellcheck then + vim.opt_local.spell = true + vim.opt_local.spelloptions = "camel" + vim.opt_local.spellcapcheck = "" + end end, }) end diff --git a/lua/tinygit/config.lua b/lua/tinygit/config.lua index c8bf765..be38995 100644 --- a/lua/tinygit/config.lua +++ b/lua/tinygit/config.lua @@ -17,11 +17,8 @@ local M = {} ---@field maxLen number ---@field mediumLen number ---@field emptyFillIn string ----@field enforceConvCommits enforceConvCommitsConfig - ----@class enforceConvCommitsConfig ----@field enabled boolean ----@field keywords string[] +---@field enforceConvCommits {enabled: boolean, keywords: string[]} +---@field spellcheck boolean ---@class searchFileHistoryConfig ---@field diffPopupWidth number @@ -50,6 +47,10 @@ local defaultConfig = { "style", "revert", "ci", "docs", "break", "improv", }, }, + + -- enable vim's builtin spellcheck for the commit message input field. + -- (configured to ignore capitalization and correctly consider camelCase) + spellcheck = false, }, asyncOpConfirmationSound = true, -- currently macOS only issueIcons = {