Skip to content

Instantly share code, notes, and snippets.

@tesths
Created May 19, 2017 12:07
Show Gist options
  • Save tesths/390caaa01010b269a5925f5194183356 to your computer and use it in GitHub Desktop.
Save tesths/390caaa01010b269a5925f5194183356 to your computer and use it in GitHub Desktop.
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(require 'package)
; (add-to-list 'package-archives '("melpa" . "http://elpa.emacs-china.org/melpa/"))
(add-to-list 'package-archives '("melpa-stable" . "http://elpa.emacs-china.org/melpa-stable/"))
(package-initialize)
; (add-to-list 'custom-theme-load-path "~/.emacs.d/lisp/emacs-color-theme-solarized")
; (load-theme 'solarized t)
; (set-terminal-parameter nil 'background-mode 'dark)
; (set-frame-parameter nil 'background-mode 'dark)
; (enable-theme 'solarized)
(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
(ace-window projectile-rails flycheck web-mode textmate smartparens nlinum quickrun robe enh-ruby-mode auto-complete projectile ## haskell-mode context-coloring company))))
(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.
)
; Other setting
;; Auto saving
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
create-lockfiles nil)
;; File encoding system
(prefer-coding-system 'utf-8)
(setq-default buffer-file-coding-system 'utf-8-auto-unix)
;; change windows
(global-set-key (kbd "S-<up>") 'windmove-up)
(global-set-key (kbd "S-<down>") 'windmove-down)
(global-set-key (kbd "C-x <left>") 'windmove-left)
(global-set-key (kbd "C-x <right>") 'windmove-right)
(defun toggle-comment-on-line ()
"comment or uncomment current line"
(interactive)
(comment-or-uncomment-region (line-beginning-position) (line-end-position)))
; theme
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'dracula t)
; show line number
(global-linum-mode t)
(add-to-list 'load-path "~/.emacs.d/vendor/")
(require 'hlinum)
(hlinum-activate)
; neotree
(add-to-list 'load-path "~/.emacs.d/vendor/neotree")
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)
; smartparens
(require 'smartparens-config)
(require 'smartparens-ruby)
(smartparens-global-mode)
(show-smartparens-global-mode t)
; autocomplete
(ac-config-default)
(add-to-list 'ac-modes 'enh-ruby-mode)
(add-to-list 'ac-modes 'web-mode)
; enhanced-ruby-mode
(autoload 'enh-ruby-mode "enh-ruby-mode" "Major mode for ruby files" t)
; (add-to-list 'auto-mode-alist '("\\.rb$" . enh-ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . enh-ruby-mode))
(remove-hook 'enh-ruby-mode-hook 'erm-define-faces)
(add-hook 'enh-ruby-mode-hook 'robe-mode)
(add-hook 'robe-mode-hook 'ac-robe-setup)
; inf-ruby
(autoload 'inf-ruby-minor-mode "inf-ruby" "Run an inferior Ruby process" t)
(add-hook 'enh-ruby-mode-hook 'inf-ruby-minor-mode)
; quickrun
(require 'quickrun)
;; You should assign key binding, if you often use `quickrun' commands.
(global-set-key (kbd "<f5>") 'quickrun)
(global-set-key (kbd "M-<f5>") 'quickrun-compile-only)
; TextMate
(require 'textmate)
(textmate-mode)
; web-mode
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.erb\\'" . erb-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\.erb\\'" . web-mode))
(setq web-mode-extra-snippets
'(("erb" . (("toto" . "<% toto | %>\n\n<% end %>")))
))
(setq web-mode-extra-auto-pairs
'(("erb" . (("beg" "end")))
("php" . (("beg" "end")
("beg" "end")))
))
(setq web-mode-enable-auto-pairing t)
(setq web-mode-enable-auto-closing t)
(setq web-mode-enable-css-colorization t)
(setq web-mode-enable-comment-keywords t)
(setq web-mode-enable-current-element-highlight t)
(setq web-mode-ac-sources-alist
'(("css" . (ac-source-css-property))
("html" . (ac-source-words-in-buffer ac-source-abbrev))))
; projectile-rails
(projectile-rails-global-mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment