On 29/12/08 10:15, Dave Wood wrote:
> On (07:16 29/12/08), Dave Wood<[email protected]>  put forth the 
> proposition:
>> On (07:04 29/12/08), Dave Wood<[email protected]>  put forth the 
>> proposition:
>>> I have been looking for a way to do this but nothing is coming to light.
>>>
>>> Basically I would like to visually word wrap at say 70 characters, but
>>> *only* visually - I still want to keep unbroken praragraphs in the text.
>>> Perhaps there is a way to set left/right margins, or to somehow lie to vim
>>> about the size of the console. This is in vim in linux console, not gvim.
>> I have found 'set columns' which seems ok but if anyone has further ideas,
>> especially on margins, that would be fine too.
>
> Ok so this works fine apart from a niggling thing that I can't seem to cure:
>
> When I use the command it sends the cursor to the beginning of the
> document. I tried to make some functions to set marks, but it doesn't work as
> expected:
>
> function! Set80()
>        mark z
>        set columns=80
>        g`z
> endfunction
>
> function! Set128()
>        mark z
>        set columns=128
>        g`z
> endfunction
>
> The cursor still goes to the start of the doc. I also noticed that while
> using these (I have F2 and F3 bound to them) on some files it stays put,
> but in a txt file I'm testing on it moves back. I also made sure that the
> mark would be within the column limits of the txt file when resizing.
>
> What am I doing wrong?

Using the ":g[lobal]" command: "in every line which includes the letter 
z, do nothing". Remember, in a script, every line is interpreted as an 
ex-command.

You may want to use

        keepjumps 'z

instead, which would move to the start of the line with mark z (where 'z 
is interpreted as a range), or even

        normal g`z


Best regards,
Tony.
-- 
There's no point in being grown up if you can't be childish sometimes.
                -- Dr. Who

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to