--- Personal lua config files for NeoVim. -- Last Changed: 2023-02-17 -- Author: Federico Igne -- License: This file is placed in the public domain. local map = vim.keymap local function tag() local old = vim.fn.split(vim.fn.system('git describe --tags --abbrev=0'),'\n',1)[1] local new = vim.fn.input('tag: ' .. old .. ' -> ') if new:len() == 0 then print("Empty tag not allowed.") else local msg = { "release(" .. new .. "): <++>", "" } local log = vim.fn.systemlist('git log --reverse --oneline ' .. old .. '..HEAD') for _,l in ipairs(log) do table.insert(msg,l) end vim.cmd.Git('tag -a "' .. new .. '"') vim.api.nvim_buf_set_lines(0, 0, -1, false, msg) end end vim.keymap.set('n', 'ct', tag, { buffer = true })