On 2014-06-10 04:59, Ni Va wrote:
> the indentation depends on the number of "\s" in the header.
> If you mean that the header is :
> \s\s\sTHREE  or \s\sTWO 

Okay, then the following one-liner should do what you describe

:g/^\\s/exec 'sil! +,/^END_OF_BLOCK/'.repeat('>', strlen(matchstr(getline('.'), 
'\(\\s\)\+')) / 2)

that finds the number of "\s" pairs in each "\s" line, then indents
the following block (as ended by the "END_OF_BLOCK" line) by the
that number of indentation levels.  What this actually does
(whether it uses tabs vs. spaces, and how many tabs/spaces those
indentations are) will be controlled by your 'expandtab', 'tabstop'
and 'shiftwidth' settings.

The "sil!" just reduces the noise because the ">" Ex command likes to
be noisy about its actions and you'll get thousands of "N lines >ed M
times" messages otherwise.

-tim


-- 
-- 
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/d/optout.

Reply via email to