Paste Mode: Pasting text (and indenting it) in Vim

Pasting a block of code copied from elsewhere in Vim is a nightmare, unless you know how to do it right. The autoindent (and, possibly, smartindent) features of Vim go crazy when you yank and slap a block of text. How do you do it right, then? This is not a new trick, but something I did not know about for a long time, so I suppose it is reasonable to assume many others who use Vim may not have come across it either. It is called the “paste mode“. In Vim, you can enable the paste mode by typing “:set paste” on Vim’s command interface. Once the paste mode is enabled, you can paste the block(s) of code you have yanked from elsewhere, and disable the paste mode through the command “:set nopaste” as soon as you are done with pasting text. A bit inconvenient, but it is a handy feature to get familiar with if you use Vim a lot to write code.

Python programmers would run into syntax error problems if they execute source code files in which they pasted code in the paste mode. I am not completely certain on this, but when text is pasted in paste mode, the copied lines are indented with spaces irrespective of the tab character and tab width defined for the open Vim session. If you tend to indent source files by the tab character (something probably any sane Python developer should do), this will definitely create problems. There is an easy way to fix this. Just after you turn off the paste mode, highlight the pasted text by moving the cursor to the first line pasted, pressing “shift + v” to enable “visual” mode in Vim (which is used solely for highlighting blocks of text), and dragging the highlight marker down until all the pasted text is highlighted, and pressing either the right angle bracket (>) or the left (<) to conveniently indent the block of highlighted text right and left according to the tab character and tab width set for the current Vim session. Simply indenting left once, and then right once will get the block of code back to its original indent position, but will additionally (and this is the important bit) indent the block according to the currently defined tab width and tab character settings. Pretty convenient, eh?

Epilogue: How to terminate your PTCL Broadband DSL contract

After months of bearing mental torture, limited or no connectivity, and bandwidth and service charges apparently without having a usable service at hand, I have finally decided to throw in the towel and terminate the contract I have for PTCL Brandband DSL service. Now, since the monthly bill for the service comes augmented with the telephone bill, there is no easy way out to cancel the service. From what I gathered from the support folks, roughly here is the tedious procedure:

  • Grab a photocopy of the last paid telephone bill, along with a copy of your NIC.
  • If you still have the receipt from when you got the service, get a copy of that too; if not, then skip it, it is optional.
  • If you have been a subscriber for less than a year, you’ll have to return all the equipment, so pack it up in the box and get it ready.
  • Jot down an application addressed to (I believe) the PTCL DSL officer.
  • Head down to the nearest PTCL exchange office.
  • Hunt down the PTCL DSL officer in there somewhere.
  • Turn over the equipment (if any), application, photocopies of aforementioned documents, fill up a form, sign it up, and return it to the officer.

I think that is about it. I will go through all the hoops next week, so by that time, if I find any incoherency in the steps I have scribbled down, I’d definitely edit it up, and post an update.

I wrote a post a while back about the problems I have been facing with PTCL DSL. Apparently, judging from the responses the post attracted alone and from first-hand conversations I had with people, I am not the only one who has been annoyed the hell out of my mind from issues with PTCL DSL. In my case, I am willing to admit that it is mainly the low Signal-Noise Ratio (SNR) that is severely clamping down the connectivity — and, more often, completely chopping off all connectivity. However, I would like to highlight the fact that I had been using DSL for over an year on the exact same line, and I never had connectivity-related problems with it, despite the fact that on days when it would rain badly and the phone line would be nearly defunct, the DSL would continue to function nearly efficiently.

If you look at the tariff provided by similar DSL providers, such as,, and look back at the packages PTCL provides at relatively cheaper rates, and consider the problems people have been facing with PTCL DSL in particular, you’d be bent on believing that there is definitely a catch involved.

For what it’s worth, I had my stretch with PTCL DSL, and as much as I would’ve wanted it otherwise, it just didn’t work out between us.

Currently, I am content with WiMax from Wateen. Almost as a rule, wired connectivity is always superior to wireless, but, I suppose, those rules don’t apply here.

So, yes, I still haven’t quite got over it!

Apparently, in what appears to be a decision that is beyond my comprehension, the almighty staff at Slashdot, in their infinite wisdom, thought it necessary to turn down my rather serious and (what appeared to me to be a) reasonably well-written, on-topic and coherent post on CRT Monitors causing headaches about a month ago, but found it well worth their time to let through an inane post by a wife looking for advice on which computer chair to buy for her husband to gift him on father’s day.

So much for rubbing it in, and doing a hell of a great job at it.

lolcat picture!

I put up my first lolcat picture last night. You might find it both cute and funny. The malnourished cat in the picture was trying to hide amidst plants in the porch next to our little garden.