~xenrox/srht-patches.nvim

e8ea6b874607df6e4e9031092f3a240f366a0b4c — Thorben Günther 2 years ago 520ef43
Look at Cc header as well
1 files changed, 3 insertions(+), 2 deletions(-)

M lua/srht-patches/init.lua
M lua/srht-patches/init.lua => lua/srht-patches/init.lua +3 -2
@@ 50,12 50,13 @@ end

-- checks if patch was sent to a specified mailing address
local function check_address()
  local line = vim.fn.search("^To:.*$", "nw")
  local line_to = vim.fn.search("^To:.*$", "nw")
  local line_cc = vim.fn.search("^Cc:.*$", "nw")

  for _, val in ipairs(vim.g.srht_patches_address_list) do
    local regex = vim.regex(val)
    -- match_line is zero based, while search is one based
    if regex:match_line(0, line - 1) then
    if regex:match_line(0, line_to - 1) or regex:match_line(0, line_cc - 1) then
      return true
    end
  end