toggleterm.nvim icon indicating copy to clipboard operation
toggleterm.nvim copied to clipboard

Size and direction options ordering swallow direction setting when ordered alphabetically

Open yamafaktory opened this issue 2 years ago • 2 comments

Hi @akinsho and thanks for this awesome project 👍️!

While playing with the configuration, I noticed a somewhat surprising behavior.

Depending on how you order the configuration options, the direction one might be skipped.

Working configuration

In this case the direction is working as expected:

use {
  'akinsho/toggleterm.nvim',
  config = function()
    require('toggleterm').setup {
      size = 70,
      direction = 'vertical',
      float_opts = {
        border = 'none'
      },
    }
  end
}

Non-working configuration

In this case the direction fallbacks to horizontal:

use {
  'akinsho/toggleterm.nvim',
  config = function()
    require('toggleterm').setup {
      direction = 'vertical',
      size = 70,
      float_opts = {
        border = 'none'
      },
    }
  end
}

TL;DR: size must be set before direction to get direction working.

yamafaktory avatar Oct 23 '21 08:10 yamafaktory

Hi @yamafaktory thanks for raising this, been a bit busy so haven't had time to dig in yet. That's definitely not intentional though.

akinsho avatar Oct 26 '21 22:10 akinsho

@akinsho thanks for the swift reply! No worries at all. I haven't checked the source code and I'm pretty new to Lua and its ecosystem. I'll try to find some time to dig deeper.

yamafaktory avatar Oct 27 '21 06:10 yamafaktory

I've just revisited this for the first time in a while and I don't believe this is the case (at least anymore). I've just tried moving the size key and it doesn't change whether or not the direction key works (on the latest commit of this repo).

If you're still experiencing this issue let me know on what version and also a minimal init.lua that I can use to test with

akinsho avatar Apr 16 '23 08:04 akinsho