No edit summary |
Luc Hermitte (talk | contribs) m (Undo revision 22208 by Luc Hermitte (talk): no category has been defined yet ; comments still need to be merged into a See Also §) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{review}} |
{{review}} |
||
+ | {{TipImported |
||
− | {{Tip |
||
|id=1071 |
|id=1071 |
||
+ | |previous=1070 |
||
⚫ | |||
+ | |next=1072 |
||
− | |created=December 9, 2005 |
+ | |created=December 9, 2005 |
|complexity=basic |
|complexity=basic |
||
− | |author=gabriel |
+ | |author=gabriel |
|version=5.7 |
|version=5.7 |
||
|rating=5/6 |
|rating=5/6 |
||
+ | |category1= |
||
− | |text= |
||
+ | |category2= |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | <pre> |
||
− | scripts [/scripts/script.php?script_id=475 vimscript #475] |
||
⚫ | |||
⚫ | |||
+ | inoremap <c-j> <Esc>/<++><CR><Esc>cf> |
||
+ | </pre> |
||
+ | You could of course use any key-sequence for this. I use it with my code for () completion. It can be equally well used with templates and other abbreviations. |
||
− | so I decided to add a similiar functionality to my .vimrc. I can't really say if it's done in a healthy way, I don't have that much experience with vim. |
||
+ | <pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | </pre> |
||
⚫ | |||
+ | Unlike the scripts pointed to by the comments this tip is just what it advertises. Simple. |
||
⚫ | |||
− | " A syntax for placeholders |
||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | inoremap <c-j> <ESC>/<++><CR><ESC>cf> |
||
− | |||
− | |||
− | |||
− | You could of course use any key-sequence for this. |
||
− | |||
− | I use it with my code for () completion. |
||
− | |||
− | It can be equaly well used with templates and other abbreviations. |
||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
− | " |
||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
− | |||
− | |||
− | If someone has better ways to do any of this I'd be much obliged. =) |
||
− | |||
− | I'm quite sure there is one. |
||
⚫ | |||
− | |||
⚫ | |||
⚫ | Similar to this is markjump.vim |
||
− | sreny--AT--srenyqernzf.pbz (Rot13ed) |
||
− | , December 9, 2005 4:06 |
||
---- |
---- |
||
− | You may have a look at what I produced in the API plugin |
+ | You may have a look at what I produced in the API plugin {{script|id=50}}. It already takes cares of what you are rewriting and much more. See also {{script|id=336}} and mu-template (the fork I'm maintening provides a better integration of markers/placeholders) that fully integrate the bracketing system. |
− | At this time, a much more recent version is available on my web site. |
||
− | hermitte {at} free {dot} fr |
||
− | , December 9, 2005 6:40 |
||
---- |
---- |
||
− | <!-- parsed by vimtips.py in 0.620257 seconds--> |
Latest revision as of 15:07, 3 March 2009
created December 9, 2005 · complexity basic · author gabriel · version 5.7
I was very impressed with the functionality of placeholders in the Latex-Suite script#475, so I decided to add a similiar functionality to my vimrc.
" A syntax for placeholders " Pressing Control-j jumps to the next match. inoremap <c-j> <Esc>/<++><CR><Esc>cf>
You could of course use any key-sequence for this. I use it with my code for () completion. It can be equally well used with templates and other abbreviations.
" Completions using placeholders inoremap ( ()<++><Esc>F)i inoremap [ []<++><Esc>F]i inoremap { {}<++><Esc>F}i
This doesn't care if the code is entered free or if it's inside a block of text. In which case I think it should not expand. But I find it helpful none the less. Unlike the scripts pointed to by the comments this tip is just what it advertises. Simple.
Comments[]
Similar to this is markjump.vim script#485, in addition to others (the names of which escape me for now). Markjump adds a few advantages to this method such as not mangling the search pattern and providing previous and next jumps.
You may have a look at what I produced in the API plugin script#50. It already takes cares of what you are rewriting and much more. See also script#336 and mu-template (the fork I'm maintening provides a better integration of markers/placeholders) that fully integrate the bracketing system.