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