vim.keymap.set('v', '', function () local start_pos = vim.fn.getpos('.') local end_pos = vim.fn.getpos('v') local selection = vim.fn.getregion( start_pos, end_pos, { type = vim.fn.mode() } ) local code = selection[1] for i = 2, #selection do code = code .. '\n' .. selection[i] end local tmp = os.tmpname() local f = io.open(tmp, 'w') f:write(code) f:flush() f:close() vim.system({ 'curl', 'http://localhost:8000', '--data-urlencode', 'code@' .. tmp }):wait() os.remove(tmp) end)