Monday, September 22, 2014

Re: Digest for vim_use@googlegroups.com - 6 updates in 2 topics

Many thanks for your kind suggestions. At the moment, 

let &showbreak=repeat(' ', &ts)

seems to do exactly what I want. About  *breakindent* the vim version I'm using now (7.4, 2014.01.02, on xubuntu 14.04) does not yet offer this options.

Maybe a little formatting script called by the *formatprg* option could be useful? I have some one-shot Snobol scripts that are excellent for these purposes -- but I was not aware of the *formatprogram* option (shame). The script could be called e.g. FL (format-lines)

set formatprogram "fl 75 0 8 N" 

to format the block (marked visually) to tw=75, 0 indent for the first line of the block and 8 the following lines, without adding a NEWLINE char at "tw". Or 

set formatprogram "fl 75 0 8 Y" 

to format the block (marked visually) to tw=75, 0 indent for the first line of the block and 8 the following lines, also adding a NEWLINE char at "tw".

The syntax is more or less the syntax of NotaBene and XYWrite -- that I used before my.... conversion to LaTeX. The Y/N parameter is new.

Best wishes from a warm autumn in Northern Italy, after a cold and rainy summer!

guido m.



2014-09-22 7:47 GMT+02:00 <vim_use@googlegroups.com>:
Guido Milanese <guido.milanese@gmail.com>: Sep 21 07:30AM -0700

Please excuse me for asking this very trivial question, which I'm afraid has already been discussed, but I got confused browsing manuals, wiki and group.
 
I have a file of notes about books I have studied and I would like to obtain this structure (PN = real page numbers):
 
PN[TAB]my notes
 
If the "my notes" field spans over more than one line, I would like the continuation lines to be indented aligned at the TAB position, such as:
 
32 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea.
 
I tried to play with all the options (tw, ai, ts) but to no success.
I am using TAB and keeping my comments/notes as ONE line, even if displayed as continuation, because in this way I can easily parse the files to extract information, having an unambiguous and simple pattern to deal with. So in this example the NewLine should be placed only after the final words (/ex ea/).
 
Many thanks for your kind help!
guido m. (Italy)
Tim Chase <vim@tim.thechases.com>: Sep 21 01:12PM -0500

On 2014-09-21 07:30, Guido Milanese wrote:
> Please excuse me for asking this very trivial question, which I'm
> afraid has already been discussed, but I got confused browsing
> manuals, wiki and group.
 
No problem -- it's non-trivial, so it's certainly a good/worthwhile
question for the list.
 
 
> PN[TAB]my notes
 
> If the "my notes" field spans over more than one line, I would like
> the continuation lines to be indented aligned at the TAB position,
 
It sounds like you're looking for the 'showbreak' option. While it's
not perfect and doesn't work so well for more than one tab-stop worth
of indentation, you can do something like
 
:let &showbreak=repeat(' ', &ts)
 
which will display (rather than insert) extra &tabstop number of
spaces at the front of wrapped lines. It will break if you have more
than one tab, or if the page-number exceeds the width of a tab.
 
-tim
Tim Chase <vim@tim.thechases.com>: Sep 21 01:20PM -0500

On 2014-09-21 07:30, Guido Milanese wrote:
> If the "my notes" field spans over more than one line, I would like
> the continuation lines to be indented aligned at the TAB position,
 
Also, it sounds like there's a 'breakindent' option that was added in
7.4.338
 
https://retracile.net/blog/2014/07/18/18.00
 
to handle additional nested indentations. (Thanks to Christian
Brabandt for shepherding this patch into the official code-base!)
 
-tim
Boyko Bantchev <boykobb@gmail.com>: Sep 22 12:48AM +0300

> lines to be indented aligned at the TAB position ..................
> ................
> I am using TAB and keeping my comments/notes as ONE line ..........
 
Perhaps you would like to format your file so that it takes the shape
you want for editing, and format it back to the form "one note -- one
line" upon leaving vim. While editing, the internal formatting can
be preserved by setting formatoptions, e.g.: set fo=a2
(along with proper value of tw). Or, you may prefer to not have
autoformatting, but do formatting yourself when you wish to: gqap.
In this case set fo=2 will do.
You might also need to check the formatexpr and formatprg options.
Philip Rhoades <phil@pricom.com.au>: Sep 22 02:10AM +1000

Tim,
 
 
On 2014-09-21 06:24, Tim Chase wrote:
 
> The goal is to have a search expression that would look something like
 
> \<\%(quick\|fox\|lazy\|dog\)\>
 
> The \< and \> enforce word start/end boundaries,
 
 
Right.
 
 
> the "/" to search, type the "\<\%(" and then use control+R followed by
> "a" to paste in the contents you yanked into the "a" register, then do
> any cleanup, finally add on the "\)\>" at the end.
 
 
OK, I can get that manual method to work, but I still want to know what
was wrong with the original complex let statement:
 
:let @/ = '\<\%(' . @a, '\.[*') . '\)\>'
 
- this works:
 
:let @/ = '\<\%(' . @a . '\)\>'
 
- what was the extra:
 
", '\.[*')"
 
supposed to do?
 
Thanks,
 
Phil.
 
--
Philip Rhoades
 
GPO Box 3411
Sydney NSW 2001
Australia
E-mail: phil@pricom.com.au
Tim Chase <vim@tim.thechases.com>: Sep 21 12:50PM -0500

On 2014-09-22 02:10, Philip Rhoades wrote:
 
> - what was the extra:
 
> ", '\.[*')"
 
> supposed to do?
 
Doh! I see...I'd originally used the escape() function but realized
I was escaping the "\" characters that I still needed. So I removed
the function opening but accidentally failed to remove the closing
second-half of the call. So sorry for the confusion.
 
-tim
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to vim_use+unsubscribe@googlegroups.com.



--
Guido Milanese - Professor of Classics - Docteur H.C. Paris ICP
Universita' Cattolica d.S.C., Milano - Brescia
http://docenti.unicatt.it/ita/guido_fabrizio_milanese
http://www.arsantiqua.org

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