I am using emacs cperl-mode. When I type
if(
it gives me the code template:
if(<cursor goes here>){
}
But I want to make it like this:
if(<cursor goes here>){
<tab, according to the mode>
}
So after I wrote the condition inside ‘if’, I won’t need to click <End> <Enter> <tab> and will only need to click <Down arrow>.
The same method can be used for the similar cases: while, for, etc.
I use Yasnippet to cover this case:
Your case would be just i f tab condition tab then block.
In
cperl-modeyou have following default templates:and – what’s even more awesome – you can easily create your own templates or use an existing collection of yasnippet snippets for many languages.