summary refs log tree commit diff
path: root/.vim/lua/misc.lua
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2020-12-07 19:15:23 +0100
committerRobert Günzler <r@gnzler.io>2021-01-21 19:39:11 +0100
commit04db98668639cb0b431d50e5963f6b156d728078 (patch)
tree4bec29af1c9c34852e974be06301f74de4802199 /.vim/lua/misc.lua
parent9b8005439ac351ded8f6286aefa2378d25d7add5 (diff)
vim: big update; move lots of things to lua
Diffstat (limited to '.vim/lua/misc.lua')
-rw-r--r--.vim/lua/misc.lua18
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