Conflicts: .bashrcpull/1/head
@@ -40,15 +40,21 @@ replace-cmd(){ | |||
test -r /etc/bashrc && . /etc/bashrc | |||
export PS1="\$(prompt_function)\$ " | |||
export PS1="\$(__my_prompt_function)\$ " | |||
# PROMPT_COMMAND=prompt_function | |||
if iswindows | |||
then | |||
export PAGER="tr -d '\r' | less" | |||
export PAGER="tr -d \\r | less" | |||
else | |||
export PAGER="less" | |||
fi | |||
export EDITOR="vi" | |||
if type vim >/dev/null 2>&1 | |||
then | |||
export EDITOR=vim | |||
else | |||
export EDITOR=vi | |||
fi | |||
export VISUAL="$EDITOR" | |||
export LESS="-iRMX" | |||
# export LC_MESSAGES="C" | |||
@@ -57,14 +63,14 @@ export LESS="-iRMX" | |||
export GIT_PAGER="$PAGER" | |||
export GIT_EDITOR="$EDITOR" | |||
alias ls="ls -CFG $(test "$TERM" == dumb || echo --color=auto) --time-style=long-iso" | |||
alias ls="ls -hCFG $(test "$TERM" == dumb || echo --color=auto) --time-style=long-iso" | |||
alias ll="ls -l" | |||
alias la="ls -A" | |||
alias lla="ls -Al" | |||
# alias less="" | |||
alias vl=/usr/share/vim/vimcurrent/macros/less.sh | |||
alias em="emacs -nw" | |||
alias apt-get="sudo apt-get" | |||
# alias apt-get="sudo apt-get" | |||
alias aptin="apt-get install" | |||
alias aptsearch="apt-cache search" | |||
alias aptshow="apt-cache show" | |||
@@ -76,7 +82,15 @@ alias destroy="rm -rf" | |||
alias psall="ps auxww" | |||
alias g=git | |||
alias q=exit | |||
alias p="$PAGER" | |||
alias c=cat | |||
alias pcalc="python -i -c 'from math import *' " | |||
alias _myreloadrc="test -f ~/.bashrc && source ~/.bashrc" | |||
alias sudo="sudo " # use aliases through sudo | |||
if isdarwin | |||
then alias upgrade="port selfupdate && port sync && port upgrade installed" | |||
else alias upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" | |||
fi | |||
# alias diff="$(type colordiff >/dev/null 2>&1 && test $TERM != dumb && echo color)diff -u" | |||
# type trash >/dev/null 2>&1 && alias rm=trash | |||
@@ -179,12 +193,6 @@ setclip(){ | |||
fi | |||
fi | |||
} | |||
p(){ | |||
"$@" | $PAGER | |||
} | |||
c(){ | |||
"$@" | cat | |||
} | |||
o(){ | |||
if [ $# -eq 0 ] | |||
then | |||
@@ -227,9 +235,6 @@ dl-my-init-files(){ | |||
fi | |||
done | |||
} | |||
port-autosync(){ | |||
port selfupdate && port sync && port upgrade installed | |||
} | |||
_mygitconfig(){ | |||
git config --global user.name '10sr' | |||
git config --global user.email '8slashes+git@gmail.com' | |||
@@ -270,7 +275,7 @@ replace-cmd date | |||
replace-cmd __my_svn_ps1 | |||
prompt_function(){ # used by PS1 | |||
__my_prompt_function(){ # used by PS1 | |||
local lastreturn=$? | |||
if test "${TERM}" == dumb | |||
then | |||
@@ -306,6 +311,7 @@ prompt_function(){ # used by PS1 | |||
fi | |||
local svn=$(type svn >/dev/null 2>&1 && safe-cmd __my_svn_ps1 [SVN:%s]) | |||
printf "${_MEMO}" | |||
printf "$(test -f ~/.prompt.sh && bash ~/.prompt.sh)\n" | |||
printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}\n" | |||
printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n" | |||
printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " | |||
@@ -401,13 +407,20 @@ fi | |||
####################### | |||
echo "Japanese letters are 表示可能" | |||
_testjp(){ | |||
echo "Japanese letters are 表示可能" | |||
} | |||
_testjp | |||
uname -a | |||
test -f /etc/issue.net && cat /etc/issue.net | |||
safe-cmd diskinfo | |||
test -n "${DESKTOP_SESSION}" && type xrandr >/dev/null 2>&1 && { | |||
! isdarwin && test -n "${DESKTOP_SESSION}" && type xrandr >/dev/null 2>&1 && { | |||
xrandr | grep --color=never ^Screen | |||
} | |||
iswindows || safe-cmd finger $USER | |||
! iswindows && safe-cmd finger $USER | |||
LANG=C safe-cmd id | |||
@@ -62,7 +62,16 @@ | |||
(when (file-readable-p "~/.emacs") | |||
(load-file "~/.emacs")))) | |||
(cd ".") ; when using windows use / instead of \ in default-directory | |||
(add-hook 'after-init-hook | |||
(lambda () | |||
;; (message "init time: %d msec" | |||
;; (+ (* (- (nth 1 after-init-time) (nth 1 before-init-time)) 1000) | |||
;; (/ (- (nth 2 after-init-time) (nth 2 before-init-time)) 1000))) | |||
(message (emacs-init-time)) | |||
(switch-to-buffer "*Messages*") | |||
)) | |||
(cd ".") ; when using windows use / instead of \ in `default-directory' | |||
;; locale | |||
(set-language-environment "Japanese") | |||
@@ -424,8 +433,8 @@ emacs-major-version | |||
(setq auto-save-list-file-prefix (expand-file-name "~/.emacs.d/autosave/")) | |||
(setq delete-auto-save-files t) | |||
(setq delete-by-moving-to-trash t | |||
trash-directory "~/.emacs.d/trash") | |||
;; (setq delete-by-moving-to-trash t | |||
;; trash-directory "~/.emacs.d/trash") | |||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |||
;; gmail | |||
@@ -579,8 +588,9 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." | |||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |||
;; share clipboard with x | |||
(when (or window-system | |||
(when (and window-system | |||
;; (getenv "DESKTOP_SESSION") | |||
(not (eq window-system 'mac)) | |||
) | |||
(setq x-select-enable-clipboard t ; these settings seems to be useless when using emacs in terminal | |||
x-select-enable-primary nil) | |||
@@ -610,13 +620,10 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." | |||
(add-hook 'diff-mode-hook | |||
(lambda () | |||
(view-mode 1) | |||
;; (set-face-foreground 'diff-file-header-face "black") | |||
(set-face-foreground 'diff-index-face "blue") | |||
(set-face-foreground 'diff-hunk-header-face "magenda") | |||
(set-face-foreground 'diff-removed-face "red") | |||
;; (set-face-background 'diff-removed-face "gray26") | |||
(set-face-foreground 'diff-added-face "blue") | |||
;; (set-face-background 'diff-added-face "gray26") | |||
(set-face-foreground 'diff-changed-face "syan") | |||
)) | |||
@@ -717,7 +724,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." | |||
(add-hook (kill-local-variable 'before-save-hook) | |||
'js2-before-save))) | |||
(and (require 'zone nil t) | |||
(and nil | |||
(require 'zone nil t) | |||
(not (eq system-type 'windows-nt)) | |||
;; (zone-when-idle 180) | |||
(run-with-idle-timer 180 t (lambda () | |||
@@ -769,31 +777,37 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." | |||
;; (lambda (frame) | |||
;; (recentf-open-files))) | |||
;; (defvar aaa nil) | |||
;; (plist-get aaa 'abc) | |||
;; (setq aaa (plist-put aaa 'abc 'efg)) | |||
(defvar my-frame-buffer-plist nil) | |||
(setplist my-frame-buffer-plist nil) | |||
;; (setplist my-frame-buffer-plist nil) | |||
(defun my-frame-buffer-add () | |||
"" | |||
(put 'my-frame-buffer-plist | |||
(selected-frame) | |||
(let ((lst (my-frame-buffer-get))) | |||
(if lst | |||
(add-to-list 'lst | |||
(current-buffer)) | |||
(list (current-buffer)))))) | |||
(setq my-frame-buffer-plist | |||
(plist-put my-frame-buffer-plist | |||
(selected-frame) | |||
(let ((lst (my-frame-buffer-get))) | |||
(if lst | |||
(add-to-list 'lst | |||
(current-buffer)) | |||
(list (current-buffer))))))) | |||
(defun my-frame-buffer-remove () | |||
"" | |||
(put 'my-frame-buffer-plist | |||
(selected-frame) | |||
(delq (current-buffer) | |||
(my-frame-buffer-get)))) | |||
(setq my-frame-buffer-plist | |||
(plist-put my-frame-buffer-plist | |||
(selected-frame) | |||
(delq (current-buffer) | |||
(my-frame-buffer-get))))) | |||
(defun my-frame-buffer-get (&optional frame) | |||
"" | |||
(get 'my-frame-buffer-plist | |||
(or frame | |||
(selected-frame)))) | |||
(plist-get my-frame-buffer-plist | |||
(or frame | |||
(selected-frame)))) | |||
(defun my-frame-buffer-get2 (&optional frame) | |||
"" | |||
@@ -1316,7 +1330,10 @@ otherwise, use `pack-default-extension' for pack." | |||
(not (get-buffer-window bf))) | |||
(kill-buffer bf)))) | |||
(setq dired-listing-switches "-lhFG --time-style=long-iso") | |||
(if (eq window-system 'mac) | |||
(setq dired-listing-switches "-lhFG") | |||
(setq dired-listing-switches "-lhFG --time-style=long-iso") | |||
) | |||
(define-minor-mode my-dired-display-all-mode | |||
"" | |||
:init-value nil | |||
@@ -1345,9 +1362,9 @@ otherwise, use `pack-default-extension' for pack." | |||
;; (add-hook 'dired-after-readin-hook | |||
;; 'my-replace-nasi-none) | |||
(add-hook 'after-init-hook | |||
(lambda () | |||
(dired "."))) | |||
;; (add-hook 'after-init-hook | |||
;; (lambda () | |||
;; (dired "."))) | |||
(add-hook 'dired-mode-hook | |||
(lambda () | |||
@@ -1364,6 +1381,7 @@ otherwise, use `pack-default-extension' for pack." | |||
(define-key dired-mode-map "P" 'my-dired-do-pack-or-unpack) | |||
(define-key dired-mode-map "a" 'my-dired-display-all-mode) | |||
(define-key dired-mode-map "h" 'my-dired-display-all-mode) | |||
(define-key dired-mode-map "/" 'isearch-forward) | |||
(substitute-key-definition 'dired-advertised-find-file 'my-dired-find-file dired-mode-map) | |||
(substitute-key-definition 'dired-up-directory 'my-dired-up-directory dired-mode-map) | |||
(define-key dired-mode-map (kbd "DEL") 'my-dired-up-directory) | |||
@@ -1718,17 +1736,18 @@ when SEC is nil, stop auto save if enabled." | |||
(ansi-term "/bin/bash")))) | |||
(defvar my-frame-term-plist nil) | |||
(setplist my-frame-term-plist nil) | |||
;; (setplist my-frame-term-plist nil) | |||
(defun my-execute-or-find-term () | |||
"" | |||
(interactive) | |||
(let* ((buf (get 'my-frame-term-plist (selected-frame)))) | |||
(let* ((buf (plist-get my-frame-term-plist (selected-frame)))) | |||
(if (and buf | |||
(buffer-name buf)) | |||
(switch-to-buffer buf) | |||
(put 'my-frame-term-plist | |||
(selected-frame) | |||
(my-term))))) | |||
(setq my-frame-term-plist | |||
(plist-put my-frame-term-plist | |||
(selected-frame) | |||
(my-term)))))) | |||
(defun my-format-time-string (&optional time) | |||
"" | |||
@@ -182,18 +182,48 @@ plugins.options["twitter_client.use_jmp"] = true; | |||
//////////////////////////////////////////// | |||
// エクステ | |||
ext.add('put-aside-this-page', function (ev, arg) { | |||
var n = gBrowser.mCurrentTab._tPos; | |||
gBrowser.moveTabTo(gBrowser.mCurrentTab, 0); | |||
if (n != 0) { | |||
gBrowser.selectedTab = gBrowser.mTabs[n]; | |||
} | |||
}, 'put aside this page'); | |||
ext.add('send-escape', function (ev, arg) { | |||
ev.target.dispatchEvent(key.stringToKeyEvent("ESC", true)); | |||
}, 'escape'); | |||
ext.add("open-hatebu-comment", function (ev, arg) { | |||
if (window.loadURI) { | |||
loadURI("javascript:location.href='http://b.hatena.ne.jp/entry?mode=more&url='+escape(location.href);"); | |||
} | |||
}, 'hatebu'); | |||
ext.add("fullscreen-page",function (ev) { | |||
getBrowser().selectedTab = getBrowser().addTab("http://home.tiscali.nl/annejan/swf/timeline.swf"); | |||
BrowserFullScreen(); | |||
}, "fullscreen page"); | |||
ext.add("focus-on-content", function(){ | |||
let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); | |||
gBrowser.focus(); | |||
content.focus(); | |||
}, "forcus on content"); | |||
ext.add("hide-sidebar", function(){ | |||
var sidebarBox = document.getElementById("sidebar-box"); | |||
if (!sidebarBox.hidden) { | |||
toggleSidebar(sidebarBox.getAttribute("sidebarcommand")); | |||
} | |||
}, "hide-sidebar"); | |||
ext.add("close-and-next-tab", function (ev, arg) { | |||
var n = gBrowser.mCurrentTab._tPos; | |||
BrowserCloseTabOrWindow(); | |||
gBrowser.selectedTab = gBrowser.mTabs[n]; | |||
}, "close and focus to next tab"); | |||
///////////////////////////////////// | |||
// google itranslate | |||
(function(){ | |||
@@ -270,13 +300,6 @@ ext.add("restart-firefox-add-menu", function(){ | |||
menu.appendChild(menuelm); | |||
}, "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 | |||
@@ -492,27 +515,6 @@ ext.add("echo-closed-tabs", function () { | |||
}, "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% | |||
// ========================================================================= // | |||
@@ -536,6 +538,12 @@ hook.setHook('KeySnailInitialized', function () { | |||
}); | |||
hook.setHook('KeyBoardQuit', function (aEvent) { | |||
ext.exec("hide-sidebar"); | |||
let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); | |||
gBrowser.focus(); | |||
content.focus(); | |||
command.closeFindBar(); | |||
if (util.isCaretEnabled()) { | |||
command.resetMark(aEvent); | |||
@@ -545,10 +553,6 @@ hook.setHook('KeyBoardQuit', function (aEvent) { | |||
key.generateKey(aEvent.originalTarget, KeyEvent.DOM_VK_ESCAPE, true); | |||
}); | |||
hook.addToHook('KeyBoardQuit', function (aEvent) { | |||
ext.exec("hide-sidebar"); | |||
let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); | |||
gBrowser.focus(); | |||
content.focus(); | |||
}); | |||
hook.setHook('Unload', function () { | |||
@@ -596,7 +600,7 @@ key.setGlobalKey('M-:', function (ev) { | |||
command.interpreter(); | |||
}, 'JavaScript のコードを評価'); | |||
key.setViewKey('0', function (ev, arg) { | |||
key.setViewKey('', function (ev, arg) { | |||
var n = gBrowser.mCurrentTab._tPos; | |||
BrowserCloseTabOrWindow(); | |||
gBrowser.selectedTab = gBrowser.mTabs[n]; | |||
@@ -674,14 +678,6 @@ 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); | |||
@@ -752,10 +748,6 @@ 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'); | |||
@@ -769,10 +761,14 @@ key.setViewKey('H', function (ev, arg) { | |||
ext.exec("open-hatebu-comment", arg, ev); | |||
}, 'hatebu', true); | |||
key.setViewKey('l', function (ev) { | |||
command.focusToById("urlbar"); | |||
}, 'ロケーションバーへフォーカス', true); | |||
key.setEditKey('C-<tab>', function (ev) { | |||
command.walkInputElement(command.elementsRetrieverTextarea, true, true); | |||
}, '次のテキストエリアへフォーカス'); | |||
key.setViewKey('l', function (ev) { | |||
command.focusToById("urlbar"); | |||
}, 'ロケーションバーへフォーカス', true); | |||
key.setViewKey('0', function (ev) { | |||
BrowserCloseTabOrWindow(); | |||
}, 'タブ / ウィンドウを閉じる'); |
@@ -1,4 +1,4 @@ | |||
#!/bin/bash | |||
#!/bin/sh | |||
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 | |||
@@ -10,6 +10,10 @@ if [ -n "${DESKTOP_SESSION}" ]; then | |||
synclient MaxTapTime=0 | |||
synclient MaxSpeed=0.4 | |||
synclient MinSpeed=0.2 | |||
test -f "$HOME/.fehbg" && | |||
type feh >/dev/null 2>&1 && | |||
sh "$HOME/.fehbg" | |||
fi | |||
export LC_TIME=C | |||