digitalmars.D.announce - For Vim D users (snippets)
- Kiith-Sa (38/38) Nov 03 2012 Helllo, I just read somewhere ...
Helllo, I just read somewhere that there is no support for D in Vim, so I'll use this for a bit of self-advertisement. A few days ago, I moved to UltiSnips vim script (https://github.com/SirVer/ultisnips), which I found to be more advanced and stable compared to SnipMate, which I used previously. I ported my SnipMate snippets to UltiSnips, removed some bugs, and any project-specific stuff. Sent a pullrequest to UltiSnips and got it merged. TLDR: You can do stuff like (imgur gallery): http://imgur.com/a/RB7Pw There is a _ton_ of snippets, maybe a bit too much (I found it very useful for pretty much every keyword to be a snippet, i.e. "keyword"<tab> - and I have generated code: trivial shortcuts ("module" (with Boost license), "imp", "al", "?:", "scope", ...) type definitions class ("class", "struct", "enum", ...) flow control ("sw", "if", "ife", "elif", "for", "do", ...) commonly called functions ("wr", "enf", ...) DDoc - assuming "///" comments ("doc", "Par", "Thr", "Ret", ...) Various other stuff I forgot. See the "d.snippets" file. To add new D snippets, ":UltiSnipsEdit" while editing a D file. Ultisnips uses <tab> to activate snippets, and <Ctrl-j>, <Ctrl-k> to move between tabstops (editable parts), I found setting the latter to <tab>, <Shift-tab> to be more intuitive/less keystrokes. UltiSnips snippets can be implemented in python and als support various possibilities of where a snippet should be allowed (to avoid areas where it makes no sense), e.g. only on start of line, or even regex. This stuff is not yet used much, but it could be used to improve the snippets further. UltiSnips: https://github.com/SirVer/ultisnips My fork (newest D fixes): https://github.com/kiith-sa/ultisnips
Nov 03 2012