Skip to content
New issue

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

docs: added lazyvim reference configs #499

Conversation

jsouzadasilva
Copy link

This adds a section called "Reference configs", under "Usage". I added the reference for LazyVim, but this could be expanded for other neovim distributions.

The reference config can give people something to start with, or even use it as is.

Let me know if I should do any formatting of it's a bad idea to add this in the README.md.

README.md Outdated
Comment on lines 260 to 360
#### LazyVim

plugins/rest-nvim.lua

```lua
return {
{
"rest-nvim/tree-sitter-http",
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"http",
},
},
},
{
"folke/which-key.nvim",
event = "VeryLazy",
opts_extend = { "spec" },
opts = {
spec = {
{
mode = { "n", "v" },
{ "<leader>h", group = "rest", icon = { icon = "󰒲", color = "purple" } },
},
},
},
},
{
"rest-nvim/rest.nvim",
event = "VeryLazy",
ft = { "http" },
keys = {
{
"<leader>ho",
"<cmd>Rest open<cr>",
desc = "Open result pane",
},
{
"<leader>hr",
"<cmd>Rest run<cr>",
desc = "Run request under the cursor",
},
{
"<leader>hn",
function()
vim.ui.input({ prompt = "Enter request @name" }, function(input)
if input and input ~= "" then
vim.cmd("Rest run " .. input)
else
vim.notify("No input provided", vim.log.levels.ERROR) -- Show error
end
end)
end,
desc = "Run request with name <name>",
},
{
"<leader>hh",
"<cmd>Rest last<cr>",
desc = "Run request under the cursor",
},
{
"<leader>hl",
"<cmd>Rest logs<cr>",
desc = "Edit logs file",
},
{
"<leader>hc",
"<cmd>Rest cookies<cr>",
desc = "Edit cookies file",
},
{
"<leader>he",
"<cmd>Rest env show<cr>",
desc = "Show dotenv file registered to current .http file",
},
{
"<leader>h.",
"<cmd>Rest env select<cr>",
desc = "Select & register .env file with vim.ui.select()",
},
{
"<leader>hs",
function()
vim.ui.input({ prompt = "Enter env path" }, function(input)
if input and input ~= "" then
vim.cmd("Rest env set " .. input)
else
vim.notify("No input provided", vim.log.levels.ERROR) -- Show error
end
end)
end,
desc = "Register .env file to current .http file",
},
},
},
}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: enclosing the reference configs section children headers in an HTML <details> tag could reduce the visual clutter by default, If anyone wants to see them, they can use the toggle "button" text from the tag.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed, thank you!

@jsouzadasilva jsouzadasilva force-pushed the feat/add-lazyvim-config-ref branch from fd07262 to d46ab92 Compare December 20, 2024 15:54
@boltlessengineer
Copy link
Contributor

Thanks for the PR and for taking the time to contribute! While I appreciate the effort, I think adding reference configs to the README isn’t the best fit for rest.nvim.

  • rest.nvim already use rockspec to manage dependencies so you don't need to define those in lazyspec (especially tree-sitter-http. If you are using current version of nvim-treesitter, adding http parser in nvim-treesitter config is enough)
  • <leader> keymaps are usually for user-defined ones, so including defaults could unintentionally override user preferences.

I’d like to keep the README focused on core usage and let users adapt the plugin to their setups.

Maybe we can add this in wiki instead.

Copy link
Contributor

@boltlessengineer boltlessengineer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is good idea to add this in Readme. Maybe we can add this in wiki instead.

@jsouzadasilva
Copy link
Author

Thanks for the PR and for taking the time to contribute! While I appreciate the effort, I think adding reference configs to the README isn’t the best fit for rest.nvim.

  • rest.nvim already use rockspec to manage dependencies so you don't need to define those in lazyspec (especially tree-sitter-http. If you are using current version of nvim-treesitter, adding http parser in nvim-treesitter config is enough)
  • <leader> keymaps are usually for user-defined ones, so including defaults could unintentionally override user preferences.

I’d like to keep the README focused on core usage and let users adapt the plugin to their setups.

Maybe we can add this in wiki instead.

Got it, I'm closing this then. If you need help adding this to the wiki let me know, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants