linux - How to copy all the text from vim editor using vim command line? -


i want select text vim editor, tried command :%y+ getting error e850: invalid register name. command this link. please me how copy text file open in vim. using yank, meaning of it..

tldr: if want copy text in vim system clipboard type ggvg"*y. explanation below...

vim runs in terminal and, depending upon how using , type of vim running, it's not designed select text mouse , copy , paste in traditional way.

if want select of text using vim use ggvgy (note uppercase vg in middle). command moves cursor top of file, enters visual mode, moves bottom of file (thus, selecting of text) , yanks (copies) it. can use p put (paste) code but inside of vim.

if want copy clipboard use somewhere outside of vim try this:

first, select using commands outlined above but without final y: (ggvg). press "*y. should copy operating system's clipboard , can paste (ctrl/cmd+v) anywhere want outside of vim. can vary depending on settings have vim should work.


a brief explanation of commands used. gg goes top of file. v enters visual mode lines. g goes end of file. y yanks (copies) text not clipboard. p puts (pastes) text.

the more advanced (i.e. cool) stuff:

" allows access registers. example "a provides access register a.

the * system clipboard "* provides access system keyboard. therefore, "*y yanks system clipboard.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -