문제

I was thinking of setting my registers to equal common coding techniques. For example, I was thinking of doing this:

:let @i = "int i=0;"

Then I would set f for for loop, w for while loop etc. Is this a bad technique or is there a better way of doing this?

도움이 되었습니까?

해결책

I think that you could use snippets instead. Try to look at snipmate plugin http://www.vim.org/scripts/script.php?script_id=2540

You can just type "inti TAB" and it'll expand to "int i=0;" if you wish.

It already has a lot of snippets to many languages but you can configure it to do what you want.

다른 팁

For simple expansions, the built-in abbreviations will suffice:

:iab ii int i=0;

If you want parameter expansion, different "stops" to fill in data, and other advanced features, various snippets plugins (on http://www.vim.org/) offer this functionality; one of the first and broadly used ones is snipMate.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top