Tuesday, July 29, 2014

quirk of ":set paste"

From ":help paste":

Put Vim in Paste mode. This is useful if you want to cut or copy
some text from one window and paste it in Vim. This will avoid
unexpected effects.
[...]
When the 'paste' option is switched on (also when it was already on):
- mapping in Insert mode and Command-line mode is disabled
- abbreviations are disabled
- 'textwidth' is set to 0
- 'wrapmargin' is set to 0
- 'autoindent' is reset
- 'smartindent' is reset
- 'softtabstop' is set to 0
- 'revins' is reset
- 'ruler' is reset
- 'showmatch' is reset
- 'formatoptions' is used like it is empty

I can see the usefulness of most of those options, but one that I don't
understand, and one that bugs me, is "'ruler' is reset". How does an
out-of-band information display about the current cursor position
"avoid unexpected effects"?

I use autocommands to set textwidth and autoindent settings on posts to
Usenet (and private newsgroups). This is very helpful for reformatting
text-on-the-fly when pasted from a webpage to (a) maintain a fixed
indent to help identify the block quote and (b) keep lines from
exceeding 72 columns.

There are rare times that I am cut-n-pasting already formatted text, eg,
source code, man page fragments, etc. In those cases I use "set paste"
to disable the textwidth and autoindent settings. However I'd still like
to know how long the lines are, so the reset of "ruler" is annoying.

Why?

Elijah

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: