Browse Source

Merge branch 'master' of github.com:10sr/dotfiles

pull/1/head
10sr 11 years ago
parent
commit
1501df106c
3 changed files with 28 additions and 39 deletions
  1. +22
    -30
      _keysnail.js
  2. +5
    -7
      emacs.el
  3. +1
    -2
      shrc

+ 22
- 30
_keysnail.js View File

@@ -160,7 +160,7 @@ local["^https?://(www\.|cloud\.|)feedly\.com/"] = [
// }], // }],
['l', function(ev, arg){ ['l', function(ev, arg){
var host = window.content.location.host; var host = window.content.location.host;
if (host === "cloud.feedly.com") {
if (host === "cloud.feedly.com" || host === "feedly.com") {
window.content.location.href = "http://" + host + "/#latest"; window.content.location.href = "http://" + host + "/#latest";
} else if (host === "www.feedly.com") { } else if (host === "www.feedly.com") {
window.content.location.href = "http://" + host + "/home#latest"; window.content.location.href = "http://" + host + "/home#latest";
@@ -296,8 +296,8 @@ ext.add("my-index-html", function(ev, arg){
}, "open my index.html"); }, "open my index.html");


ext.add("echo-tab-info", function(){ ext.add("echo-tab-info", function(){
var all = gBrowser.tabs.length;
var ix = gBrowser.mCurrentTab._tPos;
var all = getBrowser().tabs.length;
var ix = getBrowser().mCurrentTab._tPos;
var title = window.document.title; var title = window.document.title;
var url = window.content.location.href; var url = window.content.location.href;
display.echoStatusBar((ix + 1).toString() + " / " + display.echoStatusBar((ix + 1).toString() + " / " +
@@ -465,10 +465,10 @@ ext.add('auto-install-plugins', function(ev, arg){
}, 'Install plugins automatically if not installed yet.'); }, 'Install plugins automatically if not installed yet.');


ext.add('put-aside-this-page', function (ev, arg) { ext.add('put-aside-this-page', function (ev, arg) {
var n = gBrowser.mCurrentTab._tPos;
gBrowser.moveTabTo(gBrowser.mCurrentTab, 0);
var n = getBrowser().mCurrentTab._tPos;
getBrowser().moveTabTo(getBrowser().mCurrentTab, 0);
if (n != 0) { if (n != 0) {
gBrowser.selectedTab = gBrowser.mTabs[n];
getBrowser().selectedTab = getBrowser().mTabs[n];
} }
}, 'put aside this page'); }, 'put aside this page');


@@ -495,9 +495,9 @@ ext.add("hide-sidebar", function(){
}, "hide-sidebar"); }, "hide-sidebar");


ext.add("close-and-next-tab", function (ev, arg) { ext.add("close-and-next-tab", function (ev, arg) {
var n = gBrowser.mCurrentTab._tPos;
gBrowser.removeCurrentTab();
gBrowser.selectedTab = gBrowser.mTabs[n];
var n = getBrowser().mCurrentTab._tPos;
getBrowser().removeCurrentTab();
getBrowser().selectedTab = getBrowser().mTabs[n];
}, "close and focus to next tab"); }, "close and focus to next tab");


////////////////////////////////////// //////////////////////////////////////
@@ -693,7 +693,7 @@ ext.add("list-closed-tabs", function () {
ext.add("list-tab-history", function () { ext.add("list-tab-history", function () {
const fav = "chrome://mozapps/skin/places/defaultFavicon.png"; const fav = "chrome://mozapps/skin/places/defaultFavicon.png";
var tabHistory = []; var tabHistory = [];
var sessionHistory = gBrowser.webNavigation.sessionHistory;
var sessionHistory = getBrowser().webNavigation.sessionHistory;
if (sessionHistory.count < 1) if (sessionHistory.count < 1)
return void display.echoStatusBar("Tab history not exist", 2000); return void display.echoStatusBar("Tab history not exist", 2000);
var curIdx = sessionHistory.index; var curIdx = sessionHistory.index;
@@ -720,7 +720,8 @@ ext.add("list-tab-history", function () {
header : ["Title", "URL"], header : ["Title", "URL"],
initialIndex : thIdx, initialIndex : thIdx,
callback : function(i) { callback : function(i) {
if (i >= 0) gBrowser.webNavigation.gotoIndex(tabHistory[i][3]);
if (i >= 0)
getBrowser().webNavigation.gotoIndex(tabHistory[i][3]);
} }
}); });
}, 'List tab history'); }, 'List tab history');
@@ -743,11 +744,10 @@ key.suspendKey = "Not defined";


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



hook.setHook('KeyBoardQuit', function (aEvent) { hook.setHook('KeyBoardQuit', function (aEvent) {
// ext.exec("hide-sidebar"); // ext.exec("hide-sidebar");
let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); let(elem = document.commandDispatcher.focusedElement) elem && elem.blur();
gBrowser.focus();
getBrowser().focus();
content.focus(); content.focus();
command.closeFindBar(); command.closeFindBar();
if (util.isCaretEnabled()) { if (util.isCaretEnabled()) {
@@ -774,14 +774,6 @@ hook.setHook('Unload', function () {


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


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 () { key.setGlobalKey('C-<up>', function () {
var browser = getBrowser(); var browser = getBrowser();
if (browser.mCurrentTab.previousSibling) { if (browser.mCurrentTab.previousSibling) {
@@ -803,7 +795,7 @@ key.setGlobalKey('C-<down>', function () {


key.setGlobalKey('<delete>', function (ev, arg) { key.setGlobalKey('<delete>', function (ev, arg) {
let (elem = document.commandDispatcher.focusedElement) elem && elem.blur(); let (elem = document.commandDispatcher.focusedElement) elem && elem.blur();
gBrowser.focus();
getBrowser().focus();
content.focus(); content.focus();
}, 'コンテンツへフォーカス', true); }, 'コンテンツへフォーカス', true);


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


key.setViewKey('u', function (ev) {
key.setViewKey([['u'], ['S-SPC']], function (ev) {
goDoCommand("cmd_scrollPageUp"); goDoCommand("cmd_scrollPageUp");
}, '一画面分スクロールアップ'); }, '一画面分スクロールアップ');


@@ -913,7 +905,7 @@ key.setViewKey('a', function (ev, arg) {
allTabs.open(); allTabs.open();
}, 'alltabs.open'); }, 'alltabs.open');


key.setViewKey('d', function (ev) {
key.setViewKey([['d'], ['SPC']], function (ev) {
goDoCommand("cmd_scrollPageDown"); goDoCommand("cmd_scrollPageDown");
}, '一画面スクロールダウン'); }, '一画面スクロールダウン');


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


key.setViewKey('S-SPC', function (ev) {
goDoCommand("cmd_scrollPageUp");
}, '一画面分スクロールアップ');
key.setGlobalKey('C-<right>', function (ev) {
getBrowser().mTabContainer.advanceSelectedTab(1, true);
}, 'ひとつ右のタブへ');


key.setViewKey('SPC', function (ev) {
goDoCommand("cmd_scrollPageDown");
}, '一画面スクロールダウン');
key.setGlobalKey('C-<left>', function (ev) {
getBrowser().mTabContainer.advanceSelectedTab(-1, true);
}, 'ひとつ左のタブへ');

+ 5
- 7
emacs.el View File

@@ -1007,18 +1007,16 @@ found, otherwise returns nil."
"https://raw.github.com/mooz/js2-mode/master/js2-mode.el" "https://raw.github.com/mooz/js2-mode/master/js2-mode.el"
t) t)
(lazy-load-eval 'js2-mode) (lazy-load-eval 'js2-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.jsm\\'" . js2-mode))
;; (add-hook 'js2-mode-hook
;; (lambda ()
;; (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
;; (add-to-list 'auto-mode-alist '("\\.jsm\\'" . js2-mode))
(add-hook 'js2-mode-hook (add-hook 'js2-mode-hook
(lambda () (lambda ()
(define-key js2-mode-map (kbd "C-m") (lambda () (define-key js2-mode-map (kbd "C-m") (lambda ()
(interactive) (interactive)
(js2-enter-key) (js2-enter-key)
(indent-for-tab-command))) (indent-for-tab-command)))
(add-hook (kill-local-variable 'before-save-hook)
'js2-before-save)
;; (add-hook (kill-local-variable 'before-save-hook)
;; 'js2-before-save)
;; (add-hook 'before-save-hook ;; (add-hook 'before-save-hook
;; 'my-indent-buffer ;; 'my-indent-buffer
;; nil ;; nil
@@ -1364,7 +1362,7 @@ If called intearctively, find word at point."
t) ; save to file immediately after adding file to recentf list t) ; save to file immediately after adding file to recentf list
(add-hook 'kill-emacs-hook (add-hook 'kill-emacs-hook
'recentf-load-list) 'recentf-load-list)
(run-with-idle-timer 5 t 'recentf-save-list)
;;(run-with-idle-timer 5 t 'recentf-save-list)
;; (add-hook 'find-file-hook ;; (add-hook 'find-file-hook
;; (lambda () ;; (lambda ()
;; (recentf-add-file default-directory))) ;; (recentf-add-file default-directory)))


+ 1
- 2
shrc View File

@@ -375,8 +375,7 @@ fi
# pwd # pwd
# } # }
cd(){ cd(){
builtin cd "$@"
pwd
builtin cd "$@" && pwd
} }


# pad # pad


Loading…
Cancel
Save