1

The terminal in vim 8.1 looks awesome.

https://www.vim.org/vim-8.1-released.php

I was hoping however that I'd be able to yank from another window and paste into the new vim terminal at the prompt, and it looks like this doesn't work. Is there another way to copy/paste into the vim terminal from another vim window?

2

Using Vim's term_sendkeys :

  • open a vim terminal

  • check which buffer the terminal is in with :ls

  • this example assumes the terminal is in buffer 2

  • cmd to copy the content to the " register and paste/run in the terminal
    :%y | call term_sendkeys(2, @")

The command can then be mapped like this example:
:nnoremap <leader>sk :%y \| :call term_sendkeys(2, @")<CR>


Plugin Options :
There are also many plugins available.

This one is the next step up from manual steps.
I've tried it and it works and was updated in September of 2020.

Also, its README includes an extensive list of related plugins. If few of these have continued to be updated in 2021.

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.