Wednesday, June 1, 2011

Re: Weird auto-comment after 72 lines

On Jun 1, 8:31 am, Thilo Six <T....@gmx.de> wrote:
> Efraim Yawitz wrote the following on 01.06.2011 13:38
>
> > Try :help cinoptions (specifically, the *N value for which the help says:
>
> >     *N    Vim searches for unclosed comments at most N lines away.  This
> >           limits the time needed to search for the start of a comment.
> >           (default 30 lines).
>
> It seems that the above mentioned helptext already got updated in the mercurial
> repo:
>
> ,----[ :h indent.txt ]------------------------
>
>                                                         *cino-star*
> *N    Vim searches for unclosed comments at most N lines away.  This
>       limits the time needed to search for the start of a comment.
>       If your /* */ comments stop indenting afer N lines this is the
>       value you will want to change.
>       (default 70 lines).
> `---------------------------------------------
>
> -- <snip> --
>
> --

I knew I remembered a discussion of this on the mailing list recently,
but I could not find the patch for it. Apparently that's because just
the documentation was updated.

--
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

Re: Folding

On Jun 1, 8:37 am, Eric Weir <eew...@bellsouth.net> wrote:
> I'm a Vim novice, and a writer not a programmer. I've perused the responses to questions about folding in the Vim FAQ. It's largely Greek to me. I have a couple questions:

> I understand folds can be indented.

How do you mean? You can fold based on existing indent, which will
fold all lines having the same indent into a single displayed line,
where "line" means a newline-terminated string.

Or, if you have a fold, you can use the >> operator to increase the
indent of everything inside the fold.

Or perhaps you mean something different.

> Is it possible to get Vim to wrap words to the indent column?

Word wrapping and folding are two completely unrelated topics.

Again, what do you mean by wrapping? Usually this means you have a
single long line which Vim displays on many lines by "wrapping" the
text which goes past the edge of the window. This is accomplished by
setting the 'wrap' option and probably 'linebreak' as well so that Vim
only wraps at word boundaries.

Unfortunately, using this wrap method, there is no way to
automatically start the next displayed line at the appropriate indent
level unless you modify the Vim executable. Since you say you're not a
programmer, this is probably an intimidating task.

There are a couple of partial solutions. The first would be to use the
'showbreak' option, which will add text to be displayed at the
beginning of each wrapped line. This text can be simply a number of
spaces, in effect creating an indent for wrapped lines. However,
'showbreak' affects every line in the same way, regardless of indent.

The next option would be to not use this "soft wrap" feature, but
instead us a "hard wrap" and insert real line breaks to wrap your
text. If you set 'formatoptions' to contain the 't' and 'a' flags, and
set 'textwidth' appropriately, Vim will automatically reformat each
paragraph as you type it so you don't need to worry about keeping this
up-to-date.

> Is there a way I can get folds to persist across a save and reload?
>

I understand the :mkview command will save manual folds, which
the :loadview command will restore. There is probably a plugin to do
this for you automatically.

If you fold using another method (e.g. indent, as mentioned above)
then you can either set up a command in your .vimrc to automatically
set this fold method for certain file types or file names. For
example,

autocmd BufRead *.txt set foldmethod=indent

Or, you could include a line such as the following at either the top
or bottom of every file you wish to do this for:

vim: foldmethod=indent

This is called a "modeline". By default, Vim scans the first and last
few lines in a file for lines in this format, and uses them to set
options on a per-file basis, overriding your built-in defaults
and .vimrc settings. Many *nix systems disable these globally, but you
could re-enable them in your .vimrc if you have this problem.

--
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

vim and *.doc

Hi buddies
Anyone have any idea of a plugin or add-on which will work Msoffice documents (Word in particular) in the vim way?

Regards
Rodrigo

--
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

Re: Vim scripts: insert new line staying with normal mode

Thank you, Tim. A good approach!

Also thank you, Gary. I misunderstand double quote.

2011/5/31 Gary Johnson <garyjohn@spocom.com>:
> On 2011-05-31, Steven Lee wrote:
>> Hi all,
>>
>> It sounds like some vim users have asked similar question, but not
>> exactly what I want.
>>
>> I attempt to write a function implementing insert new line which
>> filled consecutive  '=' :
>>
>>     let len = 5
>>     let @x = '='
>>     exe 'normal! ' . 'o\\<Esc\\>0' . '"x' . len . 'p'
>>
>> My solution is below:
>> 1. o -- enter new line below current line
>> 2. <Esc> -- go back to normal mode
>> 3. 0 -- go to head of line
>> 4. "x5p -- copy 5 times using register x value, i.e. '='
>>
>> But with step 2, it did not work as I thought. It did not go back to
>> normal mode.
>>
>> How can I correct above scripts?
>
> It will work if you change the quoting of the <Esc> like this:
>
>    exe 'normal! ' . "o\<Esc>0" . '"x' . len . 'p'
>
> Regards,
> Gary
>
> --
> 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 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

Folding

I'm a Vim novice, and a writer not a programmer. I've perused the responses to questions about folding in the Vim FAQ. It's largely Greek to me. I have a couple questions: I understand folds can be indented. Is it possible to get Vim to wrap words to the indent column? Is there a way I can get folds to persist across a save and reload?

Thanks,
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA USA
eeweir@bellsouth.net


--
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

Re: Weird auto-comment after 72 lines

Efraim Yawitz wrote the following on 01.06.2011 13:38

> Try :help cinoptions (specifically, the *N value for which the help says:
>
> *N Vim searches for unclosed comments at most N lines away. This
> limits the time needed to search for the start of a comment.
> (default 30 lines).

It seems that the above mentioned helptext already got updated in the mercurial
repo:

,----[ :h indent.txt ]------------------------

*cino-star*
*N Vim searches for unclosed comments at most N lines away. This
limits the time needed to search for the start of a comment.
If your /* */ comments stop indenting afer N lines this is the
value you will want to change.
(default 70 lines).
`---------------------------------------------

-- <snip> --

--
bye Thilo

4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6 7C18 89A4 A2A0 C70B 1A8F


--
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

Plugin to continue text at top

Hi guys

When I was reading an article the other day I came across a complaint
from some IT-guy that he missed that today's editors, when they had
reached last line, couldn't "expand" and continue the file in an
attached window. In the answers someone said that Vim could infact do
this. I asked him how it's done but he won't answer me.

So the plugin/script would work like this:
Let's say you have a gvim window which, from top to bottom, has 50
lines. When you finish writing in the 50th line and hit enter GVim
would automatically make an attached "window" right next to where you
were writing so the 51st line would go on the top inline with the 1st
line. I'll try and demonstrate it with a picture with only 5 lines.

|| 1st line || 6th line || 11th line ||
|| 2nd line || 7th line || 12th line ||
|| 3rd line || 8th line || 13th line ||
|| 4th line || 9th line || 14th line ||
|| 5th line || 10th line || 15th line ||

If this script exists and you know where it can be found than that
info would be greatly appreciated.
If on the other hand it doesn't exist than I would appreciate your
input on how I could, for a lack of a better word, engineer it myself.

Regards,
Gisli Freyr

--
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