diff options
| author | Robert Günzler <r@gnzler.io> | 2020-12-07 19:15:23 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2021-01-21 19:39:11 +0100 |
| commit | 04db98668639cb0b431d50e5963f6b156d728078 (patch) | |
| tree | 4bec29af1c9c34852e974be06301f74de4802199 /.vim/lua/misc.lua | |
| parent | 9b8005439ac351ded8f6286aefa2378d25d7add5 (diff) | |
vim: big update; move lots of things to lua
Diffstat (limited to '')
| -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 |