neoclide / coc-python

Python extension for coc.nvim, fork of vscode-python
574 stars 51 forks source link

How to stop the execution when python.execInTerminal? #227

Closed afonsocraposo closed 4 years ago

afonsocraposo commented 4 years ago

Is there a way to stop the execution of a python script when the command :CocCommand python.execInTerminal is executed in nvim?

afonsocraposo commented 4 years ago

I found out that it's possible to stop the execution by entering the buffer where the python script is being executed, then press I to enter INSERT mode and then press <C-c> (Ctrl+c). I also added the following key bind to my config file: autocmd Filetype python nnoremap <C-c> :silent !pkill -f '[p]ython.*%'<CR> Which kills the execution and can be called anywhere.