Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit

  • Loading branch information...
commit 3128359a7dc979ce8b2c50de83c6dd79801b0999 1 parent 14d65d1
Dmitry Geurkov authored
1  .gitignore
View
@@ -0,0 +1 @@
+info
25 .vimperatorrc
View
@@ -0,0 +1,25 @@
+"3.3 (created: 2011/11/13 17:32:12)
+
+
+" highlight Hint font-family: monospace; font-size: 12px; font-weight: bold; text-transform: uppercase; color: white; background-color: #FF3366; border-color: ButtonShadow; border-width: 0px; border-style: solid; padding: 0px 1px 0px 1px;
+" highlight HintElem background-color: #FFCC33; color: black;
+" source! /Users/troydm/.vimperatorrc.local
+
+set incsearch
+set hlsearch
+set smartcase
+
+let g:hintsio='io'
+map x :tabclose<cr>
+map s :tabopen duckduckgo
+map S YP
+nmap <c-a> b
+imap <c-b> <c-a>
+set defsearch=duckduckgo
+cabbrev !j !java
+cabbrev !ma !myanimelist
+cabbrev !mal !myanimelist
+
+colorscheme indigo
+
+" vim: set ft=vimperator:
8 README.md
View
@@ -1,4 +1,10 @@
dotvimperator
=============
-my vimperator config
+my vimperator configuration
+
+Usage
+=====
+
+ git clone https://github.com/troydm/dotvimperator.git ~/.vimperator
+ ln -s ~/.vimperator/.vimperatorrc ~/.vimperatorrc
102 colors/indigo.vimp
View
@@ -0,0 +1,102 @@
+" ==VimperatorColorSchema==
+" name: indigo
+" author: mashiro
+" ==/VimperatorColorSchema==
+
+" Highlights {{{1
+hi Boolean color: orchid;
+hi Function color: skyblue;
+hi Null color: cornflowerblue;
+hi Number color: cornflowerblue;
+hi Object color: khaki;
+hi String color: orchid;
+hi Mapping color: orchid;
+
+hi Key font-weight: bold;
+
+hi Enabled color: #d0ffd0;
+hi Disabled color: red;
+
+hi Normal color: #d0d0d0; background: #1c1c1c; font-size: 12px;
+hi ErrorMsg color: #ffffff; background: #440000; font-size: 12px;
+hi InfoMsg color: #d0d0d0; background: #1c1c1c; font-size: 12px;
+hi ModeMsg color: #d0d0d0; background: #1c1c1c; font-size: 12px;
+hi MoreMsg color: #d0ffd0; background: #1c1c1c; font-size: 12px;
+hi WarningMsg color: #ff0000; background: #1c1c1c; font-size: 12px;
+hi Message white-space: normal; min-width: 100%; padding-left: 2em; text-indent: -2em; display: block; font-size: 12px;
+hi NonText color: #a0a0d0; min-height: 16px; padding-left: 2px; font-size: 12px;
+hi Preview color: #a0a0d0; font-size: 12px;
+hi Prompt background: url("chrome://liberator/skin/prompt.png"); width: 10px; background-position: center; background-repeat: no-repeat;
+hi PromptText color: #1c1c1c; background: #d0d0f0; font-size: 12px;
+
+hi CmdOutput white-space: pre;
+hi CmdLine font-size: 14px; background: black; color: #d0d0d0; -moz-transition: all 0.25s;
+hi CmdLine>* font-family: monospace;
+
+hi ContentSeparator border: none; display: -moz-box;
+
+"hi CompGroup
+hi CompGroup:not(:first-of-type) margin-top: 1ex;
+hi CompTitle font-size: 12px; font-weight: bold; background: -moz-linear-gradient(19% 75% 90deg, #2c2c2f, #2a2a2f, #2f2f2f 100%);
+hi CompTitle>* color: #a0a0d0; border-bottom: 1px solid #3c3c3f; padding: 1px 0.5ex; text-shadow: 1px 1px 0px #0c0c0c;
+hi CompMsg font-style: italic; margin-left: 16px;
+hi CompItem font-size: 12px;
+hi CompItem[selected] color: #dddddd; background: #3c3c3f;
+hi CompItem>* height: 18px; min-height: 18px; padding: 0 0.5ex;
+hi CompIcon width: 16px; min-width: 16px; display: inline-block; margin-right: .5ex;
+hi CompIcon>img max-width: 16px; max-height: 16px; vertical-align: middle;
+hi CompResult width: 500px; max-width: 500px; overflow: hidden;
+hi CompDesc width: 500px; max-width: 500px; color: #a0a0d0;
+
+hi Indicator color: #a0a0d0;
+hi Filter color: #7090d0;
+
+hi Keyword color: khaki;
+hi Tag color: #a0a0d0;
+
+hi LineNr color: #ffd0d0; background: #1c1c1c;
+hi Question color: #a0a0d0; background: #1c1c1c; font-weight: bold;
+
+hi StatusLine color: #7090d0; background: transparent; font-weight: normal; font-size: 12px;
+
+hi TabNumber font-weight: bold; margin: 0px; padding-right: .3ex;
+
+hi Title color: orchid; background: #1c1c1c; font-weight: bold;
+hi URL text-decoration: none; color: #d0ffd0;
+hi URL:hover text-decoration: underline; cursor: pointer;
+
+hi FrameIndicator background-color: red; opacity: 0.5; z-index: 999; position: fixed; top: 0; bottom: 0; left: 0; right: 0;
+
+hi Bell border: none; background-color: #d0d0d0;
+hi Hint font-family: monospace; font-size: 16px; font-weight: normal; color: #dddddd; background-color: #1c1c1c; border: none; margin: -0.7em 0 0 -0.7em; padding: 0px 5px;
+hi Hint::after content: attr(number);
+hi HintElem background-color: rgba(208, 208, 240, 0.8); color: #1c1c1c;
+hi HintActive background-color: rgba( 85, 102, 187, 0.8); color: #dddded;
+hi HintImage opacity: .5;
+
+" 影(重かったらコメントアウト) {{{2
+hi -append Hint background-color: rgba(28, 28, 28, 0.8); border: 1px solid #1c1c1c; -moz-border-radius: 4px; -moz-box-shadow: 0px 0px 1px black; text-shadow: 1px 1px 2px black;
+hi -append HintElem text-decoration: none; -moz-border-radius: 4px; -moz-box-shadow: 0 0 2px #0c0c0c;
+hi -append HintActive text-decoration: none; -moz-border-radius: 4px; -moz-box-shadow: 0 0 2px #0c0c0c;
+" }}}2
+" }}}1
+
+" Styles {{{1
+style -name indigo-feed-button chrome://* <<EOM
+ #feed-button {
+ list-style-image: url("chrome://browser/skin/feeds/feedIcon16.png") !important;
+ -moz-image-region: auto !important;
+ border: none !important;
+ min-width: 0 !important;
+ }
+EOM
+
+style -name indigo-sbmcommentsviewer chrome://* <<EOM
+ .liberator-sbmcommentsviewer-content {
+ padding: 0 !important;
+ border: none !important;
+ }
+EOM
+" }}}1
+
+" vim: ft=vimperator
157 plugin/_smooziee.js
View
@@ -0,0 +1,157 @@
+//
+// _smooziee.js
+//
+// LICENSE: {{{
+// Copyright (c) 2009 snaka<snaka.gml@gmail.com>
+//
+// distributable under the terms of an MIT-style license.
+// http://www.opensource.jp/licenses/mit-license.html
+// }}}
+//
+// PLUGIN INFO: {{{
+var PLUGIN_INFO =
+<VimperatorPlugin>
+ <name>smooziee</name>
+ <description>At j,k key scrolling to be smooth.</description>
+ <description lang="ja">j,kキーでのスクロールをスムースに</description>
+ <minVersion>2.3pre</minVersion>
+ <maxVersion>2.3</maxVersion>
+ <updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/_smooziee.js</updateURL>
+ <author mail="snaka.gml@gmail.com" homepage="http://vimperator.g.hatena.ne.jp/snaka72/">snaka</author>
+ <license>MIT style license</license>
+ <version>0.10.2</version>
+ <detail><![CDATA[
+ == Subject ==
+ j,k key scrolling to be smoothly.
+
+ == Global variables ==
+ You can configure following variable as you like.
+ :smooziee_scroll_amount: Scrolling amount(unit:px). Default value is 400px.
+ :smooziee_interval: Scrolling interval(unit:ms). Default value is 20ms.
+
+ === Excample ===
+ Set scroll amount is 300px and interval is 10ms.
+ >||
+ let g:smooziee_scroll_amount="300"
+ let g:smooziee_scroll_interval="10"
+ ||<
+
+ == API ==
+ >||
+ smooziee.smoothScrollBy(amount);
+ ||<
+ Example.
+ >||
+ :js liberator.plugins.smooziee.smoothScrollBy(600)
+ :js liberator.plugins.smooziee.smoothScrollBy(-600)
+ ||<
+
+ == ToDo ==
+
+ ]]></detail>
+
+ <detail lang="ja"><![CDATA[
+ == 概要 ==
+ 普段のj,kキーのスクロールをLDRizeライクにスムースにします。
+
+ == グローバル変数 ==
+ 以下の変数を.vimperatorrcなどで設定することで動作を調整することができます。
+ :smooziee_scroll_amount:
+ 1回にスクロールする幅です(単位:ピクセル)。デフォルトは"400"です。
+ :smooziee_interval:
+ スクロール時のアニメーションのインターバルです(単位:ミリ秒)。
+ "1"以上の値を設定します。デフォルトは"20"です。
+ === 設定例 ===
+ スクロール量を300pxに、インターバルを10msに設定します。
+ >||
+ let g:smooziee_scroll_amount="300"
+ let g:smooziee_scroll_interval="10"
+ ||<
+
+ == API ==
+ 他のキーにマップする場合やスクリプトから呼び出せるようAPIを用意してます。
+ >||
+ smooziee.smoothScrollBy(amount);
+ ||<
+ amountにはスクロール量(ピクセル)を指定してください。正の値で下方向へ負の値で上方向へスクロールします。
+
+ Example.
+ >||
+ :js liberator.plugins.smooziee.smoothScrollBy(600)
+ :js liberator.plugins.smooziee.smoothScrollBy(-600)
+ ||<
+
+ == ToDo ==
+ - 読み込みの順番によっては他のプラグインと競合する可能性があるのをなんとかしたい。
+
+ ]]></detail>
+</VimperatorPlugin>;
+// }}}
+
+let self = liberator.plugins.smooziee = (function(){
+
+ // Mappings {{{
+ mappings.addUserMap(
+ [modes.NORMAL],
+ ["j"],
+ "Smooth scroll down",
+ function(count){
+ self.smoothScrollBy(getScrollAmount() * (count || 1));
+ },
+ {
+ count: true
+ }
+ );
+ mappings.addUserMap(
+ [modes.NORMAL],
+ ["k"],
+ "Smooth scroll up",
+ function(count){
+ self.smoothScrollBy(getScrollAmount() * -(count || 1));
+ },
+ {
+ count: true
+ }
+ );
+ // }}}
+ // PUBLIC {{{
+ var PUBLICS = {
+ smoothScrollBy: function(moment) {
+ win = Buffer.findScrollableWindow();
+ interval = window.eval(liberator.globalVariables.smooziee_scroll_interval || '20');
+ destY = win.scrollY + moment;
+ clearTimeout(next);
+ smoothScroll(moment);
+ }
+ }
+
+ // }}}
+ // PRIVATE {{{
+ var next;
+ var destY;
+ var win;
+ var interval;
+
+ function getScrollAmount() window.eval(liberator.globalVariables.smooziee_scroll_amount || '400');
+
+ function smoothScroll(moment) {
+ if (moment > 0)
+ moment = Math.floor(moment / 2);
+ else
+ moment = Math.ceil(moment / 2);
+
+ win.scrollBy(0, moment);
+
+ if (Math.abs(moment) < 1) {
+ setTimeout(makeScrollTo(win.scrollX, destY), interval);
+ destY = null;
+ return;
+ }
+ next = setTimeout(function() smoothScroll(moment), interval);
+ }
+
+ function makeScrollTo(x, y) function() win.scrollTo(x, y);
+ // }}}
+ return PUBLICS;
+})();
+// vim: sw=2 ts=2 et si fdm=marker:
309 plugin/char-hints-mod2.js
View
@@ -0,0 +1,309 @@
+// PLUGIN_INFO//{{{
+var PLUGIN_INFO =
+<VimperatorPlugin>
+ <name>{NAME}</name>
+ <description>character hint mode.</description>
+ <author mail="konbu.komuro@gmail.com" homepage="http://d.hatena.ne.jp/hogelog/">hogelog</author>
+ <version>0.3.2</version>
+ <minVersion>2.3pre 2010/01/26</minVersion>
+ <maxVersion>2.4pre</maxVersion>
+ <updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/char-hints-mod2.js</updateURL>
+ <detail><![CDATA[
+== Usage ==
+In default setting,
+input quickhint in lowercase
+and
+select charhint label in uppercase.
+
+== SETTING ==
+let g:hintchars:
+ set character used by char-hint.
+ e.g.)
+ let g:hintchars="hjkl"
+let g:hintsio:
+ - "i" setting char-hint input lowercase.
+ - "I" setting char-hint input uppercase.
+ - "o" setting char-hint show lowercase.
+ - "O" setting char-hint show uppercase.
+ Default setting is "IO".
+ e.g.)
+ let g:hintsio="i"
+let g:hintlabeling:
+ - "s" setting simple n-base decimal hint labeling (n = hintchars.length)
+ - "a" setting adjust no overlap labeling
+ Default setting is "s".
+ e.g.)
+ let g:hintlabeling="a"
+
+== TODO ==
+
+ ]]></detail>
+ <detail lang="ja"><![CDATA[
+== Usage ==
+デフォルトの設定では
+小文字は候補を絞るためのテキスト入力に、
+大文字は文字ラベルの選択に使います。
+
+== SETTING ==
+let g:hintchars:
+ set character used by char-hint.
+ e.g.)
+ let g:hintchars="hjkl"
+let g:hintsio:
+ - "i" setting char-hint input lowercase.
+ - "I" setting char-hint input uppercase.
+ - "o" setting char-hint show lowercase.
+ - "O" setting char-hint show uppercase.
+ Default setting is "IO".
+ e.g.)
+ let g:hintsio="i"
+let g:hintlabeling:
+ - "s" setting simple n-base decimal hint labeling (n = hintchars.length)
+ - "a" setting adjust no overlap labeling
+ Default setting is "s".
+ e.g.)
+ let g:hintlabeling="a"
+
+== TODO ==
+
+ ]]></detail>
+</VimperatorPlugin>;
+//}}}
+
+(function () {
+ (function(){
+ //override _showHints
+ const key = "Hints.prototype._showHints";
+ let conf = userContext[key],original;
+ if(conf) original = conf;
+ else original = userContext[key] = Hints.prototype._showHints;
+
+ const target = "String(hintnum).indexOf(String(activeHint)) == 0";
+
+ let source = original.toSource();
+ if(source.indexOf(target)>=0){
+ source = source.replace(target,
+ "num2chars(hintnum).indexOf(num2chars(activeHint)) == 0");
+ Hints.prototype._showHints = eval("(function() "+source+")()");
+ }
+ })()
+ ;
+ (function(){
+ const source = Hints.prototype._checkUnique.toSource();
+ if(source.indexOf("10")<0) return;
+ Hints.prototype._checkUnique = eval("(function() "+source.replace("10",<>hintchars.length</>)+")()");
+ })()
+ ;
+
+ const DEFAULT_HINTCHARS = "HJKLASDFGYUIOPQWERTNMZXCVB";
+ const hintContext = modules.hints;
+
+ let hintchars = DEFAULT_HINTCHARS;
+ let inputCase = function(str) str.toUpperCase();
+ let inputRegex = /[A-Z]/;
+ let showCase = function(str) str.toUpperCase();
+ let getStartCount = function() 0;
+
+ let timer = null;
+
+ function chars2num(chars) //{{{
+ {
+ let num = 0;
+ hintchars = inputCase(hintchars);
+ let base = hintchars.length;
+ for(let i=0,l=chars.length;i<l;++i) {
+ num = base*num + hintchars.indexOf(chars[i]);
+ }
+ return num;
+ } //}}}
+ function num2chars(num) //{{{
+ {
+ let chars = "";
+ hintchars = inputCase(hintchars);
+ let base = hintchars.length;
+ do {
+ chars = hintchars[((num % base))] + chars;
+ num = Math.floor(num/base);
+ } while(num>0);
+
+ return chars;
+ } //}}}
+ function getAdjustStartCount(base, count) //{{{
+ {
+ if(count < base) {
+ return 0;
+ } else if(count >= Math.pow(base, 2)) {
+ return base;
+ }
+ var start = Math.floor(count / base);
+ var adjust = count + start;
+ var next_start;
+ while(start != (next_start = Math.floor(adjust / base))) {
+ adjust += start;
+ start = next_start;
+ }
+ return start;
+ } //}}}
+ function getCharHints(win) //{{{
+ {
+ let hints = [];
+ (function (win) {
+ let elems = [elem for(elem in util.evaluateXPath('//*[@liberator:highlight="Hint" and @number]', win.document))];
+ hints = hints.concat(elems);
+ Array.forEach(win.frames, arguments.callee);
+ })(win);
+ return hints;
+ } //}}}
+ function showCharHints(hints) //{{{
+ {
+ let start = getStartCount(hintchars.length, hints.length);
+ for(let i=0,len=hints.length;i<len;++i) {
+ let hint = hints[i];
+ let num = hint.getAttribute("number");
+ let hintchar = num2chars(parseInt(num, 10)+start);
+ hint.setAttribute("hintchar", showCase(hintchar));
+ }
+ } //}}}
+ function isValidHint(hintInput, hint) //{{{
+ {
+ if(hintInput.length == 0) return false;
+ let hintchar = hint.getAttribute("hintchar");
+ return inputCase(hintchar).indexOf(hintInput) == 0;
+ } //}}}
+ function setIOType(type) //{{{
+ {
+ switch (type)
+ {
+ case "I":
+ inputCase = function(str) str.toUpperCase();
+ inputRegex = /[A-Z]/;
+ break;
+ case "i":
+ inputCase = function(str) str.toLowerCase();
+ inputRegex = /[a-z]/;
+ break;
+ case "O":
+ showCase = function(str) str.toUpperCase();
+ break;
+ case "o":
+ showCase = function(str) str.toLowerCase();
+ break;
+ }
+ } //}}}
+ function clearOriginalTimeout() //{{{
+ {
+ liberator.eval('if(_activeTimeout) clearTimeout(_activeTimeout);_activeTimeout = null;', hintContext);
+ } //}}}
+ function processHintInput(hintInput, hints) //{{{
+ {
+ let start = getStartCount(hintchars.length, hints.length);
+ let num = chars2num(hintInput)-start;
+ if(num < 0) return;
+
+ hintContext._hintNumber = Math.floor(num/10);
+ charhints.original.onEvent.apply(hintContext,[{
+ liberatorString: String(num%10)
+ }]);
+ statusline.updateInputBuffer(hintInput);
+ } //}}}
+
+ var hintInput = "";
+ var charhints = plugins.charhints = {
+ show: function (minor, filter, win) //{{{
+ {
+ charhints.original.show.apply(hintContext, arguments);
+ hintInput = "";
+ let hints = getCharHints(window.content);
+ showCharHints(hints);
+ }, //}}}
+ onInput: function (event) //{{{
+ {
+ let eventkey = events.toString(event);
+ if(/^\d$/.test(eventkey)) {
+ commandline.command += eventkey;
+ }
+ let hintString = commandline.command;
+ commandline.command = hintString.replace(inputRegex, "");
+
+ charhints.original.onInput.apply(hintContext, arguments);
+
+ for(let i=0,l=hintString.length;i<l;++i) {
+ if(inputRegex.test(hintString[i])) {
+ hintInput += hintString[i];
+ }
+ }
+ let hints = getCharHints(window.content);
+ showCharHints(hints);
+ if(hintInput.length>0) processHintInput(hintInput, hints);
+ }, //}}}
+ onEvent: function (event) //{{{
+ {
+ if(/^\d$/.test(events.toString(event))) {
+ charhints.onInput(event);
+ } else {
+ charhints.original.onEvent.apply(hintContext,arguments);
+ clearOriginalTimeout();
+ statusline.updateInputBuffer(hintInput);
+ }
+ }, //}}}
+ processHints: function (followFirst) //{{{
+ {
+ // don't followFirst if processHints call from
+ // charhints.original.onEvent(alt) in processHintInput
+ let caller = arguments.callee.caller;
+ if(caller == charhints.original.onEvent && caller.caller == processHintInput)
+ return charhints.original.processHints.apply(hintContext,[false]);
+
+ return charhints.original.processHints.apply(hintContext,arguments);
+ }, //}}}
+ };
+
+ if(!charhints.original) {
+ charhints.original = {
+ show: hints.show,
+ onInput: hints._onInput,
+ onEvent: hints.onEvent,
+ processHints: hints._processHints,
+ };
+
+ charhints.install = function () //{{{
+ {
+ hints.show = charhints.show;
+ hints.onEvent = charhints.onEvent;
+ liberator.eval("_onInput = liberator.plugins.charhints.onInput", hintContext);
+ liberator.eval("_processHints = liberator.plugins.charhints.processHints", hintContext);
+
+ liberator.execute(":hi Hint::after content: attr(hintchar)", true, true);
+ if(liberator.globalVariables.hintsio) {
+ let hintsio = liberator.globalVariables.hintsio;
+ Array.forEach(hintsio, setIOType);
+ }
+ if(liberator.globalVariables.hintchars) {
+ hintchars = liberator.globalVariables.hintchars;
+ }
+ if(liberator.globalVariables.hintlabeling) {
+ switch(liberator.globalVariables.hintlabeling) {
+ default:
+ case "s":
+ getStartCount = function() 0;
+ break;
+ case "a":
+ getStartCount = getAdjustStartCount;
+ break;
+ }
+ }
+ }; //}}}
+ charhints.uninstall = function () //{{{
+ {
+ hints.show = charhints.original.show;
+ hints.onEvent = charhints.original.onEvent;
+ liberator.eval("_onInput = liberator.plugins.charhints.original.onInput", hintContext);
+ liberator.eval("_processHints = liberator.plugins.charhints.original.processHints", hintContext);
+
+ liberator.execute(":hi Hint::after content: attr(number)", true, true);
+ }; //}}}
+ }
+ charhints.install();
+})();
+
+// vim: set fdm=marker sw=4 ts=4 et fenc=utf-8:
Please sign in to comment.
Something went wrong with that request. Please try again.