summaryrefslogtreecommitdiff
path: root/vimperatorrc
blob: 2b2a60ca05342a2a0f02c466392a961112bda4e9 (plain)
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
" anrxc's vimperator init file with Emacs bindings

" For a nice formatted list of keybindings check: 
"   * http://sysphere.org/~anrxc/j/articles/vimperator/index.html

" TODO
"  * C-n and C-p in "INSERT (menu)" mode
"      - see this feature request: http://vimperator.org/trac/ticket/235
"  * C-? bindings wanted for: i (caret mode) and v (visual mode)
"  * C-g is buggy in insert mode in Vimperator 2.0
"      * completion brings system and FF to a crawl anyway so I will not use v2.0
"      * C-g solved in Vimperator 2.1 and completion is fixed


" User styles as colorschemes in Vimperator 2
"   * ~/.vimperator/colors/clearlooks.vimp
colorscheme clearlooks


" Options
"  - Most of the options already have good defaults
"
" Window title (Vimperator by default)
set titlestring=Firefox

" Editor, C-i invokes it in text fields (replaces "It's All Text")
set editor=emacsclient

" Command line and search patterns history
set history=10000

" Show the toolbar on startup (I keep all bars in one)
"set go+=T

" Show the tab bar only if more then one tab is open
set showtabline=1

" Show destination links in 1=status line, 2=command line
set showstatuslinks=1

" Show completions and use AwesomeBar (+search plugins)
set complete=sl
set wildoptions=auto

" Ex commands output in a new tab by default (prefs, addons...)
set newtab=all

" Hilight previous search pattern matches
set hlsearch

" Default search engine is ignored, plugins are used, place yubnub in there and do:
set ds=yubnub


" Key bindings
"  - Emacs key theme for GTK and Firefox already provide bindings for input fields.
" 
" M-x enters command mode
noremap <A-x> :

" Emacs navigation in command line and insert mode
cmap <C-n> <Tab>
cmap <C-p> <S-Tab>
cmap <C-f> <Right>
cmap <C-b> <Left>
cmap <C-j> <CR>
noremap <C-j> <CR>
inoremap <C-j> <CR>
inoremap <C-n> <Down>
inoremap <C-p> <Up>
inoremap <C-f> <Right>
inoremap <C-b> <Left>

" Use C-f and C-b for tab browsing
noremap <C-f> <C-n>
noremap <C-b> <C-p>

" Use C-a and C-e to jump to first/last tab
"noremap <C-a> g0
"noremap <C-e> g$
" Or use them to go to the absolute left/right of the document
noremap <C-a> 0
noremap <C-e> $

" Use C-p and C-n for up/down
noremap <C-p> k
noremap <C-n> j

" Use C-v and M-v for jump scrolling
noremap <C-v> <C-d>
noremap <A-v> <C-u>

" Goto the top of the document with M-<
noremap <A-<> gg

" Goto the end of the document with M->
noremap <A->> G

" Use C-s and C-r for searching (n/N for next/prev as in less)
noremap <C-s> /
noremap <C-r> ?

" Copy the current URL to the clipboard with M-w
noremap <A-w> y
" Copy selected text to the clipboard with C-w 
noremap <C-w> Y

" Paste the current clipboard selection to a new buffer with C-y
noremap <C-y> P

" Use current URL as a start for a new location with C-x C-v
noremap <C-x><C-v> O

" C-g as cancel (C-c is stop)
"cmap <C-g> <C-c>
cmap <C-g> <Esc>
imap <C-g> <Esc>
noremap <C-g> <Esc>

" Avoid Find dialog when canceling a started command, C-x C-g
noremap <C-x><C-g> <Esc>
" Avoid quit on C-q, and it's more suitable for Stop here
noremap <C-q> <C-c>

" Kill the buffer with C-x k
noremap <C-x>k d

" Undo close tab with C-_ (also with C-Shift-t, as C-t is new tab)
noremap <C-_> u

" Exit and save the session with C-x C-c
noremap <C-x><C-c> ZZ

" Buffer lists with C-x b and C-x C-b
noremap <C-x>b b
noremap <C-x><C-b> B

" C-x l as :open
" C-x t as :tabopen
noremap <C-x>l :o<SPACE>
noremap <C-x>t :t<SPACE>

" Switch roles of f and F to have hints opened in new tabs by default
"noremap f F
"noremap F f

" Switch hints to letter "j" for right hand usage
noremap j f
noremap J F
" Extended hint mode with M-j
"  ; - focus link, a - save, y - copy link, O - :open query, T - for :tabopen ...
noremap <A-j> ;

" We can now also use F for Shift+b/f as back/forward
noremap F L
noremap B H

" Back with Backspace as well
map <BS> H

" Default C-o/C-i for older/newer position on the history jump list
"remap if needed

" Use C-h i to start help
noremap <C-h>i :help<CR>

" Record a key sequence into a macro with C-x (
noremap <C-x>( q

" Play a macro with C-x e
noremap <C-x>e @

" Set a mark at the cursor with C-x r m
noremap <C-x>rm m

" Jump to the mark in the current buffer with C-x r b
noremap <C-x>rb '

" C-v was pass-next command, re-map it so we can bind to default keys too
noremap <C-d> <C-v>

" C-x C-f starts the "Open File" dialog (C-x C-s is Save)
map <C-x><C-f> <C-d><C-o>


" I also use these, with no connection to Emacs bindings
"
" M-Up/Dn toggles the toolbar (I keep all bars in one)
map <A-Down> :set go+=T<CR>
map <A-Up> :set go-=T<CR>

" Sidebar selection with s, close a sidebar with S
map s :sidebar<SPACE>
map S :sbclose<CR>

" Dialog selection with d
map d :dialog<SPACE>

" Bookmark this page with C-x a (dialog)
map <C-x>a <C-d><C-d>

" Bookmarks search and search by tag
map <C-x>q :bmarks<SPACE>
map <C-x>w :bmarks -tags=

" View source with C-x g
noremap <C-x>g gf
" or in an external editor
"noremap <C-x>g gF

" Focus the address bar with C-l
map <C-l> <C-d><C-l>

" Focus last used input field with C-x i
noremap <C-x>i gi

" Open home directory with C-x f
noremap <C-x>f ~

" Go to home page with C-x h
noremap <C-x>h gh

" Go to parent directory with C-x u
noremap <C-x>u gu

" Go to the root of the website with C-x C-u
noremap <C-x><C-u> gU


" Javascript
"   - Some useful functions
"
" Show the feed-button in the statusbar
javascript <<EOF
(function(){
    var feedPanel = document.createElement("statusbarpanel");
    feedPanel.setAttribute("id", "feed-panel-clone");
    feedPanel.appendChild(document.getElementById("feed-button"));
    feedPanel.firstChild.setAttribute("style", "padding: 0; max-height: 16px;");
    document.getElementById("status-bar")
            .insertBefore(feedPanel, document.getElementById("security-button"));
})();
EOF