public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Paste into vim keeping indention or original?
@ 2011-01-27 19:07 Mark Knecht
  2011-01-27 19:22 ` [gentoo-user] " Mark Knecht
  2011-01-27 22:38 ` James
  0 siblings, 2 replies; 10+ messages in thread
From: Mark Knecht @ 2011-01-27 19:07 UTC (permalink / raw
  To: gentoo-user

What is the solution to begin able to paste code I find on the web
into a file in vim and being able to keep the indentation from
changing?

For instance, here's the first few lines of code from a web page:

#define ARRAYSIZE(x)  (sizeof(x)/sizeof(*(x)))

int main(void)
{
   const char filename[] = "file.csv";
   /*
    * Open the file.
    */

The indentation on the code from const down is consistently 3 spaces:


Pasted into vi:

#define ARRAYSIZE(x)  (sizeof(x)/sizeof(*(x)))

int main(void)
{
   const char filename[] = "file.csv";
      /*
          * Open the file.
              */

In this case const is correct, but the next line is 6 spaces, then 9
spaces, then 12 spaces.

If it matters, I'm using KDE using Konsole, but I've seen this in
other WMs. I looked at the Tab settings in my Konsole profile but
nothing seems to matter.

Thanks,
Mark



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-01-28 22:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-27 19:07 [gentoo-user] Paste into vim keeping indention or original? Mark Knecht
2011-01-27 19:22 ` [gentoo-user] " Mark Knecht
2011-01-27 19:28   ` Mike Gilbert
2011-01-27 20:11     ` Petri Rosenström
2011-01-27 20:53     ` YoYo Siska
2011-01-28 17:08       ` Bill Longman
2011-01-28 20:03         ` kashani
2011-01-28 22:42           ` Bill Longman
2011-01-28 20:20         ` David Abbott
2011-01-27 22:38 ` James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox