Edit a python file with vim adddf.py
, and type vert term
and python3
, there are two windows in vim.
cat adddf.py
def add_df(df,number):
import re
new_df = pd.DataFrame()
nrow = df.shape[0]
ncol = df.shape[1]
for i in range(0,nrow):
for j in range(0,ncol):
new_df.at[i,j] = df.iloc[i,j] + number
return new_df
I want to copy some lines and execute it in left window, write a function:
function! CopyRun(start,stop)
normal a:start,a:stop y+
wincmd p
call feedkeys("\<C-W>\"+")
endfunction
When I call it with:
call CopyRun(1,9)
I get the following output
- Nothing executed in python terminal,and nothing in
+
register - the previous python function changed into below:
d:start:stop y+ef add_df(df,number):
import re
new_df = pd.DataFrame()
nrow = df.shape[0]
ncol = df.shape[1]
for i in range(0,nrow):
for j in range(0,ncol):
new_df.at[i,j] = df.iloc[i,j] + number
return new_df
- in bottom left, it says:
emmet#anchorizeURL(0)
After following the answer from Maxim Kim
in my .vimrc
.
I get a new issue :
exe "normal! " . a:start . "," . a:stop . "y+"
How to fix it?