rest-nvim / rest.nvim

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

Delay after pressing `<Plug>RestNvim` #237

Closed mawkler closed 2 months ago

mawkler commented 1 year ago

There's a delay after pressing the <Plug>RestNvim. It seems to have length vim.o.timeoutlen, even though there's only one mapping. Here's a minimal config where I've mapped <CR> to <Plug>RestNvim:

{
  'NTBBloodbath/rest.nvim',
  dependencies =  'nvim-lua/plenary.nvim',
  config = function()
    require('rest-nvim').setup({})
    vim.keymap.set('n', '<CR>', '<Plug>RestNvim')
  end
}

If I press a key like j for instance immediately after invoking <Plug>RestNvim the request gets sent immediately.

mawkler commented 1 year ago

Changing from <Plug>RestNvim to rest.run fixes the issue:

{
  'NTBBloodbath/rest.nvim',
  dependencies =  'nvim-lua/plenary.nvim',
  config = function()
    local rest = require('rest-nvim')
    rest.setup({})
    vim.keymap.set('n', '<CR>', rest.run)
  end
}

So there seems to be some issue with the <Plug> mapping.

boltlessengineer commented 2 months ago

Closing this due to v3 release. Now rest.nvim don’t provide any default <plug> mapping, instead it comes with user commands like :Rest run

Also, all code is rewrite to be asynchronous so it won’t block the editor while sending the request

mawkler commented 2 months ago

Great! Thank you for your awesome work!