(ffap-bindings) ;find file at point
(global-set-key "\M-/" 'hippie-expand) ;補完を強力に
(require 'dired-x) ;dired を拡張
(autoload 'wdired-change-to-wdired-mode "wdired") ;dired で簡単リネーム
(define-key dired-mode-map "r" 'wdired-change-to-wdired-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 検索強化
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; F3 でカーソル下の単語を検索(vim のまね、F4 で逆向き検索)
(defvar my-search-key-forward [f3])
(defvar my-search-key-backward [f4])
(defvar my-isearch-repeated nil)
(defun my-isearch-symbol (&optional repeat backward)
(interactive "p")
(and (eq repeat 1)
(let ((wd (thing-at-point 'symbol)))
(when wd
(let ((rq_wd (regexp-quote wd)))
(isearch-update-ring
(concat (if (string= (substring rq_wd 0 1) "_")
"\\W" "\\<")
rq_wd
(if (string= (substring rq_wd -1) "_")
"\\W" "\\>"))
t)))))
(cond (backward
(setq my-isearch-repeated 'backward)
(isearch-backward t))
(t
(setq my-isearch-repeated 'forward)
(isearch-forward t)))
(setq my-isearch-repeated nil))
(defun my-force-repeat ()
(cond ((eq my-isearch-repeated 'forward)
(isearch-repeat-forward))
((eq my-isearch-repeated 'backward)
(isearch-repeat-backward))))
(add-hook 'isearch-mode-hook 'my-force-repeat)
(global-set-key my-search-key-forward 'my-isearch-symbol)
(global-set-key my-search-key-backward (lambda (&optional repeat)
(interactive "p") (my-isearch-symbol repeat t)))
(define-key isearch-mode-map my-search-key-forward
(lambda ()
(interactive)
(and (not isearch-forward) (isearch-repeat-forward))
(isearch-repeat-forward)))
(define-key isearch-mode-map my-search-key-backward
(lambda ()
(interactive)
(and isearch-forward (isearch-repeat-backward))
(isearch-repeat-backward)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; フォント設定
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-set-assoc-data (list key value)
;; リストに既に同じキーがあれば上書き、無ければ新規追加
(let ((item (assoc key (symbol-value list))))
(if item
(setcdr item value)
(add-to-list list (cons key value)))))
(defun my-set-font (ascii-font jis-font size mul)
;; フォント設定
;; ascii フォント、和文フォント、サイズ、倍率の順に指定する。
(create-fontset-from-ascii-font
(concat "-*-" ascii-font "-normal-r-normal-normal-"
(int-to-string size) "-*-*-*-*-*-iso8859-1")
nil
(concat ascii-font (int-to-string size)))
(let* ((encoded (encode-coding-string jis-font 'emacs-mule))
(family (concat encoded "*"))
(fontset (concat "fontset-" ascii-font (int-to-string size))))
(set-fontset-font fontset 'japanese-jisx0208
(cons family "jisx0208-sjis"))
(set-fontset-font fontset 'katakana-jisx0201
(cons family "jisx0201-katakana"))
(my-set-assoc-data 'face-font-rescale-alist (concat ".*" encoded ".*") mul)
(my-set-assoc-data 'default-frame-alist 'font fontset)
(set-frame-font fontset)))
;; 倍率は全角と半角の比率を調整する。サイズによって最適値は異なる。
(my-set-font "Consolas" "メイリオ" 15 1.1)
;(my-set-font "Consolas" "メイリオ" 14 1.2)
;(my-set-font "Courier New" "MS ゴシック" 14 1.2)
;(my-set-font "MS ゴシック" "MS ゴシック" 14 1.0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(c-default-style (quote ((c-mode . "linux") (java-mode . "java") (awk-mode . "awk") (other . "gnu"))))
'(column-number-mode t)
'(cua-mode t nil (cua-base))
'(cua-paste-pop-rotate-temporarily t)
'(current-language-environment "Japanese")
'(dired-recursive-copies (quote always))
'(dired-recursive-deletes (quote always))
'(grep-find-template "find . <X> -type f <F> -print0 | xargs -0 -s32000 grep -nH -e <R> ")
'(iswitchb-mode t)
'(mouse-wheel-scroll-amount (quote (1 ((shift) . 1) ((control)))))
'(partial-completion-mode t)
'(read-file-name-completion-ignore-case t)
'(recentf-mode t)
'(save-place t nil (saveplace))
'(show-paren-mode t)
'(tool-bar-mode nil)
'(view-read-only t)
'(viper-auto-indent t)
'(viper-buffer-search-char 103)
'(viper-case-fold-search t)
'(viper-ex-style-editing nil)
'(viper-keep-point-on-undo t)
'(viper-syntax-preference (quote extended))
'(viper-vi-style-in-minibuffer nil)
'(visible-bell t)
'(wdired-allow-to-change-permissions t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(put 'dired-find-alternate-file 'disabled nil)
(put 'narrow-to-region 'disabled nil)