Skip to content

Instantly share code, notes, and snippets.

@hbt
Created February 4, 2017 19:54
Show Gist options
  • Save hbt/b3d6b753c5a060667582327b85300ba1 to your computer and use it in GitHub Desktop.
Save hbt/b3d6b753c5a060667582327b85300ba1 to your computer and use it in GitHub Desktop.
" begin
" Copy paste this into options.html
" first lines copied into options
let configpath = '/home/hassen/.cvimrc'
let homedirectory = '/home/hassen'
" this would load this file into the options page
set localconfig
""""
" end
" beginning config
unmapAll
iunmapAll
" site filters
siteFilters() -> {{
var filters = {
'*://*.reddit.com/*': [[
'a:not([href])',
'*[onclick^=click_thing]'
], [
'.grippy'
]],
'*://*.google.*/*': [[
'li[class$="_dropdownitem"]',
'div[class$="_dropdown"]',
'div[aria-label="Apps"]',
'.hdtbna.notl',
'.irc_rit',
'a[href^="imgres"]',
'div[id=hdtbMenus]',
'div[aria-label="Account Information"]',
'img[jsaction^="load:"]'
]],
'*://github.com/*': [[
'.select-menu-modal-holder.js-menu-content'
]],
'*://twitter.com/*': [[], [
'.new-tweets-bar.js-new-tweets-bar'
]],
'*://imgur.com/*': [[], [
'.thumb-title',
'.carousel-button'
]],
'*://www.pogdesign.co.uk/*': [[], ['.largemenutext', '.dropdown', '.icon-heart selectison']],
};
return filters;
}}
" reload config on demand
reloadcvim() -> {{
console.log('reloading cvim ' + (new Date()));
var value = "call :source /home/hassen/.cvimrc<CR>";
Mappings.parseLine(value);
window.location.reload(true);
}}
map tr :call reloadcvim<CR>
"map tr :source /home/hassen/.cvimrc<CR>
" help
map <F1> :tabopen https://hbt.github.io/mouseless/commands.html<CR>
map <F2> :tabopen https://github.com/hbt/mouseless/issues<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" global vars
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set newtabalwaysontheright
set experimental
set nohud
set nodimhintcharacters
set noautofocus
set localconfig
set showtabindices
"set debug
"let hintcharacters = "fdsagrewqtc"
let hintcharacters = "dsafrewqtgcx"
let mouselesshintcharacters = "dsafrewq,tgcx"
let barposition = "bottom"
let vimcommand = "gvim -f "
let newtaburl = "https://www.google.com"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" search engines
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map oo :open<SPACE>
map ot :tabopen https://www.google.ca/<CR>
map tt :tabopen<SPACE>
map og :open google<SPACE>
command g tabnew google
map S :tabopen<SPACE>
map gpm :tabopen http://pmr.hbtlabs.com/tickets/goto?search=
map gsi :tabopen define:
map gsg :tabopen https://github.com/search?ref=opensearch&q=
map gsj :tabopen javascript<SPACE>
map gsc :tabopen http://scholar.google.ca/scholar?hl=en&q=
map gsp :tabopen php<SPACE>
map gsr :tabopen ruby<SPACE>
map gsf :tabopen symfony2<SPACE>
map gsy :tabopen python<SPACE>
map gsu :tabopen ubuntu<SPACE>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Page
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" page
map gi goToInput
map gF nextFrame
map : openCommandBar
map . repeatCommand
map gS :viewsource!<CR>
map GS viewSourceExternalEditor
map O :open @%
map ml makeLinks
" url
map gu goUpUrl
map ue openUrlExternalEditor
map gU goToRootUrl
" clipboard
map yy yankDocumentUrl
map p openPaste
map P openPasteTab
" external editor
map <C-i> createEditHint
map if createEditHint
imap <C-i> editWithVim
" scrolling
map zz resetScrollFocus
map w scrollUp
map k scrollUp
map s scrollDown
map j scrollDown
map a scrollLeft
map d scrollRight
map l scrollRight
map h scrollLeft
map gf scrollToBottom
map gg scrollToTop
map ga scrollToLeft
map gd scrollToRight
map ]] nextMatchPattern
map [[ previousMatchPattern
" history
map I :history<SPACE>
map A goBack
map D goForward
" pass through
map bv toggleVisualMode
map v passKeys
map <C-z> enterPassMode
map <A-z> exitPassMode
" url
map r reloadTabUncached
map tR reloadAllTabs
map <C-a> incrementURLLastPath
map <C-x> decrementURLLastPath
" hints
map f createHint
map c createTabbedHint
map C createActiveTabbedHint
map oc createMultiHint
map <A-c> createMultiHint
map <A-f> createHoverHint
map of createHoverHint
map yf yankUrl
map yF multiYankUrl
map yw yankWindowUrls
copyDescription(elem) -> {{
var text = elem.innerText || elem.value;
RUNTIME('copy', {text: text});
}}
map yd createScriptHint(copyDescription)
focusElem(elem) -> {{
elem.focus();
}}
map ys createScriptHint(focusElem)
openLinkIncognito(link) -> {{
var value = "call :tabopen " + link.href + " |<CR>"
Mappings.parseLine(value);
}}
map onf createScriptHint(openLinkIncognito)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" text insert
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" doesnt work
"map <C-w> :bookmarks<SPACE>
map ii insertMode
imap <C-w> deleteWord
imap <A-w> deleteWord
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" tabs
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" close
map tu lastClosedTab
map tcw myCloseWindowsOthers
map tcc myCloseTabsOthers
map tcg myCloseTabsAllExcept
map tce myCloseTabsRight
map tcq myCloseTabsLeft
map tw closeTab
" pinning
map tl pinTab
map tL windowUnpinAllTabs
map WL browserUnpinAllTabs
" merge
map tm markMergeTab
map Wm markMergeWindow
map tp putMergeTabs
" move
reopenInIncognito(link) -> {{
var value = "call :tabopen " + window.location.href + " |<CR>"
Mappings.parseLine(value);
}}
map tI :call reopenInIncognito()<CR>
map tg goToTab
map gt goToTab
map e nextTab
map q previousTab
map `` lastUsedTab
map t` lastUsedTab
map te moveTabRight
map tq moveTabLeft
map td :tabdetach<CR>
map ta :tabattach<SPACE>
map tv :duplicate<CR>
" change state
map tM muteTab
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" domains config
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" disabled sites gmail, reddit, pmrobot, google docs
site '*://mail.google.com/*' {
set ignorenumerickeys
unmap `
}
site '*://*.reddit.com/*' {
" use reddit RES extension instead
unmap j
unmap k
unmap J
unmap K
unmap a
unmap s
}
convertGifvToGif() -> {{
console.log(window.location.href);
var loc = window.location.href;
loc = loc.replace('.gifv', '.gif');
window.location.href = loc;
}}
map gv :call convertGifvToGif<CR>
site '*://*/*.gifv' {
call convertGifvToGif
}
test() -> {{
}}
site '*://*/*' {
call test
}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" quickmarks
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" invoice
map ;si :open https://docs.google.com/spreadsheets/d/1KeNPWsv-Jno6_U0o3Brja_JILbMWszou772n_3mdzkU/edit#gid=0<CR>
map ,si :tabopen https://docs.google.com/spreadsheets/d/1KeNPWsv-Jno6_U0o3Brja_JILbMWszou772n_3mdzkU/edit#gid=0<CR>
" dbs
map ;D :open http://localhost:8084/my_dbs.php<CR>
map ,D :tabopen http://localhost:8084/my_dbs.php<CR>
" libraries
map ;tl :open https://www.torontopubliclibrary.ca/youraccount<CR>
map ,tl :tabopen https://www.torontopubliclibrary.ca/youraccount<CR>
map ;rl :open http://library.ryerson.ca/<CR>
map ,rl :tabopen http://library.ryerson.ca/<CR>
map ,lp :tabopen chrome-extension://hdokiejnpimakedhajhdlcegeplioahd/vault.html<CR>
map ,e :tabopen chrome://extensions<CR>
" youtube
youtubeFullscreen() -> {{
var location=window.location.href;
location = location.replace('watch', 'watch_popup')
window.location.href=location;
}}
map ;yt :call youtubeFullscreen<CR>
" weather
map ;w :open https://darksky.net/forecast/43.6529,-79.3849/ca12/en<CR>
map ,w :tabopen https://darksky.net/forecast/43.6529,-79.3849/ca12/en<CR>
"""""""""""""""""""""""""""""""""""""
" Gmail / google
map ;gi :open https://mail.google.com/mail/u/0/#inbox<CR>
map ,gi :tabopen https://mail.google.com/mail/u/0/#inbox<CR>
map ,gw :tabopen https://mail.google.com/mail/u/0/#label/waiting<CR>
map ,gf :tabopen https://mail.google.com/mail/u/0/#label/followup<CR>
map ;gg :open https://mail.google.com/mail/u/0/#search/is%3Aunread<CR>
map ,gg :tabopen https://mail.google.com/mail/u/0/#search/is%3Aunread<CR>
map ;gu :open https://mail.google.com/mail/u/0/#search/is%3Aunread<CR>
map ,gu :tabopen https://mail.google.com/mail/u/0/#search/is%3Aunread<CR>
map ;gsa :open https://mail.google.com/mail/u/0/#search/is%3Astarred<CR>
map ,gsa :tabopen https://mail.google.com/mail/u/0/#search/is%3Astarred<CR>
"""""""""""""""""""""""""""""""""""""
" Misc
map ,co :tabopen chrome-extension://lfhcnbcpgkajcdelpfaipamdphaoacpp/pages/options.html<CR>
map ,d :tabopen chrome://downloads<CR>
map ,res :tabopen https://www.reddit.com/#res:settings/about<CR>
map ,rt :open| https://www.reddit.com/top<CR>
map ,ra :open| https://www.reddit.com/r/all<CR>
map ,hn :tabopen https://news.ycombinator.com/<CR>
map ;hn :open https://news.ycombinator.com/<CR>
map ,gh :tabopen https://github.com/<CR>
map ;gh :open https://github.com/<CR>
map ,cl :tabopen https://calendar.google.com/calendar/render?pli=1<CR>
map ,gc :tabopen https://calendar.google.com/calendar/render?pli=1<CR>
map ,ms :tabopen https://www.gametracker.com/search/?query=msob<CR>
map ,mf :tabopen http://www.gametracker.com/search/cod4/?query=freeze<CR>
map ,jk :tabopen http://localhost:7075/<CR>
map ,pl :tabopen https://hbt.github.io/projects-log/<CR>
map ,hp :tabopen http://projects.hbtlabs.com/<CR>
map ,hs :tabopen http://mouseless.hbtlabs.com/<CR>
map ,to :tabopen https://tomato-timer.com/#<CR>
map ,sd toggleDomainStylesheets(file:///home/hassen/.js/dark.css)
map ,sf toggleDomainStylesheets(file:///home/hassen/.js/fulldark.css)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" downloads
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map xp pauseDownloads
map xr resumeDownloads
map xc cancelDownloads
map xR restartLastDownload
map xg acceptDangerDownloads
map xy copyURLDownloads
map gj hideDownloadsShelf
map xh hideDownloadsShelf
map xs exportSettings
map xl openLastDownload
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" bookmarks
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map M* addQuickMark
map go* openQuickMark
map gn* openQuickMarkTabbed
map gw* openQuickMarkWindowed
map '* goToMark
map m* setMark
map bb :bookmarks<SPACE>
map bl toggleBookmark(later)
map btm toggleBookmark(tmp)
map btr toggleBookmark(torrents)
map bm toggleBookmark(mouseless)
"map bc toggleBookmark(chromium)
map bo toggleBookmark(book)
map br toggleBookmark(remember)
map bc toggleBookmark(crawk)
" end config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment