Skip to content

Instantly share code, notes, and snippets.

@tobeportable
Created November 20, 2017 17:14
Show Gist options
  • Save tobeportable/9cf22e48254f35e02474c1827498856d to your computer and use it in GitHub Desktop.
Save tobeportable/9cf22e48254f35e02474c1827498856d to your computer and use it in GitHub Desktop.
config.load_autoconfig()
config.bind('R', 'config-source ;; message-info config-reloaded')
# saner defaults
# --------------
c.auto_save.session = True
c.aliases['x'] = 'quit --save'
c.completion.shrink = False
c.input.insert_mode.auto_load = True
c.confirm_quit = ["downloads"]
c.hints.mode = "number"
c.hints.auto_follow = "always"
config.bind('<Ctrl-C>', 'yank selection')
config.bind('<Ctrl-C>', 'leave-mode', mode='command')
c.content.headers.user_agent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0"
# my tabs management
# ------------------
c.tabs.background = True
c.tabs.title.format_pinned = ""
c.tabs.position = "bottom"
c.tabs.show = "never" # faster
# c.tabs.show = "switching"
# c.tabs.show = "always"
c.tabs.select_on_remove = "prev"
c.tabs.new_position.unrelated = 'last'
# my stack
# --------
c.spellcheck.languages = ["en-US", "fr-FR"]
c.editor.command = "termite -e vim {}".split()
# for vim autocomplete browser
# ----------------------------
c.window.title_format = "{current_url}"
# ad-blocking
# -----------
# https://filterlists.com/
# https://raw.githubusercontent.com/collinbarrett/FilterLists/master/data/Lists.json
# https://github.com/StevenBlack/hosts
c.content.host_blocking.lists = [
'https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-social/hosts',
'https://www.malwaredomainlist.com/hostslist/hosts.txt',
'http://someonewhocares.org/hosts/hosts',
'http://winhelp2002.mvps.org/hosts.zip',
'http://malwaredomains.lehigh.edu/files/justdomains.zip',
'https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext'
]
# general
# -------
config.bind('H', 'set-cmd-text -s :help -t')
config.bind('t', 'set-cmd-text -s :open -t')
config.bind('T', ':open -t {clipboard}')
config.bind(',c', 'spawn --userscript copy_url_as_markdown ;; tab-close')
config.bind('y', 'yank')
config.bind('h', 'back')
config.bind('gi', 'hint inputs;; later 5 follow-hint 0')
config.bind('<F11>', 'spawn --userscript toggle_fullscreen')
config.bind('<Ctrl-N>', 'completion-item-focus next', mode='command')
config.bind('<Ctrl-P>', 'completion-item-focus prev', mode='command')
# tabs management
# ---------------
config.bind('b', 'set-cmd-text -s :buffer ')
config.bind('q', 'tab-prev')
config.bind('Q', 'record-macro')
config.bind('s', 'tab-next')
config.bind('<', 'tab-move -')
config.bind('>', 'tab-move +')
config.bind('gp', 'tab-pin')
config.bind(',a', 'tab-focus 1')
config.bind(',z', 'tab-focus -1')
# localhost
# ---------
config.unbind('v')
config.bind('v0', 'open -t localhost:3000')
config.bind('v1', 'open -t localhost:3001')
config.bind('v2', 'open -t localhost:3002')
config.bind('v3', 'open -t localhost:3003')
config.bind('v4', 'open -t localhost:3004')
# spawned
# -------
config.bind('<Alt-P>', 'spawn -d rofi-pass', mode='insert')
config.bind('gm', 'hint links spawn -d -v mpv --ytdl-format="bestvideo+bestaudio/best" "{hint-url}"')
config.bind('gM', 'spawn -d -v mpv --ytdl-format="bestvideo+bestaudio" "{url}"')
config.bind('<Ctrl-F>', 'insert-text foo@bar.com', mode='insert')
config.bind('<Ctrl-P>', 'insert-text asdf1234', mode='insert')
config.bind('aa', 'set-cmd-text -s :spawn --userscript search_all_amazons')
# buffers
# -------
config.bind(',m', 'buffer gmail')
# search engines
# --------------
config.unbind('l')
# c.url.searchengines["DEFAULT"] = "https://www.google.com/ncr/search?q={}"
c.url.searchengines["DEFAULT"] = "https://www.google.com/search?q={}&pws=0&gl=be&gws_rd=cr"
def bind_search(key, keyword, search_url):
c.url.searchengines[keyword] = search_url
config.bind(key, 'set-cmd-text -s :open -t ' + keyword + ' ')
bind_search('ad', 'amazonde', 'https://www.amazon.de/s/field-keywords={}')
bind_search('af', 'amazonfr', 'https://www.amazon.fr/s/field-keywords={}')
bind_search('lG', 'github', 'https://github.com/search?o=desc&q={}&ref=simplesearch&type=Repositories')
bind_search('lg', 'googleluckygithub', 'https://www.google.com/search?hl=en&q=github+{}&btnI=Im+Feeling+Lucky')
bind_search('ly', 'youtube', 'https://www.youtube.com/results?search_query={}')
bind_search('ll', 'googlelucky', 'https://www.google.com/search?hl=en&q={}&btnI=Im+Feeling+Lucky')
bind_search('lr', 'reddit', 'https://reddit.com/r/{}')
bind_search('ad', 'amazonde', 'https://www.amazon.de/s/field-keywords={}')
bind_search('af', 'amazonfr', 'https://www.amazon.fr/s/field-keywords={}')
bind_search('au', 'amazonuk', 'https://www.amazon.co.uk/s/field-keywords={}')
bind_search('ai', 'amazonit', 'https://www.amazon.it/s/field-keywords={}')
bind_search('as', 'amazones', 'https://www.amazon.es/s/field-keywords={}')
bind_search('aj', 'amazonjp', 'https://www.amazon.co.jp/s/field-keywords={}')
bind_search('ag', 'geizhals', 'https://geizhals.eu/?fs={}&in=')
#!/bin/bash
echo -n "[$QUTE_TITLE]($QUTE_URL)" | xclip -selection clipboard
#!/bin/bash
QUERY="${@:1}"
echo ":open -t amazonfr $QUERY" >> "$QUTE_FIFO"
echo ":open -t amazonde $QUERY" >> "$QUTE_FIFO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment