Vim copy line numbers

From raju

Task: When discussing about code related issues in an email, I prefer to copy paste the relevant lines with their numbers prefixed at the front.

 14 int dow_to_downum(const string & dow)
 15 {
 16         // dow = day of the week
 17         int downum = 0;
 18
 19         if (!dow.compare("sun"))
 20         {
 21                 downum = 0;
 22         }
 23         else if (!dow.compare("mon"))
 24         {
 25                 downum = 1;
 26         }
...
 47         else
 48         {
 49                 cerr << "error!!! unable to recognize dow = " << dow << endl;
 50                 downum = -1;
 51
 52         }
 53
 54         return (downum);
 55 }

Here is how to do this in vim.

Open a file in gvim
:set nu
select the rows of interest using mouse
:print  (note: this will be changed to :`<,`>print since we are using visual mode to define the area of operation)
select the text using mouse

Ref:-

http://vim.1045645.n5.nabble.com/set-nu-gt-how-to-copy-lines-with-line-numbers-td1186325.html