On 12/11/09 12:21, anna klein wrote:
> Basically, I would like to insert sentence(s) at several positions in my
> document. The sentences are quite random. It can be inserting lines of
> sentences or just a character of \<NL> that is a new line. I have a list
> of sentences and the position where I should place the sentences. So, I
> guess the best thing to do is use 'goto' and then use 'normal i'.my
> sentences.
> For my function, I want the insertion of \<NL> should be preceded by an
> indent, so that if there is insertion later, I don't need to check
> whether there is a tab or not.
> However, for insertion of many sentences, I just want it copy blindly
> what the list says. If there is a indent at the front, then my document
> should have. If no indent, then my document should not have one.
>
> Is there a way to turn on and off this auto indent?
> I tried to turn off autoindent and smartindent before doing my function,
> but no luck.
>
> Anna
Having a blank line with one or more whitespace on it, and nothing else,
is not unheard-of, but to my mind it's rather weird: I prefer that none
of my lines end in whitespace unless there's a damn good reason for it,
as after the two-space column in a patch (and I don't use Vim to
generate patches anyway).
I suppose that (with 'autoindent' on; 'smartindent' setting is
irrelevant here)
normal ox^H
where ^H is entered by
(press and hold Ctrl)
(press and release v) (or q if you use Ctrl-V to paste)
(press and release h)
(release Ctrl)
might be a possible solution to what you're asking for. (Disclaimer: I
haven't tried it.)
Normally, 'autoindent' copies the existing indent when you open a new
line by Normal mode o or O, or Insert-mode <Enter>, but if you return to
Normal mode without having written any text on that line the indent is
removed. If you hit insert-mode <Enter> without having entered any text,
the indent is removed on the line you leave but added back on the new one.
With 'autoindent' and 'smartindent' both set you may get additional
indentation depending on the first word in the line above,
With 'autoindent' off, new lines don't get any indent (unless, of
course, 'cindent', 'indentexpr' or 'lisp' defines filetype-dependent
indentation for that buffer).
'paste' also disables indenting.
Best regards,
Tony.
--
If you're right 90% of the time, why quibble about the remaining 3%?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---