Skip to content

Instantly share code, notes, and snippets.

View troyp's full-sized avatar

Troy Pracy troyp

  • Lismore, NSW, Australia
View GitHub Profile
@troyp
troyp / .cvimrc
Last active September 30, 2018 09:38
.cvimrc
" ________
" | |
" | CVIMRC |
" |________|
" ,----------,
" | settings |
" '----------'
set localconfig
@troyp
troyp / backt-forwardt.penta
Created May 14, 2015 04:37
Pentadactyl ex file defining commands to go back/forward in a duplicated tab (like middle-clicking the navigation buttons)
" Pentadactyl ex file: add to .pentadactylrc or source with :source command
" Defines commands to go back/forward in a duplicated tab (equivalent to middle-clicking the navigation buttons)
" Example keybindings: gh and gl (replacing the builtin gh binding):
unmap gh
map -g user -ex gh :backt
map -g user -ex gl :forwardt
command! backt
\ -description "Duplicate tab and go back in the browser history"
@troyp
troyp / backt-forwardt.vimperator
Last active November 11, 2015 14:27
Vimperator ex file defining commands to go back/forward in a duplicated tab (like middle-clicking the navigation buttons)
" Vimperator ex file: add to .vimperatorrc or source with :source command
" Defines commands to go back/forward in a duplicated tab (equivalent to middle-clicking the navigation buttons)
" Example keybindings: gh and gl (replacing the builtin gh binding):
nnoremap gh :backt<CR>
nnoremap gl :forwardt<CR>
command! backt -description "Duplicate tab and go back in the browser history" :js backt();
:js <<EOF
backt = function() {
@troyp
troyp / undo-bg.vimperator
Last active August 29, 2015 14:21
Undo-close-tab-in-background function for Vimperator
" Undo-close-tab-in-background function for Vimperator
command! undob -description "Undo closed tab in background" :js undob();
:js <<EOF
undob = function() {
var currT = gBrowser.selectedTab;
var altT = liberator.modules.tabs.alternate;
var ssService = Components.interfaces.nsISessionStore;
var ssClass = Components.classes['@mozilla.org/browser/sessionstore;1']
var ss = ssClass.getService(ssService);
@troyp
troyp / tgroup-moveselected.penta
Last active September 3, 2018 14:17
Provides the command tgroup-moveselected, which moves all tabs matching a given regular expression to the group with specified id.
" tgroup-moveselected.penta
" Provides the command tgroup-moveselected, which moves all tabs matching a
" given regular expression to the group with specified id.
" eg. :tgroup-moveselected "penta" "pentadactyl"
" moves any tabs whose label matches /pentadactyl/ to the group with id "penta"
" Requires the TabGroupie plugin.
group TabGroupie
command! tgroup-moveselected
\ -nargs=+
" Vimperator ex file: add to .vimperatorrc or source with :source command
" Defines commands to open new tab to right of current tab
" Example keybinding: xt
nmap xt :newtabright<SPACE>
command! newtabright -nargs=1 -description "Open new tab to right of current tab" :js newTabRight("<args>");
:js <<EOF
function newTabRight(args) {
" Pentadactyl ex file: add to .pentadactylrc or source with :source command
" Defines commands to open new tab to right of current tab
" Example keybinding: xt
map -g user -ex xt :newtabright
command! newtabright
\ -description "Open new tab to right of current tab"
\ -nargs=1
\ -js <<EOF
@troyp
troyp / grab links.bookmarklet
Created February 17, 2016 20:32 — forked from ttscoff/grab links.bookmarklet
Create a bookmark and paste the code from `grab links.bookmarklet` into the url. Trigger it on a page containing links you want to save and then click the section of the page containing the links. A Markdown list of all links will be generated, and clicking the resulting list will select all for copying.
@troyp
troyp / Bullseye.bookmarklet
Created February 17, 2016 20:32 — forked from ttscoff/Bullseye.bookmarklet
A bookmarklet for grabbing just a piece of a web page and converting it to Markdown using heckyesmarkdown.com.
javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://gist.github.com/ttscoff/6109434/raw/Bullseye.js?x="+(Math.random());})();
@troyp
troyp / close_all_to_right_or_left.vimperator
Last active February 27, 2016 14:59
Vimperator code to add `closealltoright` and `closealltoleft` commands (and corresponding keybindings). Add to `~/.vimperatorrc`
js <<EOF
closeAllToRight = function () {
var current = tabs.getTab();
var currentIx = tabs.index(current);
var nexttab = current.nextElementSibling;
var N = tabs.count;
var numToClose = N - (currentIx + 1);
tabs.remove(nexttab, numToClose);
}