summary refs log tree commit diff
path: root/.vim/lua/misc.lua
blob: 8b26ed169e4e531f495e7d85a54dff45c1c7fc82 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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