/
.vimperatorrc
126 lines (99 loc) · 3.61 KB
/
.vimperatorrc
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
" settings
set guioptions+=m
" use the firefox awesomebar style hints
set wildoptions=auto
set complete=l
"set complete=sbhfS
"should match the name set in ":dialog searchengine" dialog
"set defsearch=google
set defsearch=g
set hlsearch
set incsearch
set smartcase
set showmode
set showstatuslinks
set nextpattern+=^\s*下一页\s*$,^\s*下一张\s*$,^››$
set previouspattern+=^\s*上一页\s*$,^\s*上一张\s*$,^‹‹$
"set wildmode=list:longest
"Allow user to click in address bar.
set! browser.urlbar.clickSelectsAll=true
set! browser.urlbar.doubleClickSelectsAll=true
" key mappings {{{1
" resource the rc file
:map ,s :source ~/.vimperatorrc<CR>
:map <A-n> :tabnew<CR>
:map <A-.> :tabnext<CR>
:map <A-,> :tabprev<CR>
:map <A-q> :tabclose<CR>
"Map paste operation normally.
imap <C-v> <C-v>
" use c-n and c-p to go up and down in insert and command mode
imap <C-n> <down>
imap <C-p> <up>
cmap <C-n> <down>
cmap <C-p> <up>
:command! -nargs=* g open google <args>
:map ,g :g
" web developers menu shortcut mapping
:map ,wc :emenu Tools.Web Developer.Cookies.Delete Path Cookies<CR>
" firebug menu shortcut mapping
:map ,fb :emenu Tools.Firebug.Open Firebug<CR>
:map ,fi :emenu Tools.Firebug.Inspect Element<CR>
:map ,fl :emenu Tools.Firebug.Command Line<CR>
" look up word in dict.cn
:command! dict -nargs=* tabopen http://dict.cn/<args>
:map w :dict
:map <silent> W :exe ":dict "+content.getSelection()<CR>
:map ,lh :emenu Tools.Live HTTP headers<CR>
" }}}1
" autocommands {{{1
"au LocationChange .* :js modes.passAllKeys = /mail\.google\.com/.test(buffer.URL)
au LocationChange .* :js modes.passAllKeys = /www\.google\.com\/reader/.test(buffer.URL)
"" for Linux
"":au LocationChange .* :set editor=gvim -f
"":au LocationChange mail\.google\.com :set editor=gvim -f -c 'set ft=mail'
" for MacOSX
":set editor=open -W -n -t
" }}}1
" Changing the command line color when focused
javascript <<EOM
(function() {
var inputElement = document.getElementById('liberator-commandline-command');
function swapBGColor(event) {
inputElement.parentNode.style.backgroundColor = event.type == "focus" ? "yellow" : "";
}
inputElement.addEventListener('focus', swapBGColor, false);
inputElement.addEventListener('blur', swapBGColor, false);
})();
EOM
" Toggle element
:js << EOF
toggle_element = function (name){
document.getElementById(name).collapsed ^= 1;
}
EOF
" Toggle webdeveloper toolbar
map <C-T> :js toggle_element('webdeveloper-toolbar')<CR>
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
"javascript <<EOF
" inject_jquery = function(){
" var s = document.createElement('script');
" s.setAttribute('src', 'http://jquery.com/src/jquery-latest.js');
" document.getElementsByTagName('body')[0].appendChild(s);
" };
"EOF
"command! jquery js inject_jquery()
javascript <<EOF
delicious = function(){f='http://delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&v=5&';a=function(){if(!window.open(f+'noui=1&jump=doclose','deliciousuiv5','location=yes,links=no,scrollbars=no,toolbar=no,width=550,height=550'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}};
EOF
command! delicious js delicious()
" vim: ft=vimperator sw=2 sts=2 foldmethod=marker