DEV Community

Discussion on: No More postman just use cURL + vim =

Collapse
 
izifortune profile image
Fabrizio Fortunato • Edited

Interesting article and sparkle my interest to write a small function for this as you cannot really read a buffer with a command.

function M.Exec()
  lines = vim.fn.getline(1, '$')
  command = ''
  for key, val in pairs(lines) do .
    command = command .. val
  end
  output = vim.fn.systemlist(command)
  vim.api.nvim_command('rightbelow new')
  buf = vim.api.nvim_get_current_buf() 
  vim.api.nvim_buf_set_lines(buf, 0, -1, false, output)
end
return M

Forgot to mention you need to have the latest neovim to enjoy built in lua.