Hi all.
I attach three patches:
1. Keybindings to insert new line after/before current
2. Snippet keybindings support
3. Automatically insert additional indentation in XML/HTML files if
previous line ends with an opening tag
They must be unrelated and can be applied independently of each other.
Some of the patches have drawbacks. Before "polishing" them, I want to
know whether they are useful and may go to trunk.
The drawback of the first patch is that I doubt it's so useful. I know
Vi[m] provides shortcuts for these actions ('o' and 'O' in normal
mode), but their necessity is questionable for me. I implemented this
to ease XML editing with tag autocompletion turned on. Suppose you
need to write to consequent <li>'s. Without this patch you need to
press End+Enter after writing the first <li> to place the cursor where
you need to start the second. With my patch, you only need to press
one shortcut you can assign in Preferences > Keybindings :)
The drawback of the third patch is that it's not completed. If user
likes to leave HTML tags like <br> "unclosed", she would be disturbed by
automatic indentation caused by my patch, so a check box in Preferences
is desirable. I'll code it as soon as we decide this patch can go to
trunk.
Speaking about the second patch, here is an example of assigning a
keybinding (I currently use it in my user snippets.conf):
# special group to define keybindings
# keybindings' format resembles the one used in Preferences >
# Keybindings tab
[Keybindings]
block_cursor=<Alt>bracketleft
Keybindings may be assigned either in user or global snippets.conf (I'm
not sure if the latter is useful). Another decision I made is to allow
keybindings for snippets in [Special] section (like "block_cursor" used
above). While "block_cursor" snippet is not very useful when you have
to type its name, it is useful when you just have to press a shortcut.
And, as usual for me, all of these patches lack user documentation…
Best regards,
Eugene.