-- misc stuff implemented in lua local M = {} function M.do_under_cursor(obj, cb) return cb(vim.fn.expand(vim.fn.expand(obj))) end function M.word_under_cursor(cb) return M.do_under_cursor('', cb) end function M.expr_under_cursor(cb) return M.do_under_cursor('', cb) end function M.file_under_cursor(cb) return M.do_under_cursor('', cb) end function M.open_under_cursor(cmd) return M.file_under_cursor(function(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) end return M