emacs init.el

emacs init.el

(load-theme 'adwaita t)

;; use 4 spaces as a tab
(setq-default tab-width 4 indent-tabs-mode nil)

;; C++ style
(setq c-default-style "bsd" c-basic-offset 4)

;; show column/line index
(column-number-mode t)
(global-linum-mode t)

;; blink cursor
(blink-cursor-mode t)

;; highlight correspoinding ()
(show-paren-mode 1)

;; local language setup
(set-locale-environment nil)
(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(prefer-coding-system 'utf-8)

;; not show startup page
(setq inhibit-startup-message t)

;; add repository for install-package
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)

;; auto-complete
(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-modes 'text-mode)         ;; text-modeでも自動的に有効にする
(add-to-list 'ac-modes 'fundamental-mode)  ;; fundamental-mode
(setq ac-use-menu-map t)       ;; 補完メニュー表示時にC-n/C-pで補完候補選択

;; backup, autosave directory
(setq backup-directory-alist
  (cons (cons ".*" (expand-file-name "~/.emacs.d/backup"))
        backup-directory-alist))
(setq auto-save-file-name-transforms
  `((".*", (expand-file-name "~/.emacs.d/backup/") t)))

;; enable cua-mode
(cua-mode t)
(setq cua-enable-cua-keys nil)


;; multi-term
(when (require 'multi-term nil t)
  (setq multi-term-program "/bin/bash"))

;;; My Original Key Binding

(define-key global-map (kbd "C-h") 'delete-backward-char)

;; select current line
(define-key global-map (kbd "C-,") (kbd "C-a C-SPC C-e"))

;; kill current line
(define-key global-map (kbd "C-S-k") (kbd "C-a C-k"))

;; insert newline and jump there
(define-key global-map (kbd "C-S-n") (kbd "C-a C-n RET C-p"))

;; select another window
(define-key global-map (kbd "C-t") 'other-window)

;; open multi-term
(define-key global-map (kbd "C-c c") (kbd "M-x multi-term RET"))

;; yes.no to y.n
(fset 'yes-or-no-p 'y-or-n-p) 


;; Initialize Frames
(set-frame-parameter nil 'fullscreen 'maximized)
(split-window-right)
(setq main-window (selected-window))

(other-window 1)
(split-window-below)
(setq shell-window (selected-window))
(execute-kbd-macro (kbd "C-c c"))

(other-window 1)
(setq dired-window (selected-window))
(execute-kbd-macro (kbd "C-x d RET"))

(when (fboundp 'windmove-default-keybindings)
  (windmove-default-keybindings))
(windmove-default-keybindings 'meta)

(select-window main-window)

;; helm
(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.
 '(package-selected-packages (quote (helm multi-term auto-complete))))
(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.
 )

(require 'helm-config)
(helm-mode 1)

;; C-hで前の文字削除
(define-key helm-map (kbd "C-h") 'delete-backward-char)
(define-key helm-read-file-map (kbd "C-h") 'delete-backward-char)
(define-key helm-find-files-map (kbd "C-h") 'delete-backward-char)

;; キーバインド
;;(define-key global-map (kbd "C-x b")   'helm-buffers-list)
(define-key global-map (kbd "C-x b") 'helm-for-files)
(define-key global-map (kbd "C-x C-f") 'helm-find-files)
(define-key global-map (kbd "M-x")     'helm-M-x)
(define-key global-map (kbd "M-y")     'helm-show-kill-ring)
(define-key helm-read-file-map (kbd "<tab>") 'helm-execute-persistent-action)
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
(define-key helm-find-files-map (kbd "<tab>") 'helm-execute-persistent-action)

Remove all ads