Last active
November 9, 2016 03:35
-
-
Save mcddx330/c9c30d9d8efcf6f2b705 to your computer and use it in GitHub Desktop.
個人的なemacsの設定
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
; 言語を日本語にする | |
(set-language-environment "Japanese") | |
; 極力UTF-8とする | |
(set-default-coding-systems 'utf-8) | |
(set-terminal-coding-system 'utf-8) | |
(set-buffer-file-coding-system 'utf-8) | |
(prefer-coding-system 'utf-8-unix) | |
(set-keyboard-coding-system 'utf-8) | |
(setq default-buffer-file-coding-system 'utf-8) | |
; 自動インデント | |
;; インデント設定 | |
(setq c-auto-newline nil) | |
(setq c-brace-offset 0) | |
(setq-default indent-tabs-mode nil) | |
(setq-default c-basic-offset 4) | |
(setq-default tab-width 4) | |
(c-set-offset 'case-label '+) | |
; 空白を一度に削除 | |
(setq c-hungry-delete-key t) | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
; バックアップデータを作らない | |
(setq make-backup-files nil) | |
(setq auto-save-default nil) | |
; http://masutaka.net/chalow/2011-05-19-1.html | |
; use: M-x chdivision | |
(defun chdivision () | |
"ウィンドウ 2 分割時に、縦分割<->横分割" | |
(interactive) | |
(unless (= (count-windows 1) 2) | |
(error "ウィンドウが 2 分割されていません。")) | |
(let ((before-height) | |
(other-buf (window-buffer (next-window)))) | |
(setq before-height (window-height)) | |
(delete-other-windows) | |
(if (= (window-height) before-height) | |
(split-window-vertically) | |
(split-window-horizontally)) | |
(other-window 1) | |
(switch-to-buffer other-buf) | |
(other-window -1))) | |
; パッケージ | |
;(require 'package) | |
;(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) | |
;(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) | |
;(package-initialize) | |
; PHPファイル時のインデント | |
(add-hook 'php-mode-hook (lambda () | |
(defun ywb-php-lineup-arglist-intro (langelem) | |
(save-excursion | |
(goto-char (cdr langelem)) | |
(vector (+ (current-column) c-basic-offset)))) | |
(defun ywb-php-lineup-arglist-close (langelem) | |
(save-excursion | |
(goto-char (cdr langelem)) | |
(vector (current-column)))) | |
(c-set-offset 'arglist-intro 'ywb-php-lineup-arglist-intro) | |
(c-set-offset 'arglist-close 'ywb-php-lineup-arglist-close))) | |
; C-c C-rでウィンドウリサイズ関数呼び出し (上W 下S 左A 右D) | |
(defun window-resizer () | |
"Control window size and position. (W/S/A/D)" | |
(interactive) | |
(let ((window-obj (selected-window)) | |
(current-width (window-width)) | |
(current-height (window-height)) | |
(dx (if (= (nth 0 (window-edges)) 0) 1 | |
-1)) | |
(dy (if (= (nth 1 (window-edges)) 0) 1 | |
-1)) | |
action c) | |
(catch 'end-flag | |
(while t | |
(setq action | |
(read-key-sequence-vector (format "size[%dx%d]" | |
(window-width) | |
(window-height)))) | |
(setq c (aref action 0)) | |
(cond ((= c ?d) | |
(enlarge-window-horizontally dx)) | |
((= c ?a) | |
(shrink-window-horizontally dx)) | |
((= c ?s) | |
(enlarge-window dy)) | |
((= c ?w) | |
(shrink-window dy)) | |
;; otherwise | |
(t | |
(let ((last-command-char (aref action 0)) | |
(command (key-binding action))) | |
(when command | |
(call-interactively command))) | |
(message "Quit") | |
(throw 'end-flag t))))))) | |
(global-set-key "\C-c\C-r" 'window-resizer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment