On Tuesday, August 20, 2013 11:16:20 AM UTC-5, tjg wrote:
> - one about the final output : divide the NbCar by 1500 (in France a
> 
> journalistic "feuillet"/page, I do not know if there is an equivalent
> 
> elsewhere) ; here it would indicate that a week ago I had written 15
> 
> feuillets (rounded upwards), and this week, 20 feuillets : a 250 pages book
> 
> in a year, "In search of lost time" much later, genius not included… 
> 
> 
> 
> - one about simple readability : divide the number of words by the number of
> 
> sentences.
> 
> 
> 
> How should I proceed ? 
> 
> 
> 
> For the first one (output) I tried to move the cursor on the number (e.g.
> 
> 30310), enter insert mode then <Ctrl-R>= followed by <Ctrl-R><Ctrl-W>/1500,
> 
> but failed miserably.
> 
> 

Once you enter insert mode the cursor may not be on the number anymore. I'd 
yank it to a register first, then paste that. This has the added benefit that 
you can paste it anywhere at all, not with the cursor over other text you might 
want to keep.

For example, place the cursor on the 30310 somewhere, do "cyiw to copy the 
number to the 'c' register/clipboard. Then enter insert mode wherever you like 
(doesn't need to be around the same number anywhere) and do <C-R>c.0/1500.

Note the ".0" I appended to the register contents. This forces Vim to do 
floating-point math instead of integer math, which will just ignore any 
fractional components.

Explanation:

"c just specifies that you want to use the 'c' register for the next operation
y means do a "yank" operation
iw specifies *what* to yank, in this case a single word, without any 
surrounding whitespace.

<C-R>c (i.e. hold down CTRL, press R, let go of CTRL, press C) inserts the 
contens of the 'c' register

> 
> As for the second one (readability), I simply cannot figure it out.
> 

Well, you already have number of words, and number of sentences. Repeat the 
process above using two different registers. E.g. yank the words into 'w' with 
"wyiw and yank the sentences into 's' with "syiw. Then use <C-R>w and <C-R>s to 
get the corresponding numbers into the expression register.

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to