You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

152 lines
5.8 KiB

" Reset
" This resets all default settings
sanitize tridactyllocal tridactylsync
"""""""""""""""""""""
" General Options "
"""""""""""""""""""""
colours dark
set newtab about:blank
set browser firefox-developer-edition
"set allowautofocus false
set editorcmd $HOME/.bin/gnvim
set smoothscroll true
set newtabfocus page
set hintchars neiohtsrad
" Make Tridactyl work on more sites at the expense of some security
"set csp clobber
""""""""""""
" Search "
""""""""""""
" Remove old search urls
jsb Object.keys(tri.config.get("searchurls")).reduce((prev, u) => prev.then(_ => tri.config.set("searchurls", u, null)), Promise.resolve())
set searchengine ddg
set searchurls.alternativeto https://alternativeto.net/browse/search/?q=%s
set searchurls.ebay https://www.ebay.co.uk/sch/i.html?_nkw=%s
set searchurls.amazon https://www.amazon.co.uk/s?k=%s
set searchurls.ddg https://duckduckgo.co.uk/?q=%s
set searchurls.aur https://aur.archlinux.org/packages/?O=0&K=%s
set searchurls.aw https://wiki.archlinux.org/?search=%s
set searchurls.gh https://github.com/search?q=%s
set searchurls.wb https://web.archive.org/web/*/%s
set searchurls.books https://b-ok.cc/s/%s
set searchurls.yt https://yewtu.be/search?q=%s
set searchurls.cve https://www.cvedetails.com/cve-details.php?t=1&cve_id=%s
set searchurls.cvep https://www.cvedetails.com/product-search.php?vendor_id=0&search=%s
set searchurls.video https://www.google.com/search?hl=en&q=intext%3A%22%s%22%20intitle%3A%22index.of%22%20%2B(wmv%7Cmpg%7Cavi%7Cmp4%7Cmkv%7Cmov)%20%2Dinurl%3A(jsp%7Cpl%7Cphp%7Chtml%7Caspx%7Chtm%7Ccf%7Cshtml)
set searchurls.audio https://www.google.com/search?hl=en&ei=cSj3X5L0HYXykwXRpKvYAg&q=intext%3A%22%s%22+intitle%3A%22index.of.%2F%22+%28ac3%7Cflac%7Cm4a%7Cmp3%7Cogg%7Cwav%7Cwma%29+-inurl%3A%28jsp%7Cpl%7Cphp%7Chtml%7Caspx%7Chtm%7Ccf%7Cshtml%29&oq=intext%3A%22test%22+intitle%3A%22index.of.%2F%22+%28ac3%7Cflac%7Cm4a%7Cmp3%7Cogg%7Cwav%7Cwma%29+-inurl%3A%28jsp%7Cpl%7Cphp%7Chtml%7Caspx%7Chtm%7Ccf%7Cshtml%29&gs_lcp=CgZwc3ktYWIQA1CGD1jzEGDBEmgAcAB4AIABAIgBAJIBAJgBAaABAaoBB2d3cy13aXrAAQE&sclient=psy-ab&ved=0ahUKEwjS8PamkYruAhUF-aQKHVHSCisQ4dUDCAw&uact=5
set searchurls.red https://www.reddit.com/search/?q=%s
set searchurls.sred https://www.reddit.com/r/%s1/
set searchurls.sreds https://www.reddit.com/r/%s1/search?q=%s2&restrict_sr=on
""""""""""""""
" Commands "
""""""""""""""
command withUrl composite get_current_url |
command openvid withUrl !s yt --url
command openvidLink composite hint -pipe a[href]:not([display="none"]):not([href=""]) href | !s yt --url
command testclickjacking withUrl !s $HOME/.config/tridactyl/scripts/clickjacking | nativeopen
command openwithbrave withUrl !s /usr/bin/brave
command hint_focus hint -;
command wayback composite get_current_url | tabopen wb
command autodark js document.body.parentElement.classList.toggle("auto-dark")
command km2miles js document.body.innerHTML = document.body.innerHTML.replaceAll(/([0-9\.])+km/g,"miles")
"""""""""""
" Binds "
"""""""""""
"
" Ctrl-F should use the browser's native 'find' functionality.
unbind <C-f>
bind / fillcmdline find
bind ? fillcmdline find -?
bind n findnext 1
bind N findnext -1
" Tab switching feels the wrong way for me
bind J tabnext
bind K tabprev
bind ; fillcmdline_notrail
bind <space>y openvid
bind <space>Y openvidLink
" Git{Hub,Lab} git clone via SSH yank
bind <space>g composite js "git clone " + document.location.href | clipboard yank
bind <space>G composite js "git clone " + document.location.href.replace(/https?:\/\//,"git@").replace("/",":").replace(/$/,".git") | clipboard yank
bind <space>h hint -F e => e.dispatchEvent(new MouseEvent('mouseover', {}))
" Makes link hints only hint links on duck duck go
""bindurl ^https://duckduckgo.com f hint -Jc [class=result__a]
""bindurl ^https://duckduckgo.com F hint -Jbc [class=result__a]
" Protonmail hints
bindurl https://mail.protonmail.com/ f hint -Jc .item-subject,.item-checkbox,.navigation-link,.toolbar-button
autocmd DocStart .*github\.com.* zoom 150 false TRI_FIRED_MOZ_TABID
autocmd DocStart .*gitlab\.com.* zoom 150 false TRI_FIRED_MOZ_TABID
autocmd DocStart .*archlinux\.org.* zoom 150 false TRI_FIRED_MOZ_TABID
setpref browser.pocket.enabled false
setpref extensions.pocket.enabled false
setpref toolkit.legacyUserProfileCustomizations.stylesheets true
setpref browser.tabs.closeWindowWithLastTab false
"""""""""""""""
" Redirects "
"""""""""""""""
" Redirect to old style arch wiki
" Note that the seperator match needs to get to js as \? which means escaping the \ in the rc file
autocmd BeforeRequest https://wiki.archlinux.org/* (e)=>{\
if ( e.type == "main_frame" && null == e.url.match("[?|&]useskinversion=") ){\
let seperator= e.url.match("\\?")!=null ? "&" : "?" ;\
return {redirectUrl: e.url + seperator + "useskinversion=1"};\
} return {}\
}
" Redirect medium articlues to a paywall alternative
command mediumredirect autocmd BeforeRequest *://medium.com/* (e)=>{\
if ( e.type == "main_frame" && null == e.url.match("[?|&]noredirect=1") ){\
return {redirectUrl: e.url.replace("medium.com", "scribe.rip")};\
} return {}\
}
command stopmediumredirect autocmddelete BeforeRequest *://medium.com/*
mediumredirect
" Redirect twitter to nitter
command twitterredirect autocmd BeforeRequest *://twitter.com/* (e)=>{\
if ( e.type == "main_frame" && null == e.url.match("[?|&]noredirect=1") ){\
return {redirectUrl: e.url.replace("twitter.com", "nitter.net")};\
} return {}\
}
command stoptwitterredirect autocmddelete BeforeRequest *://twitter.com/*
twitterredirect
" Redirect youtube to yewtu.be
command youtuberedirect autocmd BeforeRequest *://*.youtube.com/* (e)=>{\
if ( ( e.type == "main_frame" || e.type == "sub_frame" ) && null == e.url.match("[?|&]noredirect=1") ){\
return {redirectUrl: e.url.replace("youtube.com", "yewtu.be")};\
} return {}\
}
command stopyoutuberedirect autocmddelete BeforeRequest *://*youtube.com/*
youtuberedirect