Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
My Vimperator configuration
"===[ Settings ]========================================================
" Autocomplete using Firefox Awesomebar subsystem
set complete=l
" Show completions as you type? '' waits for tab, 'auto' shows them immediately
set wildoptions=''
" Select the longest autocomplete match
set wildmode='list:full'
" Show a (n)umber on tabs, the (b)ottom scrollbar, and the (r)ight scrollbar
set guioptions=nbr
" Always show tab bar
set showtabline=1
" Don't beep
set noerrorbells
" Make Firefox run faster by using JIT
"===[ Status bars ]=====================================================
" Adds RSS icon on the bottom status bar.
" From:
javascript <<EOF
var feedPanel = document.createElement("statusbarpanel");
feedPanel.setAttribute("id", "feed-panel-clone");
feedPanel.firstChild.setAttribute("style", "padding: 0; max-height: 16px;");
document.getElementById("status-bar").insertBefore(feedPanel, document.getElementById("security-button"));
" Make bar yellow when focused.
" From:
javascript <<EOF
(function() {
var inputElement = document.getElementById('liberator-commandline-command');
function swapBGColor(event) { = event.type == "focus" ? "yellow" : "";
inputElement.addEventListener('focus', swapBGColor, false);
inputElement.addEventListener('blur', swapBGColor, false);
"===[ Auto commands ]===================================================
" Pass through all keys (like CTRL-Z) on Gmail and Google Reader:
autocmd LocationChange .* :js modes.passAllKeys = /mail\.google\.com|www\.google\.com\/reader\/view/.test(buffer.URL)
"===[ Custom commands ]=================================================
" Run :vimperatortoggle to enable or disable Vimperator as needed.
javascript function vimperatortoggle() { if (is_vimperator_active) { liberator.execute(':disable') } else { liberator.execute(':enable') }; }
command! vimperatortoggle javascript vimperatortoggle()
" Run :disable to disable Vimperator and resume normal Firefox behavior.
javascript function disable() { is_vimperator_active = false; liberator.execute(':set guioptions=TnbrmB showtabline=1'); modes.passAllKeys = true; }
command! disable javascript disable()
" Run :enable to enable Vimperator.
javascript function enable() { is_vimperator_active = true; liberator.execute('set guioptions=nbr showtabline=1') }
command! enable javascript enable()
" Load configuration file into current browser, useful for updating after editing this file.
command! sourcerc :source ~/.vimperatorrc
" Show properties of an object within JavaScript.
javascript <<EOB
function inspect(what) {
var nodes = [];
for (var node in what)
liberator.echo(nodes.sort().join(', '));
"===[ Mappings ]========================================================
" Press 'F10' to toggle Vimperator
noremap <F10> :vimperatortoggle<CR>
" Press 'c' to change to a buffer, instead of 'b'
noremap c b
" Press 'b' to page up, instead of crazy CTRL-B
noremap b <PageUp>
" Press 'm' to go to previous tab
noremap m :tabprevious<CR>
" Press ',' to go to next tab
noremap , :tabnext<CR>
" Press 'q' to delete current tab
noremap q :bdelete<CR>
" Press 'C-a' to select all
noremap <C-a> <C-v><C-a>
" Press 'C-c' to copy, 'C-v' or 'S-Insert' to paste, or 'C-x' to cut
noremap <C-c> <C-v><C-c>
noremap <C-v> <C-v><C-v>
noremap <C-x> <C-v><C-x>
cnoremap <C-c> <C-v><C-c>
cnoremap <C-v> <C-v><C-v>
cnoremap <S-Insert> <C-v><C-v>
cnoremap <C-x> <C-v><C-x>
inoremap <C-c> <C-v><C-c>
inoremap <C-v> <C-v><C-v>
inoremap <S-Insert> <C-v><C-v>
inoremap <C-x> <C-v><C-x>
"===[ fin ]=============================================================
Copy link

wanyikang commented Feb 29, 2016

Thx, i learn from it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment