Created
January 24, 2015 06:46
-
-
Save hrkt/d6c28d905e74f99b915b to your computer and use it in GitHub Desktop.
sample init.el (Emacs24.3 , Tab, dark-theme)
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
;; Last modified : 2015/1/24 | |
;; | |
;; package | |
(require 'package) | |
(add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/")) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) | |
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t) ; Org-mode's repository | |
(package-initialize) | |
;; color-theme | |
;; http://www.emacswiki.org/emacs/ColorAndCustomThemes | |
;; See http://gnuemacscolorthemetest.googlecode.com/svn/html/index-c.html | |
(color-theme-initialize) | |
(color-theme-clarity) | |
;; 行番号を常に表示 | |
(global-linum-mode t) | |
;; ツールバーを消す | |
(tool-bar-mode -1) | |
;; 起動後の画面は出さない | |
(setq inhibit-startup-message t) | |
;; 対応するカッコのハイライト | |
(show-paren-mode t) | |
;; ウインドウの透明度 | |
(add-to-list 'default-frame-alist '(alpha . 85)) | |
;; カレントウインドウの透明度 | |
(set-frame-parameter nil 'alpha 0.85) | |
;; URLを強調表示 | |
;; http://d.hatena.ne.jp/Tan90909090/20120829/1346245401 | |
;; http://d.hatena.ne.jp/Tan90909090/20121020/1350705779 | |
(require 'thingatpt) | |
(setq thing-at-point-url-regexp "\\(h?ttps?://\\|ftp://\\)[-~/A-Za-z0-9_.${}#%,:@?%&|=+]+") | |
(defadvice thing-at-point-url-at-point (after support-omitted-h activate) | |
(when (and ad-return-value (string-match "\\`ttps?://" ad-return-value)) | |
(setq ad-return-value (concat "h" ad-return-value)))) | |
;; URLをハイライトで強調表示 | |
(global-hi-lock-mode 1) | |
(add-hook 'find-file-hook | |
'(lambda()(highlight-regexp thing-at-point-url-regexp "hi-blue"))) | |
;; URLをブラウザで開くキーバインド | |
(global-set-key "\C-c\C-j" 'browse-url-at-point) | |
(global-set-key [double-mouse-1] 'browse-url-at-mouse) | |
;; Monaco 12pt をデフォルトにする | |
(set-face-attribute 'default nil | |
:family "Monaco" | |
:height 120) | |
;; 日本語をヒラギノ角ゴProNにする | |
(set-fontset-font "fontset-default" | |
'japanese-jisx0208 | |
'("Hiragino Maru Gothic ProN")) | |
;; 半角カナをヒラギノ角ゴProNにする | |
(set-fontset-font "fontset-default" | |
'katakana-jisx0201 | |
'("Hiragino Maru Gothic ProN")) | |
;; tabbar | |
;; http://emacswiki.org/emacs/TabBarMode | |
;; See http://d.hatena.ne.jp/plasticster/20110825/1314271209 | |
(require 'tabbar) | |
(tabbar-mode 1) | |
;; タブ上でマウスホイール操作無効 | |
(tabbar-mwheel-mode -1) | |
;; グループ化しない | |
(setq tabbar-buffer-groups-function nil) | |
;; 左に表示されるボタンを無効化 | |
(dolist (btn '(tabbar-buffer-home-button | |
tabbar-scroll-left-button | |
tabbar-scroll-right-button)) | |
(set btn (cons (cons "" nil) | |
(cons "" nil)))) | |
;; タブの長さ | |
(setq tabbar-separator '(1.5)) | |
;; 外観変更 | |
(set-face-attribute | |
'tabbar-default nil | |
:family "Monaco" | |
:background "black" | |
:foreground "gray72" | |
:height 1.0) | |
(set-face-attribute | |
'tabbar-unselected nil | |
:background "black" | |
:foreground "grey72" | |
:box nil) | |
(set-face-attribute | |
'tabbar-selected nil | |
:background "black" | |
:foreground "yellow" | |
:box nil) | |
(set-face-attribute | |
'tabbar-button nil | |
:box nil) | |
(set-face-attribute | |
'tabbar-separator nil | |
:height 1.5) | |
;; タブに表示させるバッファの設定 | |
(defvar my-tabbar-displayed-buffers | |
'("*scratch*" "*Messages*" "*Backtrace*" "*Colors*" "*Faces*" "*vc-") | |
"*Regexps matches buffer names always included tabs.") | |
(defun my-tabbar-buffer-list () | |
"Return the list of buffers to show in tabs. | |
Exclude buffers whose name starts with a space or an asterisk. | |
The current buffer and buffers matches `my-tabbar-displayed-buffers' | |
are always included." | |
(let* ((hides (list ?\ ?\*)) | |
(re (regexp-opt my-tabbar-displayed-buffers)) | |
(cur-buf (current-buffer)) | |
(tabs (delq nil | |
(mapcar (lambda (buf) | |
(let ((name (buffer-name buf))) | |
(when (or (string-match re name) | |
(not (memq (aref name 0) hides))) | |
buf))) | |
(buffer-list))))) | |
;; Always include the current buffer. | |
(if (memq cur-buf tabs) | |
tabs | |
(cons cur-buf tabs)))) | |
(setq tabbar-buffer-list-function 'my-tabbar-buffer-list) | |
;; Chrome ライクなタブ切り替えのキーバインド | |
(global-set-key (kbd "<M-s-right>") 'tabbar-forward-tab) | |
(global-set-key (kbd "<M-s-left>") 'tabbar-backward-tab) | |
;; タブ上をマウス中クリックで kill-buffer | |
(defun my-tabbar-buffer-help-on-tab (tab) | |
"Return the help string shown when mouse is onto TAB." | |
(if tabbar--buffer-show-groups | |
(let* ((tabset (tabbar-tab-tabset tab)) | |
(tab (tabbar-selected-tab tabset))) | |
(format "mouse-1: switch to buffer %S in group [%s]" | |
(buffer-name (tabbar-tab-value tab)) tabset)) | |
(format "\ | |
mouse-1: switch to buffer %S\n\ | |
mouse-2: kill this buffer\n\ | |
mouse-3: delete other windows" | |
(buffer-name (tabbar-tab-value tab))))) | |
(defun my-tabbar-buffer-select-tab (event tab) | |
"On mouse EVENT, select TAB." | |
(let ((mouse-button (event-basic-type event)) | |
(buffer (tabbar-tab-value tab))) | |
(cond | |
((eq mouse-button 'mouse-2) | |
(with-current-buffer buffer | |
(kill-buffer))) | |
((eq mouse-button 'mouse-3) | |
(delete-other-windows)) | |
(t | |
(switch-to-buffer buffer))) | |
;; Don't show groups. | |
(tabbar-buffer-show-groups nil))) | |
(setq tabbar-help-on-tab-function 'my-tabbar-buffer-help-on-tab) | |
(setq tabbar-select-tab-function 'my-tabbar-buffer-select-tab) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment