Created
March 24, 2017 13:56
-
-
Save davidelbe/d36aa261f19191f9df2ff4ab4886c292 to your computer and use it in GitHub Desktop.
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
;; David's Emacs config - requires Emacs 24.4 or later | |
;; Hide menu | |
(menu-bar-mode -1) | |
;; Always prefer utf-8 | |
(prefer-coding-system 'utf-8) | |
(set-default-coding-systems 'utf-8) | |
(set-terminal-coding-system 'utf-8) | |
(set-keyboard-coding-system 'utf-8) | |
(set-language-environment 'utf-8) | |
;; Move between windows with ESC + arrow | |
(global-set-key (kbd "ESC <left>") 'windmove-left) | |
(global-set-key (kbd "ESC <right>") 'windmove-right) | |
(global-set-key (kbd "ESC <up>") 'windmove-up) | |
(global-set-key (kbd "ESC <down>") 'windmove-down) | |
;; Ctags and auto complete | |
;; apt-get install exuberant-ctags | |
(setq projectile-tags-command "ctags-exuberant -Re --exclude=db --exclude=test --exclude=.git --exclude=log --exclude=public -f \"%s\" %s") | |
;; Display tooltips | |
(tooltip-mode -1) | |
;; (setq tooltip-use-echo-area t) | |
;; Stop prompting every time I open a gemspec | |
(setq safe-local-variable-values | |
(append '((encoding . utf-8)) safe-local-variable-values)) | |
;; Disable prompts | |
(fset 'yes-or-no-p 'y-or-n-p) | |
(setq confirm-nonexistent-file-or-buffer nil) | |
;; Moving to last line inserts newline | |
(setq next-line-add-newlines t) | |
(setq require-final-newline 't) | |
(setq mode-require-final-newline 't) | |
;; https://github.com/hbin/top-programming-fonts | |
(set-frame-font "Menlo:pixelsize=18") | |
;; Remove trailing space on save | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
;; Emacs is not a package manager, and here we load its package manager! | |
(require 'package) | |
(dolist (source '(("marmalade" . "http://marmalade-repo.org/packages/") | |
("elpa" . "http://tromey.com/elpa/") | |
("melpa" . "https://melpa.org/packages/") | |
)) | |
(add-to-list 'package-archives source t)) | |
(package-initialize) | |
;; Required packages | |
;; everytime emacs starts, it will automatically check if those packages are | |
;; missing, it will install them automatically | |
(when (not package-archive-contents) | |
(package-refresh-contents)) | |
(defvar tmtxt/packages | |
'(web-mode magit ruby-mode company expand-region flycheck markdown-mode moe-theme yaml-mode helm helm-dash projectile helm-projectile editorconfig gist)) | |
(dolist (p tmtxt/packages) | |
(when (not (package-installed-p p)) | |
(package-install p))) | |
;; Editor config | |
(editorconfig-mode 1) | |
;; Helm | |
(require 'helm-config) | |
(helm-mode 1) | |
(helm-autoresize-mode 1) | |
(global-set-key (kbd "M-x") 'helm-M-x) | |
(setq helm-M-x-fuzzy-match t) ;; optional fuzzy matching for helm-M-x | |
(require 'helm-projectile) | |
(helm-projectile-on) | |
(global-set-key (kbd "C-x f") 'helm-projectile) | |
(global-set-key (kbd "C-x i") 'goto-line) | |
(add-hook 'after-init-hook 'company-mode) | |
;; Flycheck - syntax checking | |
;; (add-hook 'after-init-hook #'global-flycheck-mode) | |
(add-hook 'ruby-mode-hook 'flycheck-mode) | |
(add-hook 'eshell-mode-hook (lambda () (linum-mode -1))) | |
(setq linum-format " %5d ") | |
;; (set-face-attribute 'linum nil :background "#222") | |
;; (set-face-attribute 'linum nil :foreground "#666") | |
(setq-default left-fringe-width 10) | |
(setq-default right-fringe-width 0) | |
(global-linum-mode 1) | |
;; Ruby | |
(add-to-list 'auto-mode-alist | |
'("\\.\\(?:gemspec\\|irbrc\\|gemrc\\|rake\\|rb\\|ru\\|thor\\)\\'" . ruby-mode)) | |
(add-to-list 'auto-mode-alist | |
'("\\(Capfile\\|Gemfile\\(?:\\.[a-zA-Z0-9._-]+\\)?\\|[rR]akefile\\)\\'" . ruby-mode)) | |
;; Ruby - dash | |
(add-hook 'ruby-mode-hook '(lambda () | |
(setq ruby-insert-encoding-magic-comment nil) | |
(company-mode) ;; use autocompletion | |
(setq-local helm-dash-docsets '("Ruby on Rails" "Ruby")) | |
(setq helm-current-buffer (current-buffer)))) | |
;; Tabs | |
;; Most of this should be taken care of by .editorconfig, but | |
;; I have added some defaults here | |
(setq-default indent-tabs-mode nil) | |
(setq tab-width 2) ; or any other preferred value | |
(defvaralias 'c-basic-offset 'tab-width) | |
(defvaralias 'cperl-indent-level 'tab-width) | |
;; Magit shortcut | |
(global-set-key (kbd "C-x g") 'magit-status) | |
(add-hook 'magit-status-mode-hook 'delete-other-windows) | |
;; PHP | |
(add-to-list 'auto-mode-alist '("\\.php$" . web-mode)) | |
(add-to-list 'auto-mode-alist '("\\.scss\\'" . web-mode)) | |
(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. | |
'(custom-safe-themes | |
(quote | |
("f5512c02e0a6887e987a816918b7a684d558716262ac7ee2dd0437ab913eaec6" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "94ba29363bfb7e06105f68d72b268f85981f7fba2ddef89331660033101eb5e5" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" default))) | |
'(frame-background-mode (quote dark)) | |
'(safe-local-variable-values (quote ((encoding . utf-8))))) | |
(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. | |
) | |
;; Theme | |
(require 'moe-theme) | |
;; Show highlighted buffer-id as decoration. (Default: nil) | |
(setq moe-theme-highlight-buffer-id t) | |
(require 'moe-theme-switcher) | |
(show-paren-mode t) | |
(setq show-paren-style 'expression) | |
(setq moe-theme-switch-by-sunrise-and-sunset t) | |
(setq calendar-latitude +59) | |
(setq calendar-longitude +18) | |
(moe-light) | |
(moe-dark) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment