1

If I run term_start('zsh', {'term_name': 'MYTER','vertical': v:true}) I get the expected behavior, but if I run term_start('zsh', {'term_name': 'MYTER','belowright': v:true}) will produce E475: Invalid argument: belowright, in-spite from the doc one can read

"vertical" split the window vertically; note that other window position can be defined with command modifiers, such as :belowright.

I am using MacVim 9.0.

5
  • Could we ask you if you are you using Vim or Neovim? Feb 23, 2023 at 11:31
  • 1
    I am using MacVim. Edited main post.
    – Barzi2001
    Feb 23, 2023 at 11:32
  • 1
    @VivianDeSmedt No term_start() in Neovim.
    – romainl
    Feb 23, 2023 at 12:50
  • you probably need to understand what they mean by command modifier. I have no clue. Feb 23, 2023 at 12:56
  • Checked. belowright appears to be a command modifier.
    – Barzi2001
    Feb 23, 2023 at 13:47

1 Answer 1

1

The vertical mentioned in the doc is a key in a dictionary. The function knows how to handle that vertical key but it can't handle any arbitrary key like belowright or foobar. In other words, belowright is not part of the type expected by the function so you get an error if you try it.

The command modifiers in question are :help :vertical, :help :belowright, :help :topleft, etc. They are used before a command that creates a new window, to influence how the split is done.

In this case, "the command that creates a new window" is the whole:

:call term_start('zsh', {'term_name': 'MYTER', 'vertical': v:true})

which means that you are supposed to use :belowright like this:

:belowright call term_start('zsh', {'term_name': 'MYTER', 'vertical': v:true})
2
  • In-fact I had the feeling that vertical was a pre-defined key of a dictionary and that my attempt was not going to work. I also try the nastier ...'vertical': belowright :D Needless to say it didn't work - it, not surprisingly, complained about the value type associated to the key vertical :D Nevertheless, I solved with botright term_start(... in my vimscript. :)
    – Barzi2001
    Feb 23, 2023 at 14:54
  • Why not removing vertical key if you can use the keyword vertical as command modifier like belowright, etc? That would be a more neat implementation imo.
    – Barzi2001
    Feb 24, 2023 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.