Page 1 of 1

LÖVE snippets for Vim (with snipMate plugin)

Posted: Sat Oct 22, 2011 8:49 am
by Santos
Here are some Lua/LÖVE snippets for use with the snipMate Vim plugin.

I suggest looking through the lua.snippets file to see what the snippet names are, edit them to your taste, and add your own snippets for code/libraries you use often.

Re: LÖVE snippets for Vim (with snipMate plugin)

Posted: Sat Oct 22, 2011 9:01 am
by kraftman
I tried vim, I couldn't even get the tutorial to work :/

Re: LÖVE snippets for Vim (with snipMate plugin)

Posted: Sat Oct 22, 2011 11:47 am
by Santos
kraftman wrote:I tried vim, I couldn't even get the tutorial to work :/
That's not such a bad thing, I remember that tutorial being... uncomfortable. :ultrahappy:

I'd suggest for someone interested in Vim to check out this guide: http://yannesposito.com/Scratch/en/blog ... ressively/

And then the top answer here for some advanced stuff: http://stackoverflow.com/questions/1218 ... t-with-vim

Also, don't be afraid to add things to the vimrc file. For example...

Code: Select all

imap <F4> <ESC>:call Loveconsole()<CR><CR>
nmap <F4> :call Loveconsole()<CR><CR>
imap <F5> <ESC>:call Love()<CR><CR>
nmap <F5> :call Love()<CR><CR>

fun! Loveconsole()
    exec "w"
    exec "!start love --console \"%:p:h\""
endf

fun! Love()
    exec "w"
    exec "!start love \"%:p:h\""
endf
Vim can also be customized with color schemes and plugins, such as snipMate (screencast) for snippets, lua.vim for Lua related things including syntax error checking, NERD Tree (screencast) for filesystem navigation and Taglist for function navigation (you'll probably want to add mappings in your vimrc file for NERD Tree and Taglist).

You may also want to change the font to something nicer (perhaps Droid Sans Mono or Inconsolata?). ;) To do so, create/edit .gvimrc (_gvimrc on Windows, in the same folder as _vimrc) and enter something like...

Code: Select all

set guifont=Droid_Sans_Mono:h20
Oh, and swapping the escape key with caps lock is something I'd highly recommend. AutoHotkey can do this on Windows.

Code: Select all

Capslock::Esc
Esc::Capslock

Re: LÖVE snippets for Vim (with snipMate plugin)

Posted: Sat Oct 22, 2011 7:03 pm
by kikito
Please don't write more awesome vim stuff, or I will not be able to do anything else than watch/read all of it.

Re: LÖVE snippets for Vim (with snipMate plugin)

Posted: Sun Oct 23, 2011 12:44 am
by adnzzzzZ
Well, thank you for bringing this to my attention. Useful as [expletive]!

Also, for those who want to get into Vim:
http://yannesposito.com/Scratch/en/blog ... ressively/
http://www.openvim.com/tutorial.html