I open vim and have the following code:
1 a = range(10)
2 for b in a:
3 print(b)
I then open an ipython within vim by typing:
:term ipython
I yank the code by doing :1,2y
and then go over to the ipython terminal and do "" to paste the yanked code.
The problem I have is that the spaces are not respected as shown below. Notice how print(a)
is a lot further to the right compared to before.
In [2]: for a in b:
...: print(a)
...:
I've seen this behaviour before when pasting things into a normal vim using -V however usually some version of set paste, set nopaste works. Though in this case it didn't.
Does anyone know how I can make this work?
thank you
I'm running ubuntu 18.04.2 LTS. Vim installation info in case helpful
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 10 2018 21:31:58)
Included patches: 1-1453
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version without GUI. Features included (+) or not (-):
+acl +comments +file_in_path +linebreak +mouse_urxvt +quickfix +terminal +windows
+arabic +conceal +find_in_path +lispindent +mouse_xterm +reltime +terminfo +writebackup
+autocmd +cryptv +float +listcmds +multi_byte +rightleft +termresponse -X11
-autoservername +cscope +folding +localmap +multi_lang -ruby +textobjects -xfontset
-balloon_eval +cursorbind -footer -lua -mzscheme +scrollbind +timers -xim
+balloon_eval_term +cursorshape +fork() +menu +netbeans_intg +signs +title -xpm
-browse +dialog_con +gettext +mksession +num64 +smartindent -toolbar -xsmp
++builtin_terms +diff -hangul_input +modify_fname +packages +startuptime +user_commands -xterm_clipboard
+byte_offset +digraphs +iconv +mouse +path_extra +statusline +vertsplit -xterm_save
+channel -dnd +insert_expand -mouseshape -perl -sun_workshop +virtualedit
+cindent -ebcdic +job +mouse_dec +persistent_undo +syntax +visual
-clientserver +emacs_tags +jumplist +mouse_gpm +postscript +tag_binary +visualextra
-clipboard +eval +keymap -mouse_jsbterm +printer +tag_old_static +viminfo
+cmdline_compl +ex_extra +lambda +mouse_netterm +profile -tag_any_white +vreplace
+cmdline_hist +extra_search +langmap +mouse_sgr -python -tcl +wildignore
+cmdline_info +farsi +libcall -mouse_sysmouse +python3 +termguicolors +wildmenu
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -fdebug-prefix-map=/build/vim-NQEcoP/vim-8.0.1453=. -fstack-protector-strong -Wformat -Werror=form
at-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib/pytho
n3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm
spaces
not atab
so everything is `spaces