Last active
September 19, 2015 18:47
-
-
Save ssh0/bfe0557fbf18e7ce973a to your computer and use it in GitHub Desktop.
Webkitベースの軽量ブラウザluakitを使ってみた(vimperatorユーザーにオススメ!) ref: http://qiita.com/ssh0/items/6fd8f3dc49be21fa20c7
This file contains 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
ex_follow_bindings = { | |
-- Yank element uri or description into primary selection | |
key({}, "y", [[Hint all links (as defined by the `follow.selectors.uri` | |
selector) and set the primary selection to the matched elements URI.]], | |
function (w) | |
w:set_mode("follow", { | |
prompt = "yank", selector = "uri", evaluator = "uri", | |
func = function (uri) | |
assert(type(uri) == "string") | |
uri = string.gsub(uri, " ", "%%20") | |
-- capi.luakit.selection.primary = uri | |
luakit.selection.primary = uri | |
luakit.selection.clipboard = luakit.selection.primary -- inserted | |
w:notify("Yanked uri: " .. uri, false) | |
end | |
}) | |
end), | |
-- Yank element description | |
key({}, "Y", [[Hint all links (as defined by the `follow.selectors.uri` | |
selector) and set the primary selection to the matched elements URI.]], | |
function (w) | |
w:set_mode("follow", { | |
prompt = "yank desc", selector = "desc", evaluator = "desc", | |
func = function (desc) | |
assert(type(desc) == "string") | |
-- capi.luakit.selection.primary = desc | |
luakit.selection.primary = desc | |
luakit.selection.clipboard = luakit.selection.primary -- inserted | |
w:notify("Yanked desc: " .. desc) | |
end | |
}) | |
end), | |
} | |
add_binds({"ex-follow"}, ex_follow_bindings) |
This file contains 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
sudo apt-get install luakit |
This file contains 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
luakit |
This file contains 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
require "follow" |
This file contains 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
-- Use a custom charater set for hint labels | |
local s = follow.label_styles | |
follow.label_maker = s.sort(s.reverse(s.charset("fjkasdhguonmerwc"))) |
This file contains 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
follow.stylesheet = [===[ | |
#luakit_follow_overlay { | |
position: absolute; | |
left: 0; | |
top: 0; | |
} | |
#luakit_follow_overlay .hint_overlay { | |
display: block; | |
position: absolute; | |
background-color: #ffff99; | |
opacity: 0.3; | |
z-index: 999999999; | |
} | |
#luakit_follow_overlay .hint_label { | |
display: block; | |
position: absolute; | |
background-color: #1c1c1c; | |
color: #fefefe; | |
padding: 1px 1px; | |
font-family: monospace, courier, sans-serif; | |
font-size: 12px; | |
z-index: 99999999; | |
} | |
#luakit_follow_overlay .hint_overlay_body { | |
background-color: #e4efff; | |
} | |
#luakit_follow_overlay .hint_selected { | |
background-color: #00ff00 !important; | |
} | |
]===] |
This file contains 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
-- Add command completion | |
require "completion"` | |
-- Order of completion items | |
completion.order = { | |
completion.funcs.command, | |
completion.funcs.bookmarks, | |
completion.funcs.history, | |
} |
This file contains 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
-- Yanking | |
key({}, "y", "Yank current URI to primary selection.", | |
function (w) | |
local uri = string.gsub(w.view.uri or "", " ", "%%20") | |
luakit.selection.primary = uri | |
luakit.selection.clipboard = luakit.selection.primary -- yank to clipboard too. | |
w:notify("Yanked uri: " .. uri) | |
end), |
This file contains 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
key({}, "Y", "Yank current title to primary selection.", | |
function (w) | |
local title = w.view.title or "" | |
luakit.selection.primary = title | |
luakit.selection.clipboard = luakit.selection.primary | |
w:notify("Yanked title: " .. title) | |
end), |
This file contains 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
key({"Control"}, "c", "Copy (as-in) control-c control-v", | |
function (w) | |
luakit.selection.clipboard = luakit.selection.primary | |
end), |
This file contains 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
key({"Mod1"}, "h", "Go to previous tab.", | |
function (w) w:prev_tab() end), | |
key({"Mod1"}, "l", "Go to next tab.", | |
function (w) w:next_tab() end), |
This file contains 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
ex_follow_bindings = { | |
-- Yank element uri or description into primary selection | |
key({}, "y", [[Hint all links (as defined by the `follow.selectors.uri` | |
selector) and set the primary selection to the matched elements URI.]], | |
function (w) | |
w:set_mode("follow", { | |
prompt = "yank", selector = "uri", evaluator = "uri", | |
func = function (uri) | |
assert(type(uri) == "string") | |
uri = string.gsub(uri, " ", "%%20") | |
-- capi.luakit.selection.primary = uri | |
luakit.selection.primary = uri | |
luakit.selection.clipboard = luakit.selection.primary -- inserted | |
w:notify("Yanked uri: " .. uri, false) | |
end | |
}) | |
end), | |
-- Yank element description | |
key({}, "Y", [[Hint all links (as defined by the `follow.selectors.uri` | |
selector) and set the primary selection to the matched elements URI.]], | |
function (w) | |
w:set_mode("follow", { | |
prompt = "yank desc", selector = "desc", evaluator = "desc", | |
func = function (desc) | |
assert(type(desc) == "string") | |
-- capi.luakit.selection.primary = desc | |
luakit.selection.primary = desc | |
luakit.selection.clipboard = luakit.selection.primary -- inserted | |
w:notify("Yanked desc: " .. desc) | |
end | |
}) | |
end), | |
} | |
add_binds({"ex-follow"}, ex_follow_bindings) |
This file contains 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
-- Add command to list closed tabs & bind to open closed tabs | |
require "undoclose" | |
local key = lousy.bind.key | |
add_binds("normal", { | |
key({}, "U", "View closed tabs in a list.", | |
function (w) w:set_mode("undolist") end), | |
}) |
This file contains 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
sudo apt-get install webkit-image-gtk libwebkit-dev libgtk2.0-dev sqlite3 sqlite3-pcre libsqlite3-dev gperf lua5.1 liblua5.1-0-dev libunique-dev lua-filesystem |
This file contains 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
-- Add download support | |
require "downloads" | |
require "downloads_chrome" | |
-- Set download location | |
downloads.default_dir = os.getenv("HOME") .. "/Downloads" | |
downloads.add_signal("download-location", function (uri, file) | |
if not file or file == "" then | |
file = (string.match(uri, "/([^/]+)$") | |
or string.match(uri, "^%w+://(.+)") | |
or string.gsub(uri, "/", "_") | |
or "untitled") | |
end | |
return downloads.default_dir .. "/" .. file | |
end) |
This file contains 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
update_win_title = function (w) | |
local uri, title = w.view.uri, w.view.title | |
title = "luakit" .. ((title and " - " .. title) or "") -- <<< | |
local max = globals.max_title_len or 80 | |
if #title > max then title = string.sub(title, 1, max) .. "..." end | |
w.win.title = title | |
end, |
This file contains 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
update_progress = function (w) | |
local p = w.view.progress | |
local loaded = w.sbar.l.loaded | |
if not w.view:loading() or p == 1 then | |
loaded:hide() | |
w.sbar.ebox:hide() -- <<< | |
w.sbar.hidden = true -- <<< | |
else | |
w.sbar.ebox:show() -- <<< | |
w.sbar.hidden = false -- <<< | |
loaded:show() | |
loaded.text = string.format("(%d%%)", p * 100) | |
end | |
end, |
This file contains 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
wget https://raw.githubusercontent.com/Plaque-fcc/luakit-adblock/master/adblock.lua -O ~/.config/luakit/plugins/adblock.lua | |
wget https://raw.githubusercontent.com/Plaque-fcc/luakit-adblock/master/adblock_chrome.lua -O ~/.config/luakit/plugins/adblock.lua |
This file contains 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
wget http://tofukko.r.ribbon.to/Adblock_Plus_list.txt -O ~/.local/share/luakit/adblock/Adblock_Plus_list.txt |
This file contains 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
-- adblock | |
require "plugins.adblock" | |
require "plugins.adblock_chrome" |
This file contains 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
git clone https://github.com/weeezes/luakit_private_browsing_tabs.git ~/.config/luakit/plugins/private_browsing_tabs | |
cp ~/.config/luakit/plugins/private_browsing_tabs/private_browsing_tabs.lua ~/.config/luakit/plugins/private_browsing_tabs.lua |
This file contains 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
-- private browsing tabs | |
require "plugins.private_browsing_tabs" |
This file contains 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
git clone https://github.com/mason-larobina/luakit.git ~/.git/luakit |
This file contains 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
cd ~/.git/luakit | |
make | |
sudo make install |
This file contains 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
cp -r /etc/xdg/luakit ~/.config |
This file contains 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
domain_props = { | |
["all"] = { | |
default_font_family = "TakaoPGothic", | |
sans_serif_font_family = "TakaoPGothic", | |
serif_font_family = "TakaoPMincho", | |
fantasy_font_family = "TakaoPMincho", | |
cursive_font_family = "TakaoPMincho", | |
monospace_font_family = "Inconsolata for Powerline", | |
default_font_size = 12, | |
default_monospace_font_size = 13, | |
minimum_font_size = 8, | |
・・・ | |
}, | |
・・・ | |
} |
This file contains 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
theme.font = "TakaoPGothic normal 9" |
This file contains 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
-- Global variables for luakit | |
globals = { | |
homepage = "luakit://bookmarks/", | |
・・・ | |
} |
This file contains 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
-- List of search engines. Each item must contain a single %s which is | |
-- replaced by URI encoded search terms. All other occurances of the percent | |
-- character (%) may need to be escaped by placing another % before or after | |
-- it to avoid collisions with lua's string.format characters. | |
-- See: http://www.lua.org/manual/5.1/manual.html#pdf-string.format | |
search_engines = { | |
-- default: Google検索 | |
default_search = "https://www.google.co.jp/search?q=%s", | |
-- I'm feeling lucky! | |
l = "https://www.google.co.jp/search?q=%s&btnI=I", | |
-- "w": Wikipedia | |
w = "https:ja.wikipedia.org/wiki/%s", | |
-- "n": niconico動画 | |
n = "http://www.nicovideo.jp/search/%s", | |
-- "nd": ニコニコ大百科 | |
nd = "http://dic.nicovideo.jp/s/al/a/%s", | |
-- "p": Google画像検索 | |
p = "http://www.google.com/search?hl=ja&site=imghp&tbm=isch&source=hp&q=%s&oq=%s", | |
-- "m": Google Map | |
m = "https://www.google.com/maps/place/%s", | |
-- "mfh": Google Map Navigation "from Home to ***" | |
-- if you set the searching language 'English', | |
-- then replace "自宅" to "Home" | |
mfh = "https://www.google.com/maps/dir/自宅/%s", | |
-- "mfw": Google Map Navigation "from Work to ***" | |
-- if you set the searching language 'English', | |
-- then replace "職場" to "Work" | |
mfw = "https://www.google.com/maps/dir/職場/%s", | |
-- "mfh": Google Map Navigation "from *** to Home" | |
-- if you set the searching language 'English', | |
-- then replace "自宅" to "Home" | |
mth = "https://www.google.com/maps/dir/%s/自宅", | |
-- "mfw": Google Map Navigation "from *** to Work" | |
-- if you set the searching language 'English', | |
-- then replace "職場" to "Work" | |
mtw = "https://www.google.com/maps/dir/%s/職場", | |
-- "ip": IP address search | |
ip = "http://www.ip-adress.com/whois/%s", | |
-- 'f': flickr | |
f = "https://www.flickr.com/search/?text=%s&safe_search=3", | |
-- "y": Youtubeで検索 | |
y = "http://www.youtube.com/results?search_query=%s&sm=3", | |
-- "rt" Yahooリアルタイム検索 | |
rt = "http://realtime.search.yahoo.co.jp/search?p=%s&ei=UTF-8", | |
-- "sc" Google Scholar検索 | |
sc = "http://scholar.google.co.jp/scholar?as_vis=1&q=%s&hl=ja&as_sdt=1,5", | |
-- "q" Qiita 検索 | |
q = "http://qiita.com/search?q=%s", | |
-- "g" Githubを検索 | |
g = "https://github.com/search?q=%s", | |
-- "gu" Githubを検索(ユーザーを検索) | |
gu = "https://github.com/search?q=%s&type=Users", | |
-- "gs" Gistを検索 | |
gs = "https://gist.github.com/search?utf8=✓&q=%s", | |
-- "t": 翻訳 | |
t = "http://ejje.weblio.jp/content/%s", | |
} | |
-- Set google as fallback search engine | |
search_engines.default = search_engines.default_search |
This file contains 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
-- List of search engines. Each item must contain a single %s which is | |
-- replaced by URI encoded search terms. All other occurances of the percent | |
-- character (%) may need to be escaped by placing another % before or after | |
-- it to avoid collisions with lua's string.format characters. | |
-- See: http://www.lua.org/manual/5.1/manual.html#pdf-string.format | |
search_engines = { | |
-- default: Google検索 | |
default_search = "https://www.google.co.jp/search?q=%s", | |
-- I'm feeling lucky! | |
l = "https://www.google.co.jp/search?q=%s&btnI=I", | |
-- "w": Wikipedia | |
w = "https:ja.wikipedia.org/wiki/%s", | |
-- "n": niconico動画 | |
n = "http://www.nicovideo.jp/search/%s", | |
-- "nd": ニコニコ大百科 | |
nd = "http://dic.nicovideo.jp/s/al/a/%s", | |
-- "p": Google画像検索 | |
p = "http://www.google.com/search?hl=ja&site=imghp&tbm=isch&source=hp&q=%s&oq=%s", | |
-- "m": Google Map | |
m = "https://www.google.com/maps/place/%s", | |
-- "mfh": Google Map Navigation "from Home to ***" | |
-- if you set the searching language 'English', | |
-- then replace "自宅" to "Home" | |
mfh = "https://www.google.com/maps/dir/自宅/%s", | |
-- "mfw": Google Map Navigation "from Work to ***" | |
-- if you set the searching language 'English', | |
-- then replace "職場" to "Work" | |
mfw = "https://www.google.com/maps/dir/職場/%s", | |
-- "mfh": Google Map Navigation "from *** to Home" | |
-- if you set the searching language 'English', | |
-- then replace "自宅" to "Home" | |
mth = "https://www.google.com/maps/dir/%s/自宅", | |
-- "mfw": Google Map Navigation "from *** to Work" | |
-- if you set the searching language 'English', | |
-- then replace "職場" to "Work" | |
mtw = "https://www.google.com/maps/dir/%s/職場", | |
-- "ip": IP address search | |
ip = "http://www.ip-adress.com/whois/%s", | |
-- 'f': flickr | |
f = "https://www.flickr.com/search/?text=%s&safe_search=3", | |
-- "y": Youtubeで検索 | |
y = "http://www.youtube.com/results?search_query=%s&sm=3", | |
-- "rt" Yahooリアルタイム検索 | |
rt = "http://realtime.search.yahoo.co.jp/search?p=%s&ei=UTF-8", | |
-- "sc" Google Scholar検索 | |
sc = "http://scholar.google.co.jp/scholar?as_vis=1&q=%s&hl=ja&as_sdt=1,5", | |
-- "q" Qiita 検索 | |
q = "http://qiita.com/search?q=%s", | |
-- "g" Githubを検索 | |
g = "https://github.com/search?q=%s", | |
-- "gu" Githubを検索(ユーザーを検索) | |
gu = "https://github.com/search?q=%s&type=Users", | |
-- "gs" Gistを検索 | |
gs = "https://gist.github.com/search?utf8=✓&q=%s", | |
-- "t": 翻訳 | |
t = "http://ejje.weblio.jp/content/%s", | |
} | |
-- Set google as fallback search engine | |
search_engines.default = search_engines.default_search |
This file contains 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
-- private browsing tabs | |
require "plugins.private_browsing_tabs" |
This file contains 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
theme.font = "TakaoPGothic normal 9" |
This file contains 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
update_progress = function (w) | |
local p = w.view.progress | |
local loaded = w.sbar.l.loaded | |
if not w.view:loading() or p == 1 then | |
loaded:hide() | |
w.sbar.ebox:hide() -- <<< | |
w.sbar.hidden = true -- <<< | |
else | |
w.sbar.ebox:show() -- <<< | |
w.sbar.hidden = false -- <<< | |
loaded:show() | |
loaded.text = string.format("(%d%%)", p * 100) | |
end | |
end, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment