I'm developing a GUI client of Neovim, and looking for the way to get the text in command input area using msgpack-rpc. I mean that the 'text in command input area' is the bottom of Neovim window. (Sorry, I'm not sure how to express it.) enter image description here

Does Neovim have any APIs to get it like buffer_get_line()?

  • That is typically and variously called the (ex/colon) command line/prompt. I cannot remember what the documentation calls it, if it has a name, but I believe it to be simply the command line.
    – D. Ben Knoble
    Nov 28 '18 at 5:28
  • 1
    You’ll have the best luck getting this answered by neovim maintainers; I’d file an issue on their github
    – D. Ben Knoble
    Nov 28 '18 at 5:29
  • You can use getcmdline getcmdtype (see also getcmdpos if you want the cursor position)
    – doraemon
    Nov 29 '18 at 0:28

I found a solution. https://github.com/neovim/neovim/blob/master/runtime/doc/ui.txt

Attaching the ui by |nvim_ui_attach()| method with option `ext_cmdline=true', then the cmdline_xxxx methods are callback from neovim.

  • If you're building a UI then ext_cmdline is the best solution. Otherwise you could also use the VimL getcmdline() function. E.g. nvim_eval("getcmdline()") Dec 18 '18 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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