Thanks John - that took care of the retab issue.
I have another question, though.
I decided against setting a textwidth and formatoptions and au normal
gqG because of a couple of issues (see below). I am letting wordwrap
render the file according to the width of the terminal in which it is
opened. This works fine, except that one paragraph is considered to be
one line and "j" scrolls down by an entire paragraph and not a virtual
(or rendered) line.
To help this, I am considering mapping j and k (or the arrow keys) to
gj and gk so that the scrolling happens from one line to the next
virtual line and not from to the next actual line.
1) My first choice is remapping the arrow keys? Is this a bad idea?
Should I rempa only for specific modes?
2) If not, how do i remap the arrow keys? I mean in the "map key
mapped_key" command, how do I represent the right arrow in the place
of key?
Issues with tw 80 and fo=crqa
-------------------------------------------
1) When textwdith iss set to 80 and I have two lines of code like
//This is a comment; This is a comment This is a comment
printf("Hello, World\n");
commenting out the printf with a // gives me
//This is a comment; This is a comment This is a comment printf("Hello, World\n"
//);
which seems quite ugly
2) When the file being opened is not a C file, but some document, and
I have a paragraph like
Introduction
This is a comment.
This is another comment
gq on this paragraph gives me
Introduction This is a comment. This is another comment
Is there a better setting for fo?
Thanks
On Sat, Feb 6, 2010 at 4:28 AM, John Little <[email protected]> wrote:
> On Feb 6, 2:25 pm, Girish Venkatasubramanian <[email protected]>
> wrote:
>> 1) Automatic retab ...
>
>> if &modifiable
>> if has("autocmd")
>> au BufReadPost * retab
>> endif
>> endif
>>
>> but still executing "help:retab" complains...
>
> You're testing modifiable at start up, you want to test it when the
> auto command fires. Perhaps something like
>
> if has("autocmd")
> au BufReadPost * if &modifiable | retab | endif
> endif
>
> BTW, it's a good idea to put auto commands in a group. See :help
> autocmd-groups
>
>> 2) I can reformat the entire document according to my formatoptions by
>> gggq<Shift+g>.
>
> Try the normal command, it lets you do what you would type:
>
> normal gggqG
>
> in vim script is exactly like typing that in normal mode, hence its
> name.
>
> Regards, John
>
> --
> You received this message from the "vim_use" maillist.
> For more information, visit http://www.vim.org/maillist.php
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php