浏览代码

first commit

pull/1/head
10sr 13 年前
当前提交
be5766309d
共有 5 个文件被更改,包括 3120 次插入0 次删除
  1. +230
    -0
      .bashrc
  2. +1816
    -0
      .emacs
  3. +896
    -0
      .keysnail.js
  4. +41
    -0
      .profile
  5. +137
    -0
      .vimrc

+ 230
- 0
.bashrc 查看文件

@@ -0,0 +1,230 @@
#!/bin/bash
# 外部ファイルの読み込み
# test -r ~/filepath && . ~/filepath
# ln SRC DST
##########################################
test -r /etc/bashrc && . /etc/bashrc

# export PS1="\[\e[32m\]\u@\H \[\e[33m\]\w\[\e[0m\] \d \t\n\s \# \j \$ "
# export PS1="[\[\e[33m\]\w\[\e[0m\]]\n\[\e[32m\]\u@\H\[\e[0m\] \d \t \s.\v\nhist:\# jobs:\j \$ "
export PS1="\$(prompt_function)\$ "
# PROMPT_COMMAND=prompt_function
export PAGER="less"
export EDITOR="vim"
export VISUAL=$EDITOR
export LESS="-M"
# export LC_MESSAGES="C"
# export LANG=ja_JP.UTF-8
# export CDPATH=".:~" # 使い方がよく分からない
export GIT_PAGER=$PAGER
export GIT_EDITOR=$EDITOR

mkunfddir(){ # create dir if unfound. ?
test -e "$1" || mkdir "$1"
}
if test "${TERM}" == dumb
then
alias ls="ls -CFG --time-style=long-iso"
else
alias ls="ls -CFG --color=auto --time-style=long-iso"
fi
alias ll="ls -l"
alias la="ls -A"
alias lla="ls -Al"
alias vl=/usr/share/vim/vimcurrent/macros/less.sh
alias emacs="emacs -nw"
alias aptin="sudo apt-get install"
alias ut="slogin t110414@un001.ecc.u-tokyo.ac.jp"
alias rand="echo \$RANDOM"
alias xunp="file-roller -h"
alias pacome="sudo \paco -D"
# type trash >/dev/null 2>&1 && alias rm=trash
o(){
if [ $# -eq 0 ]; then
local f=.
else
local f="$1"
fi
if iswindows; then
cmd.exe //c start "" "$f"
elif isdarwin; then
open "$f"
else
xdg-open "$f"
fi
}
sgcc(){
if iswindows; then
gcc -o win.$1.exe $1
else
gcc -o $(uname).$1.out $1
fi
}
sggcc(){
gcc -g -o $(uname).$1.out $1
}
slmggcc(){
gcc -g -lm -o $(uname).$1.out $1
}
convmv-sjis2utf8-test(){
convmv -r -f sjis -t utf8 *
}
convmv-sjis2utf8-notest(){
convmv -r -f sjis -t utf8 * --notest
}
dl-my-init-files(){
for file in .bashrc .vimrc .emacs
do
local flag=0
if test -f ~/${file}.new
then
mv ~/${file}.new ~/${file}.old
echo "${file}.new already exist. Rename it to ${file}.old."
flag=1
fi
wget https://dl.dropbox.com/u/1751156/${file} -O ~/${file}.new
local wgetreturn=$?
if test ${flag} -eq 1 -a ${wgetreturn} -eq 0
then
rm ~/${file}.old
echo "${file}.old deleted."
fi
done
}
port-auto(){
port selfupdate && port sync && port upgrade installed
}

prompt_function(){ # used by PS1
local lastreturn=$?
if test "${TERM}" == dumb
then
local c1=""
local c2=""
local cdef=""
else
local c1="\e[33m"
local c2="\e[32m"
local cdef="\e[0m"
fi
local pwd=$(echo "${PWD}/" | sed -e "s:${HOME}:~:")
local date=$(LANG=C date +"%a, %d %b %Y %T %z")
local jobnum=$(jobs | wc -l)
type __git_ps1 >/dev/null 2>&1 && local gitb=$(__git_ps1 GIT:%s)
type git >/dev/null 2>&1 && local git="[${gitb}]"
printf " [${c1}${pwd}${cdef}]${git}\n"
printf "${c2}${USERNAME}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n"
printf "jobs:${jobnum} last:${lastreturn} "
}

# type date >/dev/null 2>&1 || alias date=":" # "cmd /c echo %time%"

if [ "${EMACS}" = "t" ]; then # emacs shell用
export PS1="\u@\H \d \t \w\nemacs shell\$ "
elif echo "$EMACS" | grep term >/dev/null 2>&1; then # emacs term用
echo "emacs term"
fi

# #Change ANSI Colors
# if [ $TERM = "xterm" ]
# then
# echo -e \
# "\e]P0000000" \
# "\e]P1cd0000" \
# "\e]P200cd00" \
# "\e]P3cdcd00" \
# "\e]P41e90ff" \
# "\e]P5cd00cd" \
# "\e]P600cdcd" \
# "\e]P7353535" \
# "\e]P8666666" \
# "\e]P9ff9999" \
# "\e]Pa99ff99" \
# "\e]Pbffff99" \
# "\e]Pc9999ff" \
# "\e]Pdff99ff" \
# "\e]Pe99ffff" \
# "\e]Pfffffff"
# fi

# printf "\e]P7353535" \

_echocolors(){
echo -e \
"\e[30mBlack\n" \
"\e[31mRed\n" \
"\e[32mGreen\n" \
"\e[33mYellow\n" \
"\e[34mBlue\n" \
"\e[35mMagenta\n" \
"\e[36mCyan\n" \
"\e[37mWhite\n" \
"\e[30;1mBright Black\n" \
"\e[31;1mBright Red\n" \
"\e[32;1mBright Green\n" \
"\e[33;1mBright Yellow\n" \
"\e[34;1mBright Blue\n" \
"\e[35;1mBright Magenta\n" \
"\e[36;1mBright Cyan\n" \
"\e[37;1mBright White\n" \
"\e[0m"
}


##########################
# system type
# $OSTYPEとか使えるのかな

iswindows(){
uname | grep -iE 'windows|MINGW' >/dev/null 2>&1
}

isdarwin(){
uname | grep -E 'Darwin' >/dev/null 2>&1
}

#########################
# for windose

winln(){
if [ $# -eq 0 ]; then
echo "usage: winln TARGET LINK_NAME"
echo "Create a link to TARGET with the name LINK_NAME (that is, TARGET must already exist)."
echo "About other features run 'junction'."
return 1
else
junction "$2" "$1"
fi
}

########################
if [ "${CYGWIN}" = "t" ]; then # cygwin判定ってどうやるんだろ 多分unameとか使う
# for cygwin
export TMP=/tmp
export TEMP=/tmp
catclip(){
cat /dev/clipboard | tr -d \\r
}
setclip(){
if [ $# -eq 0 ]; then # 引数があるかを判定
sed -e 's/$/\r/' | tee /dev/clipboard
else
cat $1 | sed -e 's/$/\r/' | tee /dev/clipboard
fi
}
# alias setclip="tee /dev/clipboard"
# alias catclip="cat /dev/clipboard | tr -d \\r"
alias cygsu="cygstart /cygwinsetup.exe"
alias emacs="CYGWIN=tty emacs"
echo "cygwin bash"
fi

echo "Japanese letters are 表示可能"

#######################

type diskinfo >/dev/null 2>&1 && diskinfo

finger sr
LANG=C id


+ 1816
- 0
.emacs
文件差异内容过多而无法显示
查看文件


+ 896
- 0
.keysnail.js 查看文件

@@ -0,0 +1,896 @@
// ========================== KeySnail Init File =========================== //

// この領域は, GUI により設定ファイルを生成した際にも引き継がれます
// 特殊キー, キーバインド定義, フック, ブラックリスト以外のコードは, この中に書くようにして下さい
// ========================================================================= //
//{{%PRESERVE%
// prompt.rows = 12;
// prompt.useMigemo = false;
// prompt.migemoMinWordLength = 2;
// prompt.displayDelayTime = 300;
// command.kill.killRingMax = 15;
// command.kill.textLengthMax = 8192;

//userscript.addLoadPath(".");
//userscript.require("verticaltab.js");

//////////////////////////////////////
//// sitelocalkeymap
var local = {};
plugins.options["site_local_keymap.local_keymap"] = local;
function fake(k, i) function () { key.feed(k, i); };
function pass(k, i) [k, fake(k, i)];
function ignore(k, i) [k, null];

// ext.add("ext-name", function () {}, "ext description");
// style.register("");
// local["^http://"] = [['a', function(ev, arg){}],];

///////////////////////////////////////////
//// firefox
// style.register("#bookmarksPanel > hbox,#history-panel > hbox {display: none !important;} //#urlbar-container{max-width: 500px !important;}");
util.setPrefs(
{
"browser.tabs.loadDivertedInBackground": true,
"dom.disable_window_open_feature.location": false,
"dom.max_script_run_time": 30,
"browser.bookmarks.max_backups":0,
"browser.urlbar.autocomplete.enabled":false,
"browser.cache.memory.capacity":16384,
"browser.sessionhistory.max_total_viewers":8,
"browser.download.manager.closeWhenDone":true,
"browser.download.useDownloadDir":false,
"browser.tabs.closeWindowWithLastTab":false,
"network.dns.disableIPv6":true
}
);


///////////////////////////////////
//検索エンジン
plugins.options["search-url-list"] = [
["bing","http://bing.com/search?q=%q"],
["yatwitter search","http://yats-data.com/yats/search?query=%q"],
["twitter search","http://search.twitter.com/search?q=%q&lang=all"],
["2ch","http://2ch-ranking.net/search.php?q=%q&imp=and&order=time"],
["I\'m feelig lucky!","http://www.google.co.jp/search?q=%q&btnI=kudos"],
["uncyclopedia","http://ja.uncyclopedia.info/wiki/%q"],
["wikipedia","http://ja.wikipedia.org/wiki/%q"],
["nicovideo.jp","http://www.nicovideo.jp/search/%q"],
["alc","http://eow.alc.co.jp/%q/UTF-8/"],
["google map","http://maps.google.co.jp/maps?hl=ja&q=%q&um=1&ie=UTF-8&sa=N&tab=wl"],
["weblio","http://www.weblio.jp/content_find?query=%q"],
["shoutcast","http://www.shoutcast.com/Internet-Radio/%q"],
["10sr.posterous.com","http://www.google.com/search?q=%q&ie=UTF-8&oe=UTF-8&hl=ja&domains=10sr.posterous.com&sitesearch=10sr.posterous.com"],
["delicious 10sr","http://delicious.com/10sr?addtag=%q&setcount=50&opennew=1"],
["open raw","%r"],
];

plugins.options["my-keysnail-bookmarks"] = [
"twitter.com",
];



//sitelocal
//////////////////////////////////////////
// 2ch chaika
local["^http://127.0.0.1:8823/thread/"] = [
['k', function (ev, arg) {
curl = window.content.location.href;
kurl = curl.replace(/http:.*thread\/(.*\/).*/, "chaika://post/$1");
window.content.location.href = kurl;
}
],
];

local["^http://w2.p2.2ch.net/p2/read.php"] = [
['k', function (ev, arg) {
var url = window.content.location.href;
var pt = /host=(.*?)&bbs=(.*?)&key=(.*?)&ls=/ ;
var result = url.match(pt);
var k = format("chaika://post/http://%s/test/read.cgi/%s/%s/", result[1], result[2], result[3]);
window.content.location.href = k;
}
],
];

/////////////////////////////////////////
// feedly用マップ
local["^http://www.feedly.com/"] = [
['d', null],
['j', null],
['k', null],
['n', null],
['p', null],
['o', null],
['b', null],
['S', null],
['s', null],
['?', null],
['l', function (ev, arg) {window.content.location.href = "http://www.feedly.com/home#latest";}],
['r', null],
['x', function (ev, arg) {ev.target.dispatchEvent(key.stringToKeyEvent("g", true));}],
[['t', 'p'], function (ev, arg) {ev.target.dispatchEvent(key.stringToKeyEvent("t", true));}],
[['t', 'w'], function (ev, arg) {ext.exec("twitter-client-tweet", arg, ev);}],
];

/////////////////////////////////////////
//nicovideo用
local["http://(www|tw|es|de|)\.nicovideo\.jp\/watch/*"] = [
["i", function (ev, arg) { ext.exec("nicoinfo", arg); }],
["p", function (ev, arg) { ext.exec("nicopause", arg); }],
["o", function (ev, arg) { ext.exec("nicommentvisible", arg); }],
["m", function (ev, arg) { ext.exec("nicomute", arg); }],
[".", function (ev, arg) { ext.exec("nicovolumeIncrement", arg); }],
[",", function (ev, arg) { ext.exec("nicovolumeDecrement", arg); }],
['f', function (ev, arg) {
curl = window.content.location.href;
kurl = curl.replace(/nicovideo.jp/, "nicovideofire.jp");
window.content.location.href = kurl;
}
],
];

/////////////////////////////////////////
// tumblr/dashboard
local["^http://www.tumblr.com/dashboard"] = [
// ["C-<left>", function (ev, arg) {gBrowser.mTabContainer.advanceSelectedTab(-1, true); }],
// ["C-<right>", function (ev, arg) {gBrowser.mTabContainer.advanceSelectedTab(1, true); }],
["<left>", function (ev, arg) {window.content.location.href = "http://www.tumblr.com/dashboard"; }],
// ["<right>", null],
["J", function (ev, arg) {
if (window.loadURI) {
loadURI("javascript:(function(){b=20;s=100;t=document.getElementById('next_page_link').href.split('/')[5];max=t.substr(0,t.length-5);min=max-s;i=Math.floor(Math.random()*(max-min)+min);u=(i<b)?'http://www.tumblr.com/dashboard':'http://www.tumblr.com/dashboard/2/'+i+'00000';window.content.location.href=u;}())");
}
}],
];

///////////////////////////////////
//tanythhing用
plugins.options["tanything_opt.keymap"] = {
"\\" : "prompt-cancel",
"j" : "prompt-next-completion",
"k" : "prompt-previous-completion",
"o" : "localOpen",
":" : "localClose",
"L" : "localMovetoend"
};

//////////////////////////////////////////
// yatc
style.register("#keysnail-twitter-client-container{ display:none !important; }");
plugins.options["twitter_client.popup_new_statuses"] = false;
plugins.options["twitter_client.automatically_begin"] = false;
plugins.options["twitter_client.automatically_begin_list"] = false;
plugins.options["twitter_client.timeline_count_beginning"] = 0;
plugins.options["twitter_client.timeline_count_every_updates"] = 0;

plugins.options["twitter_client.tweet_keymap"] = {
"C-RET" : "prompt-decide",
"RET" : ""
};

plugins.options["twitter_client.jmp_id"] = "10sr";
plugins.options["twitter_client.jmp_key"] = "R_c51f889a77cb4b4e993ed868f65083f5";

////////////////////////////////////////////
// エクステ

/////////////////////////////////////
// google itranslate
(function(){
let targetLang = "ja"; // target lang to translate into
let alternativeLang = "en"; // if given word is in targetLang, use this instead as a target lang
function translate(word, target, next) {
next("", "", " getting...");
const base = "https://www.googleapis.com/language/translate/v2?key=%s&q=%s&target=%s";
const apikey = "AIzaSyBq48p8NhFgaJ1DfUJ5ltbwLxeXpjEL86A";
let ep = util.format(base, apikey, encodeURIComponent(word), target);
util.httpGet(ep, false, function (res) {
if (res.status === 200) {
let json = decodeJSON(res.responseText);
let srclang = json.data.translations[0].detectedSourceLanguage;
if (target == srclang) {
lookupword(word, alternativeLang);
} else {
let result = json.data.translations[0].translatedText;
next(srclang, target, result);
}
} else {
next("", "", "ERROR!");
}
});
};
function echo(srclang, from, tglang, to){
display.echoStatusBar(srclang + " : " + from + " -> " + tglang + " : " + to);
};
function decodeJSON(json) {
return util.safeEval("(" + json + ")");
};
function lookupword(word, target){
translate(word, target, function (src, tg, translated) {
echo(src, word, tg, translated);
});
};
function read (aInitialInput) {
let prevText = "";

prompt.reader({
message : "word or sentence to translate:",
initialinput : aInitialInput,
onChange: function (arg) {
let word = arg.textbox.value;
if (word !== prevText) {
prevText = word;
lookupword(word, targetLang);
}
},
callback: function (s){},
});
};
ext.add("google-itranslate",function(){read(content.document.getSelection() || "");},"google itranslate");
})();

//////////////////////////////////////
//
ext.add("restart-firefox-add-menu", function(){
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var elm = document.createElementNS(XUL_NS, "menuitem");
elm.setAttribute("label", "Restart Firefox");
elm.setAttribute("id", "menu_RestartFirefoxKs")
elm.setAttribute("oncommand", function(){
ext.exec("restart-firefox");});
var menu = document.getElementById("menu_FilePopup");
// menu.insertBefore(elm, menu.getElementById("menu_FileQuitItem"));
menu.appendChild(elm);
}, "add restart firefox menu");

//////////////////////////////////////
//
ext.add("fullscreen-page",function (ev) {
getBrowser().selectedTab = getBrowser().addTab("http://home.tiscali.nl/annejan/swf/timeline.swf");
BrowserFullScreen();
}, "fullscreen page");

//////////////////////////////////////
// restart firefox
// http://keysnail.g.hatena.ne.jp/Shinnya/20100723/1279878815
ext.add("restart-firefox",function (ev) {
const nsIAppStartup = Components.interfaces.nsIAppStartup;
// Notify all windows that an application quit has been requested.
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
.createInstance(Components.interfaces.nsISupportsPRBool);
os.notifyObservers(cancelQuit, "quit-application-requested", null);
// Something aborted the quit process.
if (cancelQuit.data)
return;
// Notify all windows that an application quit has been granted.
os.notifyObservers(null, "quit-application-granted", null);
// Enumerate all windows and call shutdown handlers
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var windows = wm.getEnumerator(null);
while (windows.hasMoreElements()) {
var win = windows.getNext();
if (("tryToClose" in win) && !win.tryToClose())
return;
}
Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup)
.quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit);
}, "restart firefox");

/////////////////////////////////////////
// copy feed url
ext.add("copy-url", function () {
const doc = content.document;

let feeds = [[e.getAttribute("title"), e.getAttribute("href")]
for ([, e] in Iterator(doc.querySelectorAll(['link[type="application/rss+xml"]',
'link[type="application/atom+xml"]'])))];
var uh = window.content.location.href.replace(/(.*?\/\/[^/]*)(\/.*)?/,"$1");
for (i = 0; i < feeds.length; i++)
if ( feeds[i][1].substr(0,1) == "/" ) feeds[i][1] = uh + feeds[i][1];
feeds.unshift([window.content.document.title,window.content.location.href]);
prompt.selector(
{
message : "Select Feed",
collection : feeds,
callback : function (i) {
if (i >= 0)
command.setClipboardText(feeds[i][1]);
}
}
);
}, "Copy url or feed url of current page");

///////////////////////////////////////
// 評価しちゃうっぽい とりあえずこんな感じで
ext.add("keysnail-setting-menu",function(){
var settingmenulist = [["keysnail setting dialogue",function(){return function(){KeySnail.openPreference();};}],
["firefox addon manager",function(){return function(){BrowserOpenAddonsMgr();};}],
["reload .keysnail.js",function(){return function() {userscript.reload();};}],
["check for plugins update",function(){return function(){ext.exec("check-for-plugins-update");};}],
];
prompt.selector(
{
message : "open setting dialog",
collection : settingmenulist,
callback : function (i) { settingmenulist[i][1]()(); },
});
},"open keysnail setting menu");

//////////////////////////
//プラグイン一括アップデート
ext.add("check-for-plugins-update", function () {
[p for (p in plugins.context)].forEach(function (p) { try { userscript.updatePlugin(p); } catch(e) {} });
}, "Check for all plugin's update");

////////////////////////
//マルチプルタブハンドラ
ext.add("multiple-tab-handler-close-selected-and-current-tabs", function () {
BrowserCloseTabOrWindow();
// if (MultipleTabService) {
// //BrowserCloseTabOrWindow();
// //MultipleTabService.setSelection(gBrowser.mCurrentTab, true);
MultipleTabService.closeTabs(MultipleTabService.getSelectedTabs());
// } else {
// BrowserCloseTabOrWindow();}
}, '選択タブと現在のタブを閉じる');

ext.add("if-mth-exist", function() {
if (MultipleTabService != undefined) display.echoStatusBar("true");
},'if mth exist');

////////////////////////
// instapaper
ext.add("instapaper-add-this-page-and-close",function(){
var url = window.content.location.href;
var title = window.content.document.title;
var tab = gBrowser.selectedTab;
var username = "8slashes+instapaper@gmail.com";
var password = "";
var passwordManager = (Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager));
var logins = passwordManager.findLogins({}, "http://www.instapaper.com", "", null);
for (var i = 0; i < logins.length; i++) {
if (logins[i].username == username) {
password = logins[i].password;
break;
}
}
var comment = "";
// prompt.read("Instapaper comment:",function(cm){
// if(cm){comment = cm;}
// });
display.echoStatusBar("Instapaper: adding " + url + "...");
util.httpPost("https://www.instapaper.com/api/add",
{"username" : encodeURIComponent(username),
"password" : password,
"url" : encodeURIComponent(url),
"title" : encodeURIComponent(title),},
function (xhr) {
display.echoStatusBar(xhr.status);
if (xhr.readyState == 4 && xhr.status == 201) {
// var title = decodeURIComponent(xhr.getResponseHeader("X-Instapaper-Title")); //超文字化けする
try {
Components.classes['@mozilla.org/alerts-service;1'].
getService(Components.interfaces.nsIAlertsService).
showAlertNotification(null, "Instapaper", "Page " + title + " added successfully", false, '', null);
} catch(e) {
// prevents runtime error on platforms that don't implement nsIAlertsService
}
display.echoStatusBar("Instapaper: adding " + url + "...done.");
gBrowser.removeTab(tab);
} else{
display.echoStatusBar("Instapaper: Something wrong has happended!");
if (window.loadURI) {
loadURI("javascript:function%20iprl5(){var%20d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location;try{if(!b)throw(0);d.title='(Saving...)%20'+d.title;z.setAttribute('src',l.protocol+'//www.instapaper.com/j/mt8YO6Cuosmf?u='+encodeURIComponent(l.href)+'&t='+(new%20Date().getTime()));b.appendChild(z);}catch(e){alert('Please%20wait%20until%20the%20page%20has%20loaded.');}}iprl5();void(0)");
}
}
});
},'instapaper add page and close tab when done without error.');

////////////////////////
//検索
ext.add("query-then-engine", function () {
prompt.reader({message : "Search Word?:",
callback : function (q) {
if (q) {
prompt.selector({ message : "search \"" + q + "\" with?",
collection : plugins.options["search-url-list"],
width : [20,80],
callback : function (i) { getBrowser().selectedTab = getBrowser().addTab(plugins.options["search-url-list"][i][1].replace("%r",q).replace("%q",encodeURIComponent(q))); },
});
};
},
initialInput : content.document.getSelection() || "",
});
}, "enter search word and then select engine");

///////////////////////
//diggler
ext.add("dig-url", function () {
var url = window.content.location.href;
var nsurl = [];
var pname = "";
var ssurl = [];
var durl = [];
nsurl = url.split("#");
var pname = nsurl[1];
ssurl = nsurl[0].split("/");
durl[0] = ssurl[0] + "//" + ssurl[2];
ssurl.splice(0,3);
for (var i = 0; i < ssurl.length; i++){
var durlsaved = durl[0];
durl.unshift(durlsaved + "/" + ssurl[i]);
};
if (pname) {
var durlfull = durl[0] + "#"+ pname;
durl.unshift(durlfull);
};
prompt.selector({ message : "dig " + url,
collection : durl,
callback : function (i) { window.content.location.href = durl[i]; },
});
},"keysnail diggler ");

/////////////////////////////////////
// 閉じたタブリスト
ext.add("list-closed-tabs", function () {
const fav = "chrome://mozapps/skin/places/defaultFavicon.png";
var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
var json = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON);
var closedTabs = [[tab.image || fav, tab.title, tab.url] for each (tab in json.decode(ss.getClosedTabData(window)))];

if (!closedTabs.length)
return void display.echoStatusBar("最近閉じたタブが見つかりませんでした", 2000);

prompt.selector(
{
message : "select tab to undo:",
collection : closedTabs,
flags : [ICON | IGNORE, 0, 0],
callback : function (i) { if (i >= 0) window.undoCloseTab(i); }
});
}, "List closed tabs");

ext.add("echo-closed-tabs", function () {
var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
var json = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON);
// var closedTabs = [[tab.image || fav, tab.title, tab.url] for each (tab in json.decode(ss.getClosedTabData(window)))];
var lasttab = json.decode(ss.getClosedTabData(window))[0];
dump = ""
for (var i in lasttab) { dump += lasttab[i] + "\n"; }
confirm(dump);

}, "List closed tabs");

///////////////////////////////////////
//
ext.add("focus-on-content", function(){
document.getElementById("searchbar").focus();
document.commandDispatcher.advanceFocus();
document.commandDispatcher.advanceFocus();
}, "forcus on content");

ext.add("_focus-on-content", function(){
gBrowser.focus();
_content.focus();
}, "focus on content");

ext.add("hide-sidebar", function(){
var sidebarBox = document.getElementById("sidebar-box");
if (!sidebarBox.hidden) {
toggleSidebar(sidebarBox.getAttribute("sidebarcommand"));
}
}, "hide-sidebar");


//}}%PRESERVE%
// ========================================================================= //

// ========================= Special key settings ========================== //

key.quitKey = "ESC";
key.helpKey = "C-h";
key.escapeKey = "C-q";
key.macroStartKey = "";
key.macroEndKey = "";
key.universalArgumentKey = "C-u";
key.negativeArgument1Key = "C--";
key.negativeArgument2Key = "C-M--";
key.negativeArgument3Key = "M--";
key.suspendKey = "Not defined";

// ================================= Hooks ================================= //

hook.setHook('KeySnailInitialized', function () {
ext.exec("shiitake-toggle-style");
});

hook.setHook('KeyBoardQuit', function (aEvent) {
command.closeFindBar();
if (util.isCaretEnabled()) {
command.resetMark(aEvent);
} else {
goDoCommand("cmd_selectNone");
}
key.generateKey(aEvent.originalTarget, KeyEvent.DOM_VK_ESCAPE, true);
});
hook.addToHook('KeyBoardQuit', function (aEvent) {
ext.exec("hide-sidebar");
});

hook.setHook('Unload', function () {
util.getBrowserWindows().some(function (win) {
if (win === window) {
return false;
}
const ks = win.KeySnail;
share.pluginUpdater = ks.getPluginUpdater(share.pluginUpdater.pluginsWithUpdate);
ks.setUpPluginUpdaterDelegator();
return true;
});
});


// ============================= Key bindings ============================== //

key.setGlobalKey([['<delete>'], ['\\']], function (ev, arg) {
ev.target.dispatchEvent(key.stringToKeyEvent("ESC", true));
}, 'escape');

key.setGlobalKey('C-<right>', function () {
gBrowser.mTabContainer.advanceSelectedTab(1, true);
}, 'ひとつ右のタブへ');

key.setGlobalKey('C-<left>', function () {
gBrowser.mTabContainer.advanceSelectedTab(-1, true);
}, 'ひとつ左のタブへ');

key.setGlobalKey('C-<up>', function () {
var browser = getBrowser();
if (browser.mCurrentTab.previousSibling) {
browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos - 1);
} else {
browser.moveTabTo(browser.mCurrentTab, browser.mTabContainer.childNodes.length - 1);
}
}, '選択中のタブを右へ');

key.setGlobalKey('C-<down>', function () {
var browser = getBrowser();
if (browser.mCurrentTab.nextSibling) {
browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos + 1);
} else {
browser.moveTabTo(browser.mCurrentTab, 0);
}
}, '選択中のタブを左へ');

key.setGlobalKey('M-:', function (ev) {
command.interpreter();
}, 'JavaScript のコードを評価');

key.setGlobalKey('C-g', function (ev, arg) {
return;
}, 'ignore');

key.setViewKey('0', function (ev, arg) {
var n = gBrowser.mCurrentTab._tPos;
BrowserCloseTabOrWindow();
gBrowser.selectedTab = gBrowser.mTabs[n];
}, '閉じて次のタブ');

key.setViewKey('x', function (aEvent, aArg) {
ext.select(aArg, aEvent);
}, 'エクステ一覧');

key.setViewKey(['t', 'm'], function (ev, arg) {
if (window.loadURI) {
loadURI("javascript:window.location='http://api.tweetmeme.com/visit?url='+window.location;");
}
}, 'open with tweetmeme');

key.setViewKey(['t', 'w'], function (ev, arg) {
ext.exec("twitter-client-tweet", arg, ev);
}, 'つぶやく', true);

key.setViewKey(['t', 'p'], function (ev, arg) {
ext.exec("twitter-client-tweet-this-page", arg, ev);
}, 'このページのタイトルと URL を使ってつぶやく', true);

key.setViewKey('u', function () {
undoCloseTab();
}, '閉じたタブを元に戻す');

key.setViewKey('g', function () {
goDoCommand("cmd_scrollTop");
}, 'ページ先頭へ移動');

key.setViewKey('G', function () {
goDoCommand("cmd_scrollBottom");
}, 'ページ末尾へ移動');

key.setViewKey('r', function (aEvent) {
BrowserReload();
}, '再読み込み');

key.setViewKey('m', function (ev, arg) {
_fi.toogle();
}, 'fetchimiをトグル');

key.setViewKey('d', function (ev, arg) {
if (window.loadURI) {
loadURI("javascript:(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=no,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()}})()");
}
}, 'deliciousでブックマーク');

key.setViewKey('p', function (ev, arg) {
if (window.loadURI) {
loadURI("javascript:var%20b=document.body;var%20POSTEROUS___bookmarklet_domain='http://posterous.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.type='text/javascript');void(z.src='http://posterous.com/javascripts/bookmarklet2.js');void(b.appendChild(z));}else{}");
}
}, 'posterousに投稿');

key.setViewKey('SPC', function (ev, arg) {
MultipleTabService.toggleSelection(gBrowser.mCurrentTab);
gBrowser.mTabContainer.advanceSelectedTab(1, true);
}, 'タブの選択をトグルして次のタブ');

key.setViewKey('S-SPC', function (ev, arg) {
MultipleTabService.toggleSelection(gBrowser.selectedTab);
gBrowser.mTabContainer.advanceSelectedTab(-1, true);
}, 'タブの選択をトグルして前のタブ');

key.setViewKey('z', function (ev, arg) {
ext.exec("keysnail-setting-menu", arg, ev);
}, 'open keysnail setting menu', true);

key.setViewKey('T', function (ev, arg) {
ext.exec("google-itranslate", arg, ev);
}, 'google itranslate', true);

key.setViewKey('l', function (ev, arg) {
var n = gBrowser.mCurrentTab._tPos;
gBrowser.moveTabTo(gBrowser.mCurrentTab, gBrowser.mTabContainer.childNodes.length - 1);
gBrowser.selectedTab = gBrowser.mTabs[n];
}, 'このタブを後回し');

key.setViewKey('C-SPC', function (ev, arg) {
MultipleTabService.toggleSelection(gBrowser.selectedTab);
}, 'タブの選択をトグル');

key.setViewKey('s', function (ev, arg) {
var n = gBrowser.mCurrentTab._tPos;
gBrowser.moveTabTo(gBrowser.mCurrentTab, 0);
if (n != 0) {
gBrowser.selectedTab = gBrowser.mTabs[n];
}
}, 'このタブを保持する');

key.setViewKey('U', function (ev, arg) {
ext.exec("list-closed-tabs", arg, ev);
}, 'List closed tabs', true);

key.setViewKey('e', function () {
command.focusElement(command.elementsRetrieverTextarea, 0);
}, '最初のインプットエリアへフォーカス', true);

key.setViewKey('S', function (ev, arg) {
if (window.loadURI) {
loadURI("javascript:var%20b=document.body;var%20GR________bookmarklet_domain='https://www.google.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.src='https://www.google.com/reader/ui/link-bookmarklet.js');void(b.appendChild(z));}else{}");
}
}, 'google reader share');

key.setViewKey('!', function (ev, arg) {
shell.input();
}, 'Command system');

key.setViewKey('b', function (ev, arg) {
BarTap.putOnTap(gBrowser.mCurrentTab, gBrowser);
}, 'bartab put on tab');

key.setViewKey('R', function () {
BrowserReloadSkipCache();
}, '更新(キャッシュを無視)');

key.setViewKey('<backspace>', function () {
BrowserBack();
}, '戻る');

key.setViewKey('S-<backspace>', function () {
BrowserForward();
}, '進む');

key.setViewKey('q', function (ev, arg) {
ext.exec("query-then-engine", arg, ev);
}, 'enter search word and then select engine', true);

key.setViewKey('D', function (ev, arg) {
ext.exec("dig-url", arg, ev);
}, 'keysnail diggler ', true);

key.setViewKey('/', function () {
command.iSearchForward();
}, 'インクリメンタル検索', true);

key.setViewKey('?', function (ev) {
command.iSearchForwardKs(ev);
}, 'Emacs ライクなインクリメンタル検索', true);

key.setViewKey('a', function (ev, arg) {
allTabs.open();
}, 'alltabs.open');

key.setViewKey('C', function (ev, arg) {
ext.exec("copy-url", arg, ev);
}, '選択タブと現在のタブを閉じる', true);

key.setViewKey('I', function (ev, arg) {
ext.exec("instapaper-add-this-page-and-close", arg, ev);
}, 'instapaper add page', true);

key.setViewKey('<left>', function (ev) {
goDoCommand("cmd_scrollPageUp");
}, '一画面分スクロールアップ');

key.setViewKey('<right>', function (ev) {
goDoCommand("cmd_scrollPageDown");
}, '一画面スクロールダウン');

key.setViewKey('C-w', function (ev) {
command.copyRegion(ev);
}, '選択中のテキストをコピー');

key.setViewKey([['<prior>'], ['<next>']], function (ev, arg) {
return;
}, 'ignore');

key.setEditKey(['C-x', 'h'], function (ev) {
command.selectAll(ev);
}, '全て選択', true);

key.setEditKey([['C-x', 'u'], ['C-_']], function (ev) {
display.echoStatusBar("Undo!", 2000);
goDoCommand("cmd_undo");
}, 'アンドゥ');

key.setEditKey(['C-x', 'r', 'd'], function (ev, arg) {
command.replaceRectangle(ev.originalTarget, "", false, !arg);
}, '矩形削除', true);

key.setEditKey(['C-x', 'r', 't'], function (ev) {
prompt.read("String rectangle: ", function (aStr, aInput) {command.replaceRectangle(aInput, aStr);}, ev.originalTarget);
}, '矩形置換', true);

key.setEditKey(['C-x', 'r', 'o'], function (ev) {
command.openRectangle(ev.originalTarget);
}, '矩形行空け', true);

key.setEditKey(['C-x', 'r', 'k'], function (ev, arg) {
command.kill.buffer = command.killRectangle(ev.originalTarget, !arg);
}, '矩形キル', true);

key.setEditKey(['C-x', 'r', 'y'], function (ev) {
command.yankRectangle(ev.originalTarget, command.kill.buffer);
}, '矩形ヤンク', true);

key.setEditKey([['C-SPC'], ['C-@']], function (ev) {
command.setMark(ev);
}, 'マークをセット', true);

key.setEditKey('C-o', function (ev) {
command.openLine(ev);
}, '行を開く (Open line)');

key.setEditKey('C-\\', function (ev) {
display.echoStatusBar("Redo!", 2000);
goDoCommand("cmd_redo");
}, 'リドゥ');

key.setEditKey('C-a', function (ev) {
command.beginLine(ev);
}, '行頭へ移動');

key.setEditKey('C-e', function (ev) {
command.endLine(ev);
}, '行末へ');

key.setEditKey('M-h', function (ev) {
command.previousChar(ev);
}, '一文字左へ移動');

key.setEditKey('M-f', function (ev) {
command.forwardWord(ev);
}, '一単語右へ移動');

key.setEditKey('M-b', function (ev) {
command.backwardWord(ev);
}, '一単語左へ移動');

key.setEditKey('M-j', function (ev) {
command.nextLine(ev);
}, '一行下へ');

key.setEditKey('M-k', function (ev) {
command.previousLine(ev);
}, '一行上へ');

key.setEditKey('C-v', function (ev) {
command.pageDown(ev);
}, '一画面分下へ');

key.setEditKey('M-v', function (ev) {
command.pageUp(ev);
}, '一画面分上へ');

key.setEditKey('M-<', function (ev) {
command.moveTop(ev);
}, 'テキストエリア先頭へ');

key.setEditKey('M->', function (ev) {
command.moveBottom(ev);
}, 'テキストエリア末尾へ');

key.setEditKey('C-d', function (ev) {
goDoCommand("cmd_deleteCharForward");
}, '次の一文字削除');

key.setEditKey('C-h', function (ev) {
goDoCommand("cmd_deleteCharBackward");
}, '前の一文字を削除');

key.setEditKey('M-d', function (ev) {
command.deleteForwardWord(ev);
}, '次の一単語を削除');

key.setEditKey([['C-<backspace>'], ['M-<delete>']], function (ev) {
command.deleteBackwardWord(ev);
}, '前の一単語を削除');

key.setEditKey('M-u', function (ev, arg) {
command.wordCommand(ev, arg, command.upcaseForwardWord, command.upcaseBackwardWord);
}, '次の一単語を全て大文字に (Upper case)');

key.setEditKey('M-c', function (ev, arg) {
command.wordCommand(ev, arg, command.capitalizeForwardWord, command.capitalizeBackwardWord);
}, '次の一単語をキャピタライズ');

key.setEditKey('C-k', function (ev) {
command.killLine(ev);
}, 'カーソルから先を一行カット (Kill line)');

key.setEditKey('C-y', command.yank, '貼り付け (Yank)');

key.setEditKey('M-y', command.yankPop, '古いクリップボードの中身を順に貼り付け (Yank pop)', true);

key.setEditKey('C-M-y', function (ev) {
if (!command.kill.ring.length) {
return;
}
let (ct = command.getClipboardText()) (!command.kill.ring.length || ct != command.kill.ring[0]) &&
command.pushKillRing(ct);
prompt.selector({message: "Paste:", collection: command.kill.ring, callback: function (i) {if (i >= 0) {key.insertText(command.kill.ring[i]);}}});
}, '以前にコピーしたテキスト一覧から選択して貼り付け', true);

key.setEditKey('C-w', function (ev) {
goDoCommand("cmd_copy");
goDoCommand("cmd_delete");
command.resetMark(ev);
}, '選択中のテキストを切り取り (Kill region)', true);

key.setEditKey('M-n', function (ev) {
command.walkInputElement(command.elementsRetrieverTextarea, true, true);
}, '次のテキストエリアへフォーカス');

key.setEditKey('M-p', function (ev) {
command.walkInputElement(command.elementsRetrieverTextarea, false, true);
}, '前のテキストエリアへフォーカス');

key.setEditKey('M-w', function (ev) {
command.copyRegion(ev);
}, '選択中のテキストをコピー');

key.setEditKey('M-l', function (ev) {
command.nextChar(ev);
}, '一文字右へ移動');

+ 41
- 0
.profile 查看文件

@@ -0,0 +1,41 @@
#!/bin/bash
if [ -n "${DESKTOP_SESSION}" ]; then
xmodmap -e 'keycode 135 = Alt_R Meta_R' # menu key as alt
xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt
xmodmap -e 'remove Lock = Caps_Lock'
xmodmap -e 'add Control = Caps_Lock'

synclient VertEdgeScroll=0
synclient HorizEdgeScroll=0
synclient MaxTapTime=0
synclient MaxSpeed=0.4
synclient MinSpeed=0.2
fi

export LC_TIME=C
export TERMCAP="${TERMCAP}:vb="
export HOSTNAME
export BROWSER=firefox
# export TMP=/tmp
# export TEMP=/tmp

