Skip to content

Instantly share code, notes, and snippets.

@ikouchiha47
Created February 6, 2015 14:08
Show Gist options
  • Save ikouchiha47/529c4f9af7b6333ed888 to your computer and use it in GitHub Desktop.
Save ikouchiha47/529c4f9af7b6333ed888 to your computer and use it in GitHub Desktop.
(package-initialize)
(add-to-list 'load-path "~/.emacs.d/elpa")
;;(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq inhibit-startup-message t)
(fset 'yes-or-no-p 'y-or-n-p)
;;how emacs looks
(delete-selection-mode t)
(scroll-bar-mode -1)
(blink-cursor-mode t)
(show-paren-mode t)
(column-number-mode t)
;;(global-linum-mode 1) ;show line-numbers
(set-fringe-style -1)
(tooltip-mode -1)
;;utf8
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
;;add and delete trailing lines
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(setq delete-trailing-lines t)
(setq require-final-newline t) ;add a new line at the end of file
(setq next-line-add-newlines nil) ;add a new line when at the end of buffer
(define-key global-map (kbd "RET") 'newline-and-indent)
;;cut copy paste undo
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
(global-set-key "\C-z" 'undo)
(global-set-key "\M-z" 'redo)
(cua-mode t)
(setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands
(transient-mark-mode 1) ;; No region when it is not highlighted
(setq cua-keep-region-after-copy t) ;; Standard Windows behaviour
;;windmove
;;better tan C-x o
;;(when (fboundp 'windmove-default-keybindings)
;; (windmove-default-keybindings))
(defun ignore-error-wrapper (fn)
"Funtion return new function that ignore errors.
The function wraps a function with `ignore-errors' macro."
(lexical-let ((fn fn))
(lambda ()
(interactive)
(ignore-errors
(funcall fn)))))
(global-set-key (kbd "C-x <up>") (ignore-error-wrapper 'windmove-up))
(global-set-key (kbd "C-x <down>") (ignore-error-wrapper 'windmove-down))
(global-set-key (kbd "C-x <right>") (ignore-error-wrapper 'windmove-right))
(global-set-key (kbd "C-x <left>") (ignore-error-wrapper 'windmove-left))
;;(setq shift-select-mode t)
;;copy-paste previous line
(fset 'pprev
[?\C-p ?\C-a ?\C- ?\C-n ?\M-w ?\C- ?\C-y])
(require 'auto-dictionary)
(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1)))
(require 'autopair)
(autopair-global-mode) ;; to enable in all buffers
(require 'auto-complete)
(require 'auto-complete-config)
(global-auto-complete-mode t)
(require 're-builder)
(setq reb-re-syntax 'string)
;;ruby rails setup
(add-hook 'ruby-mode-hook 'robe-mode)
(require 'ruby-end)
(add-hook 'projectile-mode-hook 'projectile-rails-on)
;;2 space indentation for css and js
(setq css-indent-offset 2)
(setq js-indent-level 2)
;;emmet snippets
(require 'emmet-mode)
(add-hook 'html-mode-hook 'emmet-mode)
(add-hook 'css-mode-hook 'emmet-mode)
(fset 'g
[?\M-x ?e ?m ?m ?e ?t ?- ?e ?x ?p ?a ?n ?d ?- ?l ?i ?n ?e return ?\C-x])
(fset 'y
[?\M-x ?e ?m ?m ?e ?t ?- ?e ?x ?p ?a ?n ?d ?- ?y ?a ?s return ?\C-x])
(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.
'(ansi-color-names-vector ["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#ad7fa8" "#8cc4ff" "#eeeeec"])
'(custom-enabled-themes (quote (boron)))
'(custom-safe-themes (quote ("c01f093ab78aad6ae2c27abc47519709c6b3aaa2c1e35c712d4dd81ff1df7e31" "49eea2857afb24808915643b1b5bd093eefb35424c758f502e98a03d0d3df4b1" default)))
'(package-archives (quote (("gnu" . "http://elpa.gnu.org/packages/") ("MELPA" . "http://melpa.milkbox.net/packages/")))))
(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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment