rest-nvim / rest.nvim

A fast Neovim http client written in Lua
GNU General Public License v3.0
1.52k stars 141 forks source link

(bug): Cannot change my buffers using Shift h l #353

Closed Redoxahmii closed 5 months ago

Redoxahmii commented 5 months ago

When you send a request and get the results afterwards you cannot switch between buffers and it stucks it there.

daniilrozanov commented 5 months ago

You can change this behaviour. Look at

keybinds = {
        buffer_local = false,
        prev = "H",
        next = "L",
      },

inside result in setup config example. This is default settings and buffer_local=false means than HL keys switch result panes from any active buffer (global keymaps). Set it to true, if you want to have HL switch result panes only if your current buffer is result buffer.

You probably have HL to switch buffers. By default, the plugin overwrites HL actions forever, once the result buffer is opened. To avoid this behaviour, set buffer_local to true, or set prev and next to some unique mappings, e.g. <space>rp, <space>rn, or any combination of that. See #350 and #351

Redoxahmii commented 5 months ago

You can change this behaviour. Look at

keybinds = {
        buffer_local = false,
        prev = "H",
        next = "L",
      },

inside result in setup config example. This is default settings and buffer_local=false means than HL keys switch result panes from any active buffer (global keymaps). Set it to true, if you want to have HL switch result panes only if your current buffer is result buffer.

You probably have HL to switch buffers. By default, the plugin overwrites HL actions forever, once the result buffer is opened. To avoid this behaviour, set buffer_local to true, or set prev and next to some unique mappings, e.g. <space>rp, <space>rn, or any combination of that. See #350 and #351

Thanks for the quick reply. I would recommend keeping buffer_local to true as default as most people would not want it to be global keymaps compared to the workflow i have seen for most people.

One last thing is is there some way the data that is fetched could be formatted or saved in a separate file ?

I have my own plugin json-to-ts.nvim which does a simple conversion for types in Typescript and would love if it could save the res to a file for integration with my own plugin. Thank you for your time. I will close this issue after you reply.

NTBBloodbath commented 5 months ago

I would recommend keeping buffer_local to true as default as most people would not want it to be global keymaps compared to the workflow i have seen for most people.

Could you please open a PR to change this behavior if you don't mind? I agree it's saner that way :p

One last thing is is there some way the data that is fetched could be formatted or saved in a separate file ?

I have my own plugin json-to-ts.nvim which does a simple conversion for types in Typescript and would love if it could save the res to a file for integration with my own plugin. Thank you for your time. I will close this issue after you reply.

Not right now, could you open a separate issue for that as a feature request? That could help to keep track of it :p

Redoxahmii commented 5 months ago

Could you please open a PR to change this behavior if you don't mind? I agree it's saner that way :p

Created a PR which changes this behavior.

Not right now, could you open a separate issue for that as a feature request? That could help to keep track of it :p

Also created a Feature request for saving files.