-
Notifications
You must be signed in to change notification settings - Fork 2
Configuration
David Delassus edited this page Sep 22, 2011
·
2 revisions
The Cream-Browser's configuration is made in Lua to make it more customizable and as lightweight as possible.
The API is pretty simple and distributed with a helpful documentation.
You just have to import the library : require ("cream")
You have two type of keybindings :
- A shortcut (ie:
<Ctrl>W
) - A command (like vim does :
zz
)
The only inconvenient is that you have to write the name of the keys (ie: colon
and not :
).
Here is the function to configure your keybinds : cream.keys.map (state, modkeys, command, callback)
State is the browser's state where the keybind will be affected, here is the list of Cream-Browser's states :
- No editting
-
cream.state.normal
- Normal mode -
cream.state.embed
- Focus on plugin (ie: flashplay) -
cream.state.caret
- CARET browsing - Editting
-
cream.state.insert
- Focus on editting area -
cream.state.command
- Typing command in the inputbox -
cream.state.search
- Typing search command in the inputbox -
cream.state.all
- A mask for all states
Here is an example of keybindings :
cream.keys.map ({ cream.state.all }, { }, "Escape",
function (w)
cream.inputbox.text ("")
cream.state.current (cream.state.normal)
end)
cream.keys.map ({ { cream.state.normal, cream.state.embed, cream.state.caret }, { "Shift" }, "colon",
function (w)
cream.inputbox.text (":")
cream.inputbox.focus ()
end)
-- Paste command \o/
cream.keys.map ({ cream.state.normal, cream.state.embed, cream.state.caret }, { }, "pp",
function (w)
uri = cream.clipboard.primary:get ()
if uri ~= "" then
w:open (uri)
end
end)