kassio / neoterm

Wrapper of some vim/neovim's :terminal functions.
Other
1.32k stars 117 forks source link

Declaring already opened term as a neoterm #286

Open seb-mueller opened 4 years ago

seb-mueller commented 4 years ago

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.

mbudde commented 4 years ago

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

seb-mueller commented 4 years ago

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 commented 3 years ago

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 commented 3 years ago

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!