Extra spacing in Vim when copying and pasting from Chrome -
this question has answer here:
whenever copy text has been indented vim chrome, cascading indent instead of consistent one, so:
def fn(x): """takes x input , returns y if x: return y
becomes:
def fn(x): """takes x input , returns y if x: return y
how prevent (preferred), or how fix spacing using other vim commands (acceptable)?
extra info
- vim 7.4, chromium 34 on arch linux
- copy method: highlight (mouse or otherwise) in chromium,
ctrl-c
, switch vim , insert mode,shift-ctrl-v
.
when paste using of terminal/os's default method (menu, contextual menu, shortcut, mouse…) text not pasted: inserted if typed it. because have enabled autoindenting, vim indents every line , end stairway (to hell) effect.
you have 2 options…
paste/nopaste
and/orpastetoggle
:you can
:set paste
disable autoindenting , formatting before paste ,:set nopaste
afterward.if decide take path, suggest read
:h pastetoggle
make whole process little less taxing.vim's own commands , clipboard integration:
if vim build comes clipboard support, can use
"+p
or"*p
paste other programs without side effects.the default vim comes oses "small" build may lack number of useful features. if intend use vim primary editor programming advised install beefier build comes clipboard support. on debian-based systems, best choice "vim-gtk" or "vim-gnome". on arch, think have install "gvim" package.
Comments
Post a Comment