addtopath(){
for p in "$@"
do
echo $PATH | grep -E "^$p:|:$p:|:$p$" >/dev/null 2>&1 || PATH="$p:${PATH}"
done
}
# export PATH="${PATH}:${HOME}/bin:${HOME}/dbx/dev/bin"
addtopath ${HOME}/bin

type git 1>/dev/null 2>&1 && test ! -f ~/.gitconfig && {
# export GISTY_DIR="$HOME/dev/gists"
git config --global user.name "10sr"
git config --global user.email sr10@users.sourceforge.jp
git config --global core.autocrlf false
# git config --global github.token **
}

test -f "${HOME}/.pythonrc" && export PYTHONSTARTUP="${HOME}/.pythonrc"
export PYTHONPATH=~/.py


+ 137
- 0
.vimrc 查看文件

@@ -0,0 +1,137 @@
"外部ファイル読み込み
"if filereadable(expand('~/filepath'))
"source ~/filepath
"endif
if !isdirectory(expand('~/.vim'))
call mkdir(expand('~/.vim'))
endif

"""""""""""""""""""""""""""""""""""
"set nocompatible "vi互換にしない
"バックアップファイルを作るディレクトリ
if !isdirectory(expand('~/.vim/backup'))
call mkdir(expand('~/.vim/backup'))
endif
filetype plugin indent on
set backup "バックアップ
set backupdir=$HOME/.vim/backup
set swapfile "スワップファイル用のディレクトリ
set directory=$HOME/.vim/backup
set viminfo+=n~/.vim/viminfo "viminfo
set list "タブ文字、行末など不可視文字を表示する
set listchars=tab:>-,extends:<,trail:-,eol:$ "listで表示される文字のフォーマットを指定する
set showmatch "閉じ括弧が入力されたとき、対応する括弧を表示する
set ignorecase
set smartcase "検索時に大文字を含んでいたら大/小を区別
set whichwrap=b,s,h,l,<,>,[,] "カーソルを行頭、行末で止まらないようにする
set showmode "モード表示
"set title "編集中のファイル名を表示
set incsearch
set wrapscan "折り返し検索
set showmatch "括弧を閉じた時、対になる括弧を一瞬ハイライトする
set ruler "行番号、カーソル位置を表示
"set number
set laststatus=2 "ステータスラインを常に表示
set showcmd
set scrolloff=2 "常に前後2行を表示
syntax enable "シンタックス
set hidden "編集中でも他ファイルへ移動可
set backspace=indent,eol,start "バックスペースでなんでも消せるように
"set autochdir "自動的にカレントディレクトリを現在のファイルのディレクトリにする macだと出来ないってゆわれた
set encoding=utf-8 "言語設定
set fileencodings=utf-8,shift-jis,euc-jp,latin1
set mouse=h "マウス使わない
set clipboard+=unnamed "クリップボードをWindowsと連携
set visualbell "ビープしない
set browsedir=buffer "バッファで開いているファイルのディレクトリ

set tabstop=4 "タブの画面上での幅
set shiftwidth=4 "width of indent
set expandtab "タブをスペースに展開する
set autoindent "オートインデント
set smartindent

let g:netrw_liststyle = 1
let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'

"gvimrc分けるのめんどい
if has('gui_running')
"ツールバー、スクロールバー消す
set guioptions-=T
set guioptions-=r
set lines=45
set columns=110
set guifont=DejaVu\ Sans\ Mono\ 9
endif

if has('win32')
"Windows 用の設定
endif

"""""""""""""""""""""""""""""""""""""""
"マップ
"imap <c-j> <esc> でC-Jをescにできる。?
"nmap
"vmap
"map でそれぞれのモードでマップを指定
"キーマッピングには大きく分けて map と noremap の 2 つの種類があります。
"* map はキーシーケンスを展開したあと、さらに別のマップを適用しようとします。
"* noremap は一度だけ展開します。
"→マップを再帰的に展開するときはmap、決め打ちはnoremap(キーの入れ替えなど)
"割と保存
inoremap <ESC> <ESC>:<C-u>w<CR>
inoremap <C-c> <ESC>:<C-u>w<CR>
noremap <C-c> <ESC>:<C-u>w<CR>

"方向キーでバッファ操作
"nnoremap <LEFT> <C-c>:bp!<CR>
"nnoremap <RIGHT> <C-c>:bn!<CR>
"nnoremap <UP> <C-c>:ls!<CR>
"nnoremap <DOWN> <C-c>:bd
"nnoremap <C-m>cd <C-c>:cd%:h<CR>
nnoremap <C-o> <C-c>:Explore<CR>

"http://d.hatena.ne.jp/yuroyoro/20101104/1288879591
"見た目で行移動
nnoremap j gj
nnoremap k gk

" highlight current line
" set cursorline
" カレントウィンドウにのみ罫線を引く
augroup cch
autocmd! cch
autocmd WinLeave * set nocursorline
autocmd WinEnter,BufRead * set cursorline
augroup END

hi clear CursorLine
highlight CursorLine term=underline cterm=underline gui=underline

"入力モード時、ステータスラインのカラーを変更
augroup InsertHook
autocmd!
autocmd InsertEnter * highlight StatusLine guifg=#ccdc90 guibg=#2E4340
autocmd InsertLeave * highlight StatusLine guifg=#2E4340 guibg=#ccdc90
augroup END

" save window position and size
if has('gui_running')
let g:save_window_file = expand('~/.vimwinpos')
augroup SaveWindow
autocmd!
autocmd VimLeavePre * call s:save_window()
function! s:save_window()
let options = [
\ 'set columns=' . &columns,
\ 'set lines=' . &lines,
\ 'winpos ' . getwinposx() . ' ' . getwinposy(),
\ ]
call writefile(options, g:save_window_file)
endfunction
augroup END

if filereadable(g:save_window_file)
execute 'source' g:save_window_file
endif
endif

正在加载...
取消
保存