Created
August 13, 2014 07:14
-
-
Save bassu/b97535a18d1a2fcc948c to your computer and use it in GitHub Desktop.
Very quick and portable Emacs init file
This file contains hidden or 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
;;; package -- default emacs init by Bassu | |
;;; Commentary: | |
;;; very rough but portaable; may someday be tied into Cask | |
;;; Code: | |
;-------; | |
; REPO ; | |
;-------; | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(package-initialize) | |
;; make sure the packages are installed; if not install them | |
(mapc | |
(lambda (package) | |
(or (package-installed-p package) | |
(if (y-or-n-p (format "Package %s is missing. Install | |
it? " package)) | |
(package-install package)))) | |
' | |
;; generated by C-h v package-activated-list | |
(ac-c-headers ac-emmet bash-completion c-eldoc emmet-mode | |
exec-path-from-shell flycheck go-autocomplete go-direx direx | |
go-eldoc go-mode go-snippets highlight-indentation jedi epc | |
ctable concurrent minimap pkg-info epl popwin powerline | |
python-environment deferred smartparens smex solarized-theme | |
dash sr-speedbar tern-auto-complete auto-complete popup tern | |
web-mode yasnippet) | |
) | |
;-------; | |
; Theme ; | |
;-------; | |
;load-safe with "t" | |
(load-theme 'solarized-dark t) | |
;------------------------------------; | |
; Bug Workaround & Mac Key Remapping ; | |
;------------------------------------; | |
(if (not window-system) | |
(set-face-background 'default "nil") | |
(setq mac-command-modifier 'meta) | |
(setq mac-option-modifier 'super) | |
(set-face-attribute 'fixed-pitch nil :font "Monaco-13") | |
(set-face-attribute 'default nil :font "Monaco-13") | |
(set-face-attribute 'variable-pitch nil :font "Lucida Grande-13") | |
) | |
;---------------; | |
; Some Defaults ; | |
;---------------; | |
(setq vc-make-backup-files t) | |
(menu-bar-mode -1) | |
(tool-bar-mode -1) | |
(scroll-bar-mode -1) | |
(linum-mode +1) | |
(require 'linum) | |
(setq linum-format "%3i ") | |
(setq-default tab-width 4) | |
;(setq tab-stop-list (number-sequence 8 120 8)) | |
;(setq indent-tabs-mode nil) | |
(setq ring-bell-function 'ignore) | |
(setq frame-title-format "%b") | |
(setq x-underline-at-descent-line t) | |
;----------; | |
; PACKAGES ; | |
;----------; | |
;Powerline | |
(require 'powerline) | |
(powerline-default-theme) | |
(setq powerline-default-separator 'zigzag) | |
;Yasnippet | |
(require 'yasnippet) | |
(yas-global-mode 1) | |
;Bash-completion | |
(require 'bash-completion) | |
(bash-completion-setup) | |
;Exec-path-from-shell | |
(require 'exec-path-from-shell) | |
(exec-path-from-shell-initialize) | |
;Sr-speedbar | |
(require 'sr-speedbar) | |
(global-set-key (kbd "s-s") 'sr-speedbar-toggle) | |
(setq speedbar-use-images nil) | |
;Smex (using ido) | |
(require 'smex) | |
(global-set-key (kbd "M-x") 'smex) | |
(global-set-key (kbd "M-X") 'smex-major-mode-commands) | |
;Flycheck | |
(add-hook 'after-init-hook #'global-flycheck-mode) | |
;Minimap | |
(require 'minimap) | |
(setq minimap-update-delay 0.9) | |
(setq minimap-window-location 'right) | |
(setq minimap-recenter-type "free") | |
;Auto-complete | |
(require 'auto-complete) | |
(require 'auto-complete-config) | |
(global-auto-complete-mode t) | |
(setq tab-always-indent 'complete) | |
(add-to-list 'completion-styles 'initials t) | |
;Highlight-indentation-mode | |
(require 'highlight-indentation) | |
(add-hook 'go-mode-hook | |
(lambda () | |
(highlight-indentation-current-column-mode) | |
) | |
) | |
(set-face-background 'highlight-indentation-current-column-face "DarkSlateBlue") | |
;Smartparens | |
(declare-function sp-insert-pair "smartparens.el" nil) | |
(require 'smartparens-config) | |
(smartparens-global-mode 1) | |
(show-smartparens-global-mode t) | |
(sp-with-modes '(rhtml-mode) | |
(sp-local-pair "<" ">") | |
(sp-local-pair "<%" "%>")) | |
(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. | |
'(sp-show-pair-match-face ((t (:background "grey75" :foreground "darkslateblue" :inverse-video | |
t))) nil "Changing weird sp match face highlight color for | |
console mode")) | |
;Emmet-mode (zen-coding) | |
(require 'emmet-mode) | |
(add-hook 'web-mode-hook 'emmet-mode) | |
(add-hook 'html-mode-hook 'emmet-mode) | |
(add-hook 'css-mode-hook 'emmet-mode) | |
(define-key emmet-mode-keymap (kbd "C-j") 'emmet-expand-yas) | |
;C-mode | |
(require 'find-file) | |
(setq cc-search-directories | |
'("." "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/stdio.h")) | |
(global-set-key [f1] (lambda () (interactive) (manual-entry (current-word)))) | |
;C-eldoc mode | |
(add-hook 'c-mode-hook 'c-turn-on-eldoc-mode) | |
;AC-c-headers | |
(require 'ac-c-headers) | |
(add-hook 'c-mode-hook | |
(lambda () | |
(add-to-list 'cc-search-directories "/usr/include/") | |
(add-to-list 'ac-sources 'ac-source-c-headers) | |
(add-to-list 'ac-sources 'ac-source-c-header-symbols t))) | |
;Go auto-complete | |
(require 'go-autocomplete) | |
;Go-direx code browser | |
(require 'go-direx) | |
(global-set-key (kbd "C-x C-j") 'go-direx-pop-to-buffer) | |
;Popwin (in-buffer direx browser) | |
(require 'popwin) | |
(setq display-buffer-function 'popwin:display-buffer) | |
(push '("^\*go-direx:" :regexp t :position left :width 0.4 :dedicated t :stick t) | |
popwin:special-display-config) | |
;Go-eldoc | |
(require 'go-eldoc) | |
;(add-hook 'go-mode-hook 'go-eldoc-setup) | |
(defun go-mode-setup () | |
"Setup go-eldoc and gofmt." | |
(go-eldoc-setup) | |
(add-hook 'before-save-hook 'gofmt-before-save)) | |
(add-hook 'go-mode-hook 'go-mode-setup) | |
;Web-mode | |
(require 'web-mode) | |
(add-to-list 'auto-mode-alist '("\\.htm?\\'" . web-mode)) | |
(add-to-list 'auto-mode-alist '("\\.css\\'" . web-mode)) | |
(set-face-attribute 'web-mode-html-tag-face nil :foreground "blue") | |
(setq web-mode-enable-part-face t) | |
(setq web-mode-markup-indent-offset 2) | |
(setq web-mode-code-indent-offset 2) | |
(setq web-mode-css-indent-offset 2) | |
(setq web-mode-indent-style 2) | |
;Tern.js | |
(autoload 'tern-mode "tern.el" nil t) | |
(add-hook 'js-mode-hook (lambda () (tern-mode t))) | |
(eval-after-load 'tern | |
'(progn | |
(require 'tern-auto-complete) | |
(tern-ac-setup))) | |
;Jedi.el | |
(require 'jedi) | |
(autoload 'jedi:setup "jedi" nil t) | |
(add-hook 'python-mode-hook 'jedi:setup) | |
(setq jedi:tooltip-method nil) | |
(setq jedi:complete-on-dot t) | |
(setq jedi:key-show-doc (kbd "C-c d")) | |
(provide 'init) | |
;;; init.el ends here | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment