Helper Scripts - Vim & Greasemonkey

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
bdjnk
Citizen
Posts: 81
Joined: Wed Jul 03, 2013 11:44 pm

Helper Scripts - Vim & Greasemonkey

Post by bdjnk »

If you use Vim, this should be useful. In my .vimrc I've got the following line:

Code: Select all

:map <F4>l :wa<CR> <bar> :silent !love %:h<CR><C-l>
This allows me to hit F4-l have all my open files saved and the directory I've currently in run with love. There are no prompts or hoops of any kind, it just runs the game you're working on, like magic.
__________________________________________________

If you use Greasemonkey (or Chrome I guess) this might be useful. I want the most relevent text to show up at the start of the tab, and the love forum does it backwards in my opinion. But that's okay, because this little script fixes that:

Code: Select all

// ==UserScript==
// @name        Invert Love2d Forum Page Titles
// @namespace   bdjnk
// @include     *love2d.org/forums*
// @version     0.1
// @grant       none
// ==/UserScript==

window.addEventListener("load", invertTitle, false);

function invertTitle () {
    var title = document.title;
    var token = " - ";
    if (title.indexOf(token) < 0) { return; }
    var fixed = "";
    fixed += title.substr(title.indexOf(token)+token.length);
    fixed += token;
    fixed += title.substr(0, title.indexOf(token));
    document.title = fixed;
}
Now the elements on either side of the dash are swapped, and the post title / section name are first.

That's all I've got for now.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 58 guests