Created
August 2, 2012 21:20
-
-
Save nfbvieira/3240747 to your computer and use it in GitHub Desktop.
Ctrl+Enter uri expansion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Expand ':open example' to ':open www.example.com' when Ctrl+Return is pressed | |
| add_binds("command", { | |
| key({"Control"}, "Return", function (w) | |
| local tld = "com" -- The top level domain to be used on completion | |
| local input_tokens = split(w.ibar.input.text, "%s+") | |
| if input_tokens[1] == ":open" and #input_tokens == 2 then | |
| w:enter_cmd(":open www." .. input_tokens[2] .. '.' .. tld) | |
| end | |
| w:activate() | |
| end) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment