From b84cfc5bceacf0d50a7d8e6fc5946dbbf4f2aa08 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Mon, 30 Aug 2021 18:23:43 +0200 Subject: vim: update snips.lua --- .vim/lua/snips.lua | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.vim/lua/snips.lua b/.vim/lua/snips.lua index aa7b0bf..b15ffbf 100644 --- a/.vim/lua/snips.lua +++ b/.vim/lua/snips.lua @@ -5,25 +5,33 @@ local system = function(cmd) local args = vim.split(cmd, ' ') local command = args[1] table.remove(args, 1) - return table.concat(require('plenary.job'):new({ + local output = require('plenary.job'):new({ command = command, args = args, enable_recording = true, - }):sync(), '\n') + }):sync() + if #output > 1 then + return table.concat(output, '\n') + else + return output[1] + end end end local U = require'snippets.utils' require('snippets').snippets = { _global = { + today = [[${=os.date("%Y-%m-%d")}]], nowutc = [[${=os.date("!%Y-%m-%dT%H:%M:%SZ")}]], nowloc = [[${=os.date("%Y-%m-%dT%H:%M:%S%z")}]], + me = [[${=io.popen('git config --get user.name'):read"*l"} <${=io.popen('git config --get user.email'):read"*l"}>]], + ok = "✔", bad = "✘", - todo = U.force_comment [[NOTE(${=io.popen("id -un"):read"*l"}): ]], - note = U.force_comment [[TODO(${=io.popen("id -un"):read"*l"}): ]], + todo = U.force_comment [[TODO(${=io.popen("id -un"):read"*l"}): ]], + note = U.force_comment [[NOTE(${=io.popen("id -un"):read"*l"}): ]], }, sh = { -- {{{ @@ -106,4 +114,9 @@ ${0} \end{document} ]], }, -- }}} + + org = { + todo = [[* TODO ]], + note = [[* ]], + } } -- cgit 1.4.1