I typically work with a text editor combined with a REPL terminal, and I send text from the editor to the terminal. For example, I use two side-by-side buffers, one for editing text, and one with a terminal buffer running either R or python.

Sometimes when I am editing text in the editor buffer, I would like to see the autocomplete options that my terminal would suggest if I were typing the text the terminal buffer. I havent been able to find a plugin or method to do this, but it seems like it should be possible. Is there any way I can map autocompletion in a text buffer in insert mode to show what the terminal would show if the text were written there?

To be clear, I am not just looking for completion suggestions of text that is already in the terminal buffer (CTRL-N already does that). Rather I am looking for the text that the terminal suggests, based on the objects and function arguments that the terminal already "knows" about.

I believe the way to do this would be to take my current line of text in the editor, paste it in the terminal, get the tab-completion options that the terminal suggests, and show those over my cursor in the editor buffer.

Are there any packages that do this, or something like this? Or, how could I go about building something that does this in vimscript?


Your Answer

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

Browse other questions tagged or ask your own question.