Last active
August 29, 2015 14:27
-
-
Save m-maeda/c8c2211009bc02477697 to your computer and use it in GitHub Desktop.
init.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; eww | |
;; enter: クリック | |
;; l: 戻る | |
;; r: 進む | |
;; o: link にhint | |
;; &: ブラウザで開く | |
;; w: 現在のurlをコピー | |
;; b: ブックマークする、B: ブックマーク一覧 | |
;; w: ソースを見る | |
;; r: リロード | |
;; color 調整 | |
(defvar eww-disable-colorize t) | |
(defun shr-colorize-region--disable (orig start end fg &optional bg &rest _) | |
(unless eww-disable-colorize | |
(funcall orig start end fg))) | |
(advice-add 'shr-colorize-region :around 'shr-colorize-region--disable) | |
(advice-add 'eww-colorize-region :around 'shr-colorize-region--disable) | |
(defun eww-disable-color () | |
"eww で文字色を反映させない" | |
(interactive) | |
(setq-local eww-disable-colorize t) | |
(eww-reload)) | |
(defun eww-enable-color () | |
"eww で文字色を反映させる" | |
(interactive) | |
(setq-local eww-disable-colorize nil) | |
(eww-reload)) | |
;; googleに | |
(setq eww-search-prefix "http://www.google.co.jp/search?q=") | |
;; 検索結果にハイライト | |
(defun eww-search (term) | |
(interactive "sSearch terms: ") | |
(setq eww-hl-search-word term) | |
(eww-browse-url (concat eww-search-prefix term))) | |
(add-hook 'eww-after-render-hook (lambda () | |
(highlight-regexp eww-hl-search-word) | |
(setq eww-hl-search-word nil))) | |
;; 画像を表示しない | |
(defun eww-disable-images () | |
"eww で画像表示させない" | |
(interactive) | |
(setq-local shr-put-image-function 'shr-put-image-alt) | |
(eww-reload)) | |
(defun eww-enable-images () | |
"eww で画像表示させる" | |
(interactive) | |
(setq-local shr-put-image-function 'shr-put-image) | |
(eww-reload)) | |
(defun shr-put-image-alt (spec alt &optional flags) | |
(insert alt)) | |
;; はじめから非表示 | |
(defun eww-mode-hook--disable-image () | |
(setq-local shr-put-image-function 'shr-put-image-alt)) | |
(add-hook 'eww-mode-hook 'eww-mode-hook--disable-image) | |
;; リンク先番号表示 shortcut "o" | |
;; ace-link | |
(ace-link-setup-default) | |
(require 'org) | |
(define-key org-mode-map (kbd "C-c M-o") 'ace-link-org) | |
(defun ali--eww-collect-references () | |
"Collect the positions of visible links in the current `eww' buffer." | |
(save-excursion | |
(save-restriction | |
(narrow-to-region | |
(window-start) | |
(window-end)) | |
(goto-char (point-min)) | |
(let ((skip (next-single-property-change (point) 'help-echo)) | |
candidates) | |
(while (setq skip (text-property-not-all | |
skip (point-max) 'help-echo nil)) | |
(goto-char skip) | |
(push skip candidates) | |
(setq skip (next-single-property-change (point) 'help-echo))) | |
(nreverse candidates))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 日本語IM用の設定 | |
(setq default-input-method "MacOSX") | |
;; 日本語の設定(UTF-8) | |
(set-language-environment 'Japanese) | |
(prefer-coding-system 'utf-8) | |
;; load path | |
(setq load-path | |
(append | |
(list | |
(expand-file-name "~/.emacs.d/elisp") | |
) | |
load-path)) | |
;; package management | |
(require 'package) | |
;; Add package-archives | |
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) | |
;; Initialize | |
(package-initialize) | |
;; CommandとOptionを入れ替える | |
(setq ns-command-modifier (quote meta)) | |
(setq ns-alternate-modifier (quote super)) | |
;; for window system | |
(if window-system | |
(progn | |
(set-frame-parameter nil 'alpha 80))) | |
(tool-bar-mode -1) | |
(setq inhibit-startup-message t) | |
(keyboard-translate ?\C-h ?\C-?) | |
(global-set-key "\C-h" nil) | |
(setq mac-command-key-is-meta t) | |
(setq ns-command-modifier (quote meta)) | |
(setq ns-alternate-modifier (quote super)) | |
;;画面最大化 | |
(setq ns-use-native-fullscreen nil) | |
;; バックアップフィアルを作らないようにする | |
;; for backup files | |
(setq backup-inhibited t) | |
(setq delete-auto-save-files t) | |
(setq auto-save-default nil) | |
(setq auto-save-list-file-name nil) | |
(setq auto-save-list-file-prefix nil) | |
(setq make-backup-files nil) | |
(global-set-key "\C-x\C-b" 'buffer-menu) | |
(setq-default transient-mark-mode t) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; 編集行を目立たせる(現在行をハイライト表示する) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defface hlline-face | |
'((((class color) | |
(background dark)) | |
(:background "gray15" :underline "gray34")) | |
(((class color) | |
(background light)) | |
(:background "ForestGreen")) | |
(t | |
())) | |
"*Face used by hl-line.") | |
(setq hl-line-face 'hlline-face) | |
;; (setq hl-line-face 'underline) ; 下線 | |
(global-hl-line-mode) | |
;; title display | |
(setq frame-title-format (format "%%f - Emacs@%s" (system-name))) | |
;; framse-alist | |
(setq default-frame-alist | |
(append (list '(foreground-color . "white") | |
'(background-color . "black") | |
'(width . 100) | |
;; '(height . 40) | |
;; '(left . 100) | |
'(top . 0)) | |
default-frame-alist)) | |
;; window move by Shift + [right|left|up|down]cursor | |
(windmove-default-keybindings) | |
;; バックスラッシュが¥になる問題 | |
(define-key global-map [165] nil) | |
(define-key global-map [67109029] nil) | |
(define-key global-map [134217893] nil) | |
(define-key global-map [201326757] nil) | |
(define-key function-key-map [165] [?\\]) | |
(define-key function-key-map [67109029] [?\C-\\]) | |
(define-key function-key-map [134217893] [?\M-\\]) | |
(define-key function-key-map [201326757] [?\C-\M-\\]) | |
;; mac <-> emacs clip borad | |
(setq x-select-enable-clipboard nil) | |
(setq x-select-enable-primary t) | |
(setq select-active-regions t) | |
(setq mouse-drag-copy-region t) | |
(global-set-key [mouse-2] 'mouse-yank-at-click) | |
;; ファイルに更新があったら自動的に読み込み直す | |
(global-auto-revert-mode 1) | |
;; ミニバッファ履歴リストの最大長:tなら無限 | |
(setq history-length t) | |
;;;; session.el | |
;;;; kill-ringやミニバッファで過去に開いたファイルなどの履歴を保存する | |
;;;; M-x package-list-package | |
;;;; で session と minibuf-isearch をinstallしておいた上で以下をコメントアウト | |
;;(when (require 'session nil t) | |
;; (setq session-initialize '(de-saveplace session keys menus places) | |
;; session-globals-include '((kill-ring 50) | |
;; (session-file-alist 500 t) | |
;; (file-name-history 10000))) | |
;; (add-hook 'after-init-hook 'session-initialize) | |
;; ;; 前回閉じたときの位置にカーソルを復帰 | |
;; (setq session-undo-check -1)) | |
;;;; minibuf-isearch | |
;;;; minibufでisearchを使えるようにする | |
;;(require 'minibuf-isearch nil t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
超便利 http://rubikitch.com/2014/10/08/ace-isearch/