From: Mark Knecht <markknecht@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: [gentoo-user] Paste into vim keeping indention or original?
Date: Thu, 27 Jan 2011 11:07:34 -0800 [thread overview]
Message-ID: <AANLkTi=LXA_RdXPrbJYrnwJQAtF5ZZfEh=1r-20Zx5e4@mail.gmail.com> (raw)
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
next reply other threads:[~2011-01-27 19:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-27 19:07 Mark Knecht [this message]
2011-01-27 19:22 ` [gentoo-user] Re: Paste into vim keeping indention or original? 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='AANLkTi=LXA_RdXPrbJYrnwJQAtF5ZZfEh=1r-20Zx5e4@mail.gmail.com' \
--to=markknecht@gmail.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox