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
3
4 c = 3
5 d = 4
6
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.
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).