Browse Source

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

pull/1/head
10sr 11 years ago
parent
commit
a0287ab4d2
4 changed files with 121 additions and 87 deletions
  1. +45
    -10
      _keysnail.js
  2. +2
    -1
      bashrc
  3. +60
    -69
      emacs.el
  4. +14
    -7
      tmux.conf

+ 45
- 10
_keysnail.js View File

@@ -559,7 +559,6 @@ key.suspendKey = "Not defined";

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


hook.setHook('KeyBoardQuit', function (aEvent) {
ext.exec("hide-sidebar");
let(elem = document.commandDispatcher.focusedElement) elem && elem.blur();
@@ -587,6 +586,7 @@ hook.setHook('Unload', function () {
});



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

key.setGlobalKey('C-<right>', function () {
@@ -615,21 +615,12 @@ key.setGlobalKey('C-<down>', function () {
}
}, '選択中のタブを左へ');

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

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

key.setGlobalKey('C-p', function (ev, arg) {
return !document.getElementById("keysnail-prompt").hidden &&
document.getElementById("keysnail-prompt-textbox").focus();
}, 'KeySnail のプロンプトへフォーカス', true);

key.setGlobalKey('<f11>', function (ev, arg) {
ext.exec("strong-fullscreen", arg, ev);
}, 'go fullscreen with hiding toolbar and tabbar', true);
@@ -826,3 +817,47 @@ key.setViewKey('U', function (ev, arg) {
key.setEditKey('C-<tab>', function (ev) {
command.walkInputElement(command.elementsRetrieverTextarea, true, true);
}, '次のテキストエリアへフォーカス');

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

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

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

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

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

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

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

key.setEditKey('C-l', function (ev) {
command.recenter(ev);
}, 'カーソル位置が画面の中央へ来るようスクロール', true);

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

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

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

+ 2
- 1
bashrc View File

@@ -122,6 +122,7 @@ alias e3=e3em
alias po=popd
alias pu=pushd
alias sudo="sudo " # use aliases through sudo
alias sudoe="sudoedit"
alias halt="sudo halt"
alias reboot="sudo reboot"
alias suspend="dbus-send --system --print-reply --dest=org.freedesktop.UPower \
@@ -222,7 +223,7 @@ man() {
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
command man "$@"
man "$@"
}

scr(){


+ 60
- 69
emacs.el View File

@@ -48,26 +48,23 @@ otherwise the path where the library installed."
(lpath (concat dir lib ".el"))
(locate-p (locate-library lib)))
(if (or force-download-p (not locate-p))
(progn (condition-case nil
(progn (message "Downloading %s..." url)
(or (download-file url
lpath
t)
(error "Download failed"))
(message "Downloading %s...done")
(when (and byte-compile-p
(require 'bytecomp nil t))
(and (file-exists-p (byte-compile-dest-file lpath))
(delete-file (byte-compile-dest-file lpath)))
(byte-compile-file lpath))
)
(error (and (file-writable-p lpath)
(delete-file lpath))
(message "Downloading %s...failed"
url)
nil))
(locate-library lib))
locate-p)))
(if (progn (message "Downloading %s..."
url)
(download-file url
lpath
t))
(progn (message "Downloading %s...done"
url)
(when (and byte-compile-p
(require 'bytecomp nil t))
(and (file-exists-p (byte-compile-dest-file lpath))
(delete-file (byte-compile-dest-file lpath)))
(byte-compile-file lpath)))
(progn (and (file-writable-p lpath)
(delete-file lpath))
(message "Downloading %s...failed"
url))))
(locate-library lib)))

(defun download-file (url path &optional ok-if-already-exists)
"Download file from URL and output to PATH."
@@ -968,33 +965,34 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; python

(setq python-python-command (or (executable-find "python3")
(executable-find "python")))
(defun my-python-run-as-command ()
""
(interactive)
(shell-command (concat python-python-command " " buffer-file-name)))
(defun my-python-display-python-buffer ()
""
(interactive)
(set-window-text-height (display-buffer python-buffer
t)
7))
(add-hook 'python-mode-hook
(lambda ()
(define-key python-mode-map
(kbd "C-c C-e") 'my-python-run-as-command)
(define-key python-mode-map
(kbd "C-c C-b") 'my-python-display-python-buffer)
(define-key python-mode-map (kbd "C-m") 'newline-and-indent)))
(when (lazy-load-eval 'python '(python-mode))
(setq python-python-command (or (executable-find "python3")
(executable-find "python")))
(defun my-python-run-as-command ()
""
(interactive)
(shell-command (concat python-python-command " " buffer-file-name)))
(defun my-python-display-python-buffer ()
""
(interactive)
(set-window-text-height (display-buffer python-buffer
t)
7))
(add-hook 'python-mode-hook
(lambda ()
(define-key python-mode-map
(kbd "C-c C-e") 'my-python-run-as-command)
(define-key python-mode-map
(kbd "C-c C-b") 'my-python-display-python-buffer)
(define-key python-mode-map (kbd "C-m") 'newline-and-indent)))

(add-hook 'inferior-python-mode-hook
(lambda ()
(my-python-display-python-buffer)
(define-key inferior-python-mode-map
(kbd "<up>") 'comint-previous-input)
(define-key inferior-python-mode-map
(kbd "<down>") 'comint-next-input)))
(add-hook 'inferior-python-mode-hook
(lambda ()
(my-python-display-python-buffer)
(define-key inferior-python-mode-map
(kbd "<up>") 'comint-previous-input)
(define-key inferior-python-mode-map
(kbd "<down>") 'comint-next-input))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GNU GLOBAL(gtags)
@@ -1003,21 +1001,21 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit."
;; http://cha.la.coocan.jp/doc/gnu_global.html

(when (lazy-load-eval 'gtags '(gtags-mode))
(setq gtags-mode-hook
'(lambda ()
(setq gtags-select-buffer-single t)
;; (local-set-key "\M-t" 'gtags-find-tag)
;; (local-set-key "\M-r" 'gtags-find-rtag)
;; (local-set-key "\M-s" 'gtags-find-symbol)
;; (local-set-key "\C-t" 'gtags-pop-stack)
(define-key gtags-mode-map (kbd "C-x t h") 'gtags-find-tag-from-here)
(define-key gtags-mode-map (kbd "C-x t t") 'gtags-find-tag)
(define-key gtags-mode-map (kbd "C-x t r") 'gtags-find-rtag)
(define-key gtags-mode-map (kbd "C-x t s") 'gtags-find-symbol)
(define-key gtags-mode-map (kbd "C-x t p") 'gtags-find-pattern)
(define-key gtags-mdoe-map (kbd "C-x t f") 'gtags-find-file)
(define-key gtags-mode-map (kbd "C-x t b") 'gtags-pop-stack) ;back
)))
(add-hook 'gtags-mode-hook
(lambda ()
(setq gtags-select-buffer-single t)
;; (local-set-key "\M-t" 'gtags-find-tag)
;; (local-set-key "\M-r" 'gtags-find-rtag)
;; (local-set-key "\M-s" 'gtags-find-symbol)
;; (local-set-key "\C-t" 'gtags-pop-stack)
(define-key gtags-mode-map (kbd "C-x t h") 'gtags-find-tag-from-here)
(define-key gtags-mode-map (kbd "C-x t t") 'gtags-find-tag)
(define-key gtags-mode-map (kbd "C-x t r") 'gtags-find-rtag)
(define-key gtags-mode-map (kbd "C-x t s") 'gtags-find-symbol)
(define-key gtags-mode-map (kbd "C-x t p") 'gtags-find-pattern)
(define-key gtags-mdoe-map (kbd "C-x t f") 'gtags-find-file)
(define-key gtags-mode-map (kbd "C-x t b") 'gtags-pop-stack) ;back
)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; term mode
@@ -1102,8 +1100,6 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit."
(when (lazy-load-eval 'bs '(bs-show)
;; (add-to-list 'bs-configurations
;; '("processes" nil get-buffer-process ".*" nil nil))
(add-to-list 'bs-configurations
'("same-dir" nil buffer-same-dir-p ".*" nil nil))
(add-to-list 'bs-configurations
'("this-frame" nil (lambda (buf)
(memq buf (my-frame-buffer-get)))
@@ -1122,12 +1118,7 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit."
(setq bs-default-configuration "files")
;; (and bs--show-all
;; (call-interactively 'bs-toggle-show-all))
(set (make-local-variable 'scroll-margin) 0)))
(defun buffer-same-dir-p (bf)
"return t if BF's dir is same as current dir, otherwise nil."
(let ((cdir (expand-file-name default-directory)))
(with-current-buffer bf
(equal (expand-file-name default-directory) cdir)))))
(set (make-local-variable 'scroll-margin) 0))))

(iswitchb-mode 1)



+ 14
- 7
tmux.conf View File

@@ -22,23 +22,30 @@ set -g status-right "${USER}@#H | #(tmux -V) "
set message-bg black
set message-fg yellow

# default-color
set -g status-bg green
set -g status-fg white
set -g mode-bg white
set -g mode-fg black

if "test `hostname` = arch-aspireone" \
"set -g status-bg blue; set -g pane-active-border-fg blue"
"set -g status-bg blue; set -g status-fg white; \
set -g mode-bg blue; set -g mode-fg white; \
set -g pane-active-border-fg blue;"
if "test `hostname` = darwin-mba.local" \
"set -g status-bg yellow; set -g pane-active-border-fg yellow; set -g status-fg black"
"set -g status-bg yellow; set -g status-fg black; \
set -g mode-bg yellow; set -g mode-fg black; \
set -g pane-active-border-fg yellow;"
if "test `hostname` = newkiwi" \
"set -g status-bg magenta; set -g pane-active-border-fg magenta"
"set -g status-bg magenta; set -g status-fg white; \
set -g mode-bg magenta; set -g mode-fg white; \
set -g pane-active-border-fg magenta;"

# window-status-current
# face of currently active window name in status bar
setw -g window-status-current-fg black
setw -g window-status-current-bg white
setw -g window-status-current-attr bold

set -g mode-bg white
set -g mode-fg black

# this does not work because it runs asyncly
# if "test -n \"tmux display -p '#{client_termname}' | grep -o 256color\"" \
# "set -g default-terminal screen-256color" "set -g default-terminal screen"

Loading…
Cancel
Save