Skip to content

Instantly share code, notes, and snippets.

@Mistyazur
Last active May 14, 2024 06:31
Show Gist options
  • Save Mistyazur/a2f76f542c73343bd7bcac16bd36e752 to your computer and use it in GitHub Desktop.
Save Mistyazur/a2f76f542c73343bd7bcac16bd36e752 to your computer and use it in GitHub Desktop.
sanitise tridactyllocal
set escapehatchsidebarhack false
set smoothscroll true
set searchengine b
unbind <F1>
unbind <SA-ArrowUp><SA-ArrowUp><SA-ArrowDown><SA-ArrowDown><SA-ArrowLeft><SA-ArrowRight><SA-ArrowLeft><SA-ArrowRight>ba
unbind --mode=browser <A-6>
bind --mode=browser <A-a> buffer #
unbind --mode=browser <C-,>
bind --mode=browser <A-q> escapehatch
bind <A-d> discardall
bind <A-r> reloadall
bind w scrollpage -0.5
bind s scrollpage 0.5
bind a tabprev
bind d tabnext
bind W fillcmdline winopen
bind S stop
bind A back
bind D forward
bind f hint -t
bind F hint -JF e => {tri.excmds.open(e.href); e.remove()}
bind x tabclose
bind X composite tabprev; tabclose #
bind b fillcmdline bmarks -t
bind B bmark
bind t fillcmdline tab
bind T fillcmdline taball
bind o fillcmdline tabopen
bind O fillcmdline open
" Search with engines
bind ib fillcmdline tabopen b
bind iB fillcmdline open b
bind id fillcmdline tabopen d
bind iD fillcmdline open d
bind ig fillcmdline tabopen g
bind iG fillcmdline open g
bind ii fillcmdline tabopen i
bind iI fillcmdline open i
bind iy fillcmdline tabopen yt
bind iY fillcmdline open yt
" Search clipboard
unbind p
bind P composite getclip clipboard | open
bind pp composite getclip clipboard | tabopen
bind pb composite getclip clipboard | tabopen b
bind pB composite getclip clipboard | open b
bind pd composite getclip clipboard | tabopen d
bind pD composite getclip clipboard | open d
bind pg composite getclip clipboard | tabopen g
bind pG composite getclip clipboard | open g
bind pi composite getclip clipboard | tabopen i
bind pI composite getclip clipboard | open i
bind py composite getclip clipboard | tabopen yt
bind pY composite getclip clipboard | open yt
" Search selection
bind --mode=visual P composite js document.getSelection().toString() | open
bind --mode=visual pp composite js document.getSelection().toString() | tabopen
bind --mode=visual pb composite js document.getSelection().toString() | tabopen b
bind --mode=visual pB composite js document.getSelection().toString() | open b
bind --mode=visual pd composite js document.getSelection().toString() | tabopen d
bind --mode=visual pD composite js document.getSelection().toString() | open d
bind --mode=visual pg composite js document.getSelection().toString() | tabopen g
bind --mode=visual pG composite js document.getSelection().toString() | open g
bind --mode=visual pi composite js document.getSelection().toString() | tabopen i
bind --mode=visual pI composite js document.getSelection().toString() | open i
bind --mode=visual py composite js document.getSelection().toString() | tabopen yt
bind --mode=visual pY composite js document.getSelection().toString() | open yt
" Binds for search
bind ? fillcmdline find
bind n findnext --search-from-view
bind N findnext --search-from-view --reverse
bind gn findselect
bind gN composite findnext --search-from-view --reverse; findselect
bind <Escape> composite mode normal; hidecmdline; nohlsearch
" Binds for new reader mode
bind gr reader
bind gR reader --tab
" Disable all searchurls
jsb Object.keys(tri.config.get("searchurls")).reduce((prev, u) => prev.catch(() => {}).then(_ => {console.log(u); tri.excmds.setnull("searchurls." + u)}), Promise.resolve())
" Add
set searchurls.b https://www.baidu.com/s?wd=
set searchurls.d https://duckduckgo.com/?q=
set searchurls.g https://www.google.com/search?q=
set searchurls.i https://www.bing.com/search?q=
set searchurls.gh https://github.com/search?utf8=%E2%9C%93&q=%s&ref=simplesearch
set searchurls.yt https://www.youtube.com/results?search_query=
" Suspend all tabs
command discardall jsb browser.tabs.query({}).then(ts => browser.tabs.discard(ts.map(t=>t.id)))
" Proxy
proxyadd socks5 socks://127.0.0.1:1080
bind ;[ set proxy socks5
bind ;] unset proxy
" Inject Google Translate
" This (clearly) is remotely hosted code. Google will be sent the whole
" contents of the page you are on if you run `:translate`
" From https://github.com/jeremiahlee/page-translator
command translate js let googleTranslateCallback = document.createElement('script'); googleTranslateCallback.innerHTML = "function googleTranslateElementInit(){ new google.translate.TranslateElement(); }"; document.body.insertBefore(googleTranslateCallback, document.body.firstChild); let googleTranslateScript = document.createElement('script'); googleTranslateScript.charset="UTF-8"; googleTranslateScript.src = "https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit&hl=en&tl=&sl="; document.body.insertBefore(googleTranslateScript, document.body.firstChild);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment