Closed amsibamsi closed 6 years ago
If you mean something like !!
, you could do:
nnoremap <silent> <leader>tR :call neoterm#exec(['!!', '', ''])<cr>
I think this is related to the original question, is there a way to send keyboard events to the neoterm terminal? E.g. sometimes I want to send the <C-d>
(end of input) or <C-c>
to kill the process ruinning in the neoterm terminal. This functionality can be done with regular vim bindings
(e.g. tnoremap <leader>td a<C-c><C-\><C-n>
)
d'oh. From the README...RTFM...
" kills the current job (send a <c-c>)
nnoremap <silent> ,tc :call neoterm#kill()<cr>
Looking through the source now I can see that it's simply a matter of escaping the command like
nnoremap <leader>td :call neoterm#exec("\<C-d>")
Sorry for all the noise on this issue - Thank you so much for writing this plugin! It's made my workflow dreamlike!
I tried your suggestions. I also discovered the kill() function after some time ;-)
exec() does not seem to work for me. It sends the string as is to my shell, not interpreting the control sequences.
I'm using fish shell, maybe that makes things different from bash/zsh. To clarify, I wanted to send control sequences like
exec() does not seem to work for me. It sends the string as is to my shell, not interpreting the control sequences. I'm using fish shell, maybe that makes things different from bash/zsh
This plugin wasn't tested in fish shell, maybe the way we need to send the commands to it is different, but I don't have any knowledge about that. 😞
To clarify, I wanted to send control sequences like (previous command from history, and enter) to the terminal window while in normal mode focusing another editor window with text.
The enter
usually is just an empty value after the desired command, for control sequences I use
\<c-ANYTHING IN HERE>
and usually it works in zsh and bash, but again, this can be different in fish.
@justinmk you know anything if send commands to fish shell is different from bash/zsh? (asking because neoterm just uses neovim's api to do it)
In case anyone else comes here years later, like me, I'll add that there is now Tkill
which is perfect.
How can I define a mapping to send control sequences to the terminal, e.g. to repeat the last command?