I am running gvim 9.0 on Windows 10. I am developing Python code. I am using Miniconda and I run gvim from a Miniconda CMD shell.

For this reason I prepared a .bat file for starting gvim with the following content

@echo off
call C:\Users\myself\Miniconda3\condabin\activate.bat C:\Users\myself\Miniconda3\envs\myenv
gvim -c "vert botright call term_start('C:\\Users\\myself\\Miniconda3\\condabin\\conda.bat activate myenv && echo Conda env:%CONDA_DEFAULT_ENV% && ipython --profile=autoreload_profile', {'term_name': 'IPYTHON'})"

In my .vimrc I have defined the following variable and mapping

let g:ipython_terminal_name = 'IPYTHON'
autocmd FileType python nnoremap <F9> yy \| :call term_sendkeys(g:ipython_terminal_name,@")<cr>j0

but I noticed a strange behavior that I wish to explain through an example. Consider the following text (on the left I reported the line numbers)

1 a = 3
2 b = 5
4 c = 3
5 d = 4
7 e = 5

If cursor is located on line 3 and I hit F9, then nothing is sent to the terminal (as it should be) but then the cursor jumps directly to line 5 (i.e. line 4 is skipped). This happens only when the cursor is located on a blank line.

I cannot understand why this happens, if someone could explain I would be grateful. I would be even more grateful if someone could suggest a workaround.

If more details are needed, please let me know so I can update the question.

  • Without knowing where g:ipython_terminal_name comes from, it will be hard to reproduce this. Can you provide a minimal series of commands to establish the behavior (which, I agree, looks odd).
    – D. Ben Knoble
    Oct 19, 2022 at 19:33
  • You are right! I have updated my question, I think the current informative level is enough to let people to reproduce, mutatis mutandis, the issue.
    – Barzi2001
    Oct 20, 2022 at 9:53


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.