forked from cofi/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pentadactylrc
144 lines (118 loc) · 4.75 KB
/
pentadactylrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
" Search, Quick Nav
command! -nargs=* d tabopen https://duckduckgo.com/?q=<args>&v=
command! -nargs=* s tabopen https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi?Gw=<args>
command! -nargs=* g tabopen https://encrypted.google.com/search?q=<args>
command! -nargs=* pypi tabopen http://pypi.python.org/pypi?%3Aaction=search&term=<args>&submit=search
command! py tabopen http://python.org
command! -nargs=? pydoc tabopen http://docs.python.org/<args>
command! -nargs=1 pylib tabopen http://docs.python.org/library/<args>.html
command! -nargs=* wp tabopen http://en.wikipedia.org/wiki/Special:Search?go=Go&search=<args>
command! -nargs=* wpd tabopen http://de.wikipedia.org/wiki/Special:Search?go=Go&search=<args>
command! -nargs=* dict tabopen http://www.dict.cc/?s=<args>
command! -nargs=* beo tabopen http://dict.tu-chemnitz.de/dings.cgi?lang=de&service=deen&query=<args>
command! -nargs=* leo tabopen http://dict.leo.org/ende?lp=ende&lang=de&searchLoc=0&cmpType=relaxed§Hdr=on&spellToler=on&pinyin=diacritic&search=<args>&relink=on
command! -nargs=* zdf tabopen http://www.zdf.de/ZDFmediathek/#/suche/<args>
"sidebar
command! bookstack sidebar! Bookstack
map -g user ,b -ex bookstack
map -g user ,c -ex sbclose
set guioptions=sNTC
set editor="emacsclient -c --alternate-editor=gvim"
set hlfind
set hintmatching=contains
set newtab+=help
set hintkeys=asdfghjkl;
map -g user <A-a> -silent -ex dialog addbookmark
map -g user <A-b> -silent -ex tabopen chrome://browser/content/places/places.xul
map -g user <C-l> -silent -ex nohlfind
" Tabs
map -g user ,n -silent -ex tabnext
map -g user ,p -silent -ex tabprev
map -g user <C-right> -silent -ex tabnext
map -g user <C-left> -silent -ex tabprev
map -g user ,f -silent -ex tabrewind
map -g user ,l -silent -ex tablast
map -g user ,d -silent -ex tabduplicate
" Movement
imap <C-f> <right>
imap <C-b> <left>
imap <A-f> <C-right>
imap <A-b> <C-left>
imap <C-h> <BS>
imap <C-w> <C-BS>
cmap <C-f> <right>
cmap <C-b> <left>
cmap <A-f> <C-right>
cmap <A-b> <C-left>
nmap -count <C-S-d> <scroll-up>
nmap -count <C-S-u> <scroll-down>
" nmap -count <C-S-f> <scroll-page-up>
" nmap -count <C-S-b> <scroll-page-down>
nmap -count <C-S-f> <C-b>
nmap -count <C-S-b> <C-f>
nmap -builtin j 5j
nmap -builtin k 5k
nmap -builtin <C-e> 10<C-e>
nmap -builtin <C-y> 10<C-y>
" NoScript
map -g user <A-n> :set nss!=<A-Tab>
map -g user <A-C-n> set nso!=<A-Tab>
map -g user <A-S-n> :set nst!=<A-Tab>
" Instapaper -- depends on instapaper bookmarklet with `readlater' keyword
command! instapaper open readlater
map -g user ,r -ex instapaper
" Instapaper text -- depends on instapaper bookmarklet with `text' keyword
command! instatext open text
map -g user ,t -ex instatext
" Org
command! store-link -javascript
\ -desc 'Store link for Orgmode'
\ io.system('emacsclient -c "org-protocol:/store-link:/'
\ + encodeURIComponent(buffer.URL) + '/'
\ + encodeURIComponent(buffer.title) + '"')
command! capture -javascript
\ -desc 'Capture URL with selection in Orgmode.'
\ io.system('emacsclient -c "org-protocol:/capture:/x/'
\ + encodeURIComponent(buffer.URL) + '/'
\ + encodeURIComponent(buffer.title) + '/'
\ + encodeURIComponent(window.getSelection()) + '"')
command! save-link -javascript
\ -desc 'Save link in Orgmode.'
\ io.system('emacsclient -c "org-protocol:/capture:/s/'
\ + encodeURIComponent(buffer.URL) + '/'
\ + encodeURIComponent(buffer.title) + '"')
map -g user ,w -ex save-link
map -g user ,e -ex store-link
" UTM trimmer, based on http://pentablg.blogspot.com/2011/05/tip-of-day-mapping-javascript.html
command! yank-utm -javascript -desc 'yank utm-trimmed url'
\ let url = buffer.URL;
\ let utm = url.indexOf('?utm');
\ if ( utm > 0 ) {
\ url = url.substring(0, utm);
\ dactyl.clipboardWrite(url, true);
\}
map -g user ,y -ex yank-utm
command! wide-margin -javascript -desc 'set wide margin on left and right'
\ let body = buffer.doc.getElementsByTagName('body')[0];
\ body.style.marginLeft = '20%';
\ body.style.marginRight = '30%';
command! small-margin -javascript -desc 'set small margin on left and right'
\ let body = buffer.doc.getElementsByTagName('body')[0];
\ body.style.marginLeft = '10%';
\ body.style.marginRight = '15%';
command! no-margin -javascript -desc 'set no margin on left and right'
\ let body = buffer.doc.getElementsByTagName('body')[0];
\ body.style.marginLeft = '0';
\ body.style.marginRight = '0';
map -g user ,m -ex wide-margin
map -g user ,M -ex no-margin
command! strip-anchor -javascript -desc 'reopen current url with anchor stripped'
\ let url = buffer.URL;
\ let anchor = url.indexOf('#');
\ if (anchor > 0)
\ dactyl.open(url.substring(0, anchor));
map -g user ,s -ex strip-anchor
" C-g as ESC
map -g user <C-g> <ESC>
imap -g user <C-g> <ESC>
map -g user <C-q> <ESC>