Hi again,
* On Sat, Sep 23, 2006 at 03:38:58PM +0200, Kim Schulz <[EMAIL PROTECTED]>
wrote:
> I am playing a bit around with abbreviations, in order to use them for
> simple pattern templates when I code. like:
> iabbrev for( for (%%%;%%%;%%%){<CR><CR>}
>
> How can I get it to obey my indentation rules?
In my ftplugins set ``lh-cpp'', I interpret <c-f> (the correct
keybinding should actually match the indent options) from within
abbreviations inserted through i_CTRL-R_=. In the next release, I plan
to support a "!reindent!" trigger to define my abbreviations.
In mu-template, I have a template option s:reindent, that triggers a call
to
exe first.','.last.'normal! ==' " IIRC
first and last initial values are based on '[ and '] (which are
automatically set), and adjusted according to lines removed from the
template file.
> Second problem:
>
> After the for( is changed to the for (....){...} I would like to move
> the cursor to the first spot just inside the () without having to do
> this manually. is there a way to go to that place ?
Use placeholders, and reserve a mapping/trigger that jumps to the
placeholder. In lh-map-tool, I use !cursorhere! (and !gotocursor!,
which is an implementation detail) to acheive this.
> I guess it is in the mark for place of last change, but I just cant
> get iabbrev to execute my movement command (other than using <left>
> <right> <up> <down>). Is there any way to do this?
I finally converged to the use of search(), on a placeholder
regex-pattern. This way neither @/ nor the search history are messed up
by irrelevant patterns.
If everytime (i.e., for every keywords -> "for", "if", "while", ...) you
count the number of lines or columns you have to move the cursor, it
becomes quickly boring to maintain the end-user mappings. Moreover, you
won't be able to propose customizations like inserting newlines before
and/or after curly- and round-brackets -- because the coding rules in
different projects require different presentations.
HTH,
--
Luc Hermitte
http://hermitte.free.fr/vim/