We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be useful to have an additional function/method that could work in any buffer, not just http filetype
Here is an example use case:
Imagine you are in a JSON file, and one of the key values is a url. You could place the cursor on the URL and send a request with a single keymap.
This could always assume the use of the GET method.
The text was updated successfully, but these errors were encountered:
Agreed, for now you can use:
vim.keymap.set("n", "<leader>r", function() local line = vim.fn.getline(".") local url_pattern = [[https?://[%w-_%.%d:/?&=]+]] local url_under_cursor = string.match(line, url_pattern) -- If a URL was found, proceed with the curl request if url_under_cursor then require('plenary.job') :new({ command = "curl", args = { "--silent", url_under_cursor }, on_exit = function(job, return_val) if return_val == 0 then local result = table.concat(job:result(), "\n") Snacks.notify.info(result, { ft = "json" }) else Snacks.notify.error("Failed to fetch URL") end end, }) :start() else Snacks.notify.warn("No URL found in the current line") end end, { desc = 'curl', noremap = true, silent = true })
Little preview:
Sorry, something went wrong.
No branches or pull requests
It would be useful to have an additional function/method that could work in any buffer, not just http filetype
Here is an example use case:
Imagine you are in a JSON file, and one of the key values is a url. You could place the cursor on the URL and send a request with a single keymap.
This could always assume the use of the GET method.
The text was updated successfully, but these errors were encountered: