diff options
Diffstat (limited to '.vim/lua/misc.lua')
| -rw-r--r-- | .vim/lua/misc.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/.vim/lua/misc.lua b/.vim/lua/misc.lua new file mode 100644 index 0000000..8b26ed1 --- /dev/null +++ b/.vim/lua/misc.lua @@ -0,0 +1,18 @@ +-- misc stuff implemented in lua + +local M = {} + +function M.open_under_cursor(cmd) + local txt = vim.fn.expand('<cfile>') + local txt = vim.fn.expand(txt) + if not cmd then + vim.fn.inputsave() + cmd = vim.fn.input('open with: ') + vim.fn.inputrestore() + end + if cmd then + c = vim.loop.spawn(cmd, { args = {txt} }, function() c:close() end) + end +end + +return M |