neoterm icon indicating copy to clipboard operation
neoterm copied to clipboard

Declaring already opened term as a neoterm

Open seb-mueller opened this issue 5 years ago • 4 comments

Is your feature request related to a problem? Please describe. Sometimes I have already a term open that have special properties that can't be achieved by :Topen etc. It would be nice to declare such a term as a neoterm, i.e. being able to use it like a term created via :Topen

Describe the solution you'd like Introducing a command that i.e. :TasNeoterm or something like that which would declare the current term as a neoterm. E.g. in neovim invoke :split | :term or create a term in any other way, then :TasNeoterm to include it in the list of neoterm with its own id.

Maybe this is already possible, but I seem to not be able to find how to do this.

seb-mueller avatar Jun 01 '20 10:06 seb-mueller

This should do what you are asking for I think: :call neoterm#new({'from_event': 1})

mbudde avatar Jun 30 '20 11:06 mbudde

Brilliant, exactly what I was looking for! For convenience, I've added the following to my vimrc, I believe this might be useful to other looking for this:

command! TMakeNeoterm call neoterm#new({'from_event': 1})

seb-mueller avatar Jun 30 '20 12:06 seb-mueller

Ever since the latest commit https://github.com/kassio/neoterm/commit/1283da9f078669593f3828e4345b68b59ee9740f this has stopped working. Upon call neoterm#new({'from_event': 1}) on a manually created terminal, neoterm opens a new split (with new neoterm) rather than declaring it to a neoterm.. Any suggestion on how to fix this?

seb-mueller avatar Dec 03 '20 15:12 seb-mueller

Just to add, I believe the following line is causing this to happen:

https://github.com/kassio/neoterm/blob/1283da9f078669593f3828e4345b68b59ee9740f/autoload/neoterm.vim#L34

Naivly, I've tried to call call neoterm#new({'from_session': 1, 'id': l:id, 'termid': l:id}) instead of call neoterm#new({'from_event': 1}) which didn't work, since l:id is not defined, and also replacing l:id by a number doesn't work. Maybe I'm missing something here but can't quite figure out how to make it work, any help is appreciated!

seb-mueller avatar Jan 25 '21 13:01 seb-mueller