Add all the require files

This commit is contained in:
Maciej Szlosarczyk 2017-02-08 09:03:50 +02:00
parent d173f5e3f3
commit d4eef54f00
No known key found for this signature in database
GPG key ID: 0D4EEACF63D4262E
7 changed files with 509 additions and 0 deletions

186
behaviour.el Normal file
View file

@ -0,0 +1,186 @@
;;; behaviour.el --- how emacs should behave
;;; Commentary:
;;; Code:
;;; Safely save garbage files into emacs.d
;;;;;;;;;;;;;;;;;;;;;;;; Overall behaviour ;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq backup-directory-alist
`(("" . "~/.emacs.d/backups")))
(setq auto-save-file-name-transforms
`((".*" ,"~/.emacs.d/backups/auto-save" t)))
(setq backup-by-copying t)
(setq delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
; Use Shells variables
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
;;; remove menu bar and icons
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
; Enable diff highlights (useful for git)
(global-diff-hl-mode)
(diff-hl-flydiff-mode)
(diff-hl-margin-mode)
(setq diff-hl-side 'right)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
; Add pgp binary
(add-to-list 'exec-path "/usr/local/bin")
; Enable line numbers and show cursors position
(global-linum-mode t)
(column-number-mode 1)
(global-hl-line-mode)
;; Use smartline
(require 'smart-mode-line)
(setq sml/no-confirm-load-theme t)
(setq sml/theme 'dark)
;; NOTE: airline is extremely slow, do not use it
;; (require 'airline-themes)
;; (airline-themes-set-modeline)
;; TODO: Figure out how to load a theme randomly.
;; (load-theme 'ujelly t t)
;; (load-theme 'avk-daylight t t)
(load-theme 'noctilux t t)
;; (load-theme 'flatui t t)
(load-theme 'atom-one-dark)
;; (load-theme 'airline-doom-one)
;; (load-theme 'airline-base16-shell-dark)
(if (display-graphic-p)
(progn
(enable-theme 'atom-one-dark)
;; (enable-theme 'airline-doom-one)
)
(progn
(enable-theme 'noctilux)
;; (enable-theme 'airline-base16-shell-dark)
)
)
;; (setq airline-helm-colors t)
;; (setq airline-cursor-colors t)
;; (setq airline-eshell-colors t)
;; Neotree theme
(setq neo-theme 'arrow)
;; Add mode line icons items
;; (mode-icons-mode)
;; Match parenthasis (left-right)
(electric-pair-mode 1)
; Rainbow parenthesis
(require 'rainbow-delimiters)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
;;; In app mode, use hasklig font
(set-face-attribute 'default nil :font "Hasklig 13")
(set-face-attribute 'mode-line nil :font "Hasklig 12")
(set-face-attribute 'linum nil :font "Hasklig 13")
;;; When pasting/writing over a selection, replace it.
(delete-selection-mode 1)
;; Neotree
;; (require 'neotree)
;; (require 'all-the-icons)
;; (setq neo-window-width 40)
;; ;; (neotree-toggle)
;; (setq projectile-switch-project-action 'neotree-projectile-action)
;;;;;;;;;;;;;;;;;;;;;;;; code behaviour ;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Add ruler at 80, do not wrap lines (can be overwritten later)
(require 'whitespace)
;; (setq whitespace-space 'underline)
(add-hook 'prog-mode-hook 'whitespace-mode)
(toggle-truncate-lines t)
;; Show trailing whitespaces and remove whitespace on save
(setq-default show-trailing-whitespace t)
(setq whitespace-style '(face trailing lines-tail trailing))
(setq whitespace-line-column 80)
(add-hook 'before-save-hook 'delete-trailing-lines)
;; Tabs are spaces and are general at 2. Guide indent with lines
(setq-default indent-tabs-mode nil)
(setq tab-width 2)
(setq tab-stop-list (quote(2 4 6 8 10 12 14 16 20 22 24 26 28 30 32 34 36 38 40
42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74
76 78 80)))
;; (require 'indent-guide)
;; (indent-guide-global-mode)
; Insert newline on save
(setq require-final-newline t)
; Add code snippets as in sublime
(yas-global-mode t)
;;;;;;;;;;;;;;;;;;;;;;;; additional features ;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Add completion
(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(setq company-tooltip-limit 10)
(setq company-idle-delay .1)
(setq company-begin-commands '(self-insert-command))
(setq company-selection-wrap-around t)
; Add project management
(require 'projectile)
(projectile-mode)
(setq projectile-enable-caching t)
(setq projectile-globally-ignored-directories (
append '("node_modules" ".svn") projectile-globally-ignored-directories))
(projectile-mode t)
(require 'helm-projectile)
(with-eval-after-load 'helm-projectile
(defvar helm-source-file-not-found
(helm-build-dummy-source
"Create file"
:action (lambda (cand) (find-file cand))))
(add-to-list 'helm-projectile-sources-list helm-source-file-not-found t))
;; Show projectile lists by most recently active
(setq projectile-sort-order (quote recently-active))
; Use VIM mode
(require 'evil)
(require 'evil-leader)
(global-evil-leader-mode)
(evil-mode 1)
(require 'evil-magit)
;; ; Change cursor depending on the evil-mode
;; ; (setq evil-insert-state-cursor '(hbar))
;; (unless (display-graphic-p)
;; (require 'evil-terminal-cursor-changer)
;; (evil-terminal-cursor-changer-activate) ; or (etcc-on)
;; )
; Add opacity
;; (set-frame-parameter (selected-frame) 'alpha '(94 . 90))
;; (add-to-list 'default-frame-alist '(alpha . (94 . 90)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Additional loads ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Language specific stuff
(load "~/.emacs.d/ruby.el")
(load "~/.emacs.d/elixir.el")
(load "~/.emacs.d/javascript.el")
;;; behaviour.el ends here

12
elixir.el Normal file
View file

@ -0,0 +1,12 @@
; Special language package
(require 'alchemist)
; Hooks
(add-hook 'elixir-mode-hook
(alchemist-mode))
(add-hook 'elixir-mode-hook
'flycheck-mode)
(add-hook 'elixir-mode-hook
'ruby-end-mode)

40
emacs Normal file
View file

@ -0,0 +1,40 @@
::q
;; 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.
(package-initialize)
(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
("84d2f9eeb3f82d619ca4bfffe5f157282f4779732f48a5ac1484d94d5ff5b279" "c74e83f8aa4c78a121b52146eadb792c9facc5b1f02c917e3dbb454fca931223" "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "1747d30c98ba414fc837d042d2557f65d0697fcc9236c5c3d2ccd57a93b92a9e" "1b27e3b3fce73b72725f3f7f040fd03081b576b1ce8bbdfcb0212920aec190ad" "38dba83122d982aae1e9bed53cc268e2be9820bccc9087ef4418cad7bb9ef61b" "3eb93cd9a0da0f3e86b5d932ac0e3b5f0f50de7a0b805d4eb1f67782e9eb67a4" "d6db7498e2615025c419364764d5e9b09438dfe25b044b44e1f336501acd4f5b" "d21135150e22e58f8c656ec04530872831baebf5a1c3688030d119c114233c24" "946e871c780b159c4bb9f580537e5d2f7dba1411143194447604ecbaf01bd90c" "08b8807d23c290c840bbb14614a83878529359eaba1805618b3be7d61b0b0a32" default)))
'(package-selected-packages
(quote
(smart-mode-line-powerline-theme smart-mode-line mode-icons airline-themes atom-one-dark-theme neotree ant rainbow-delimiters rust-mode scala-mode haskell-mode yasnippet yaml-mode ujelly-theme rvm ruby-end rinari noctilux-theme markdown-mode jira indent-guide helm-projectile helm-ag haml-mode flycheck flatui-theme exec-path-from-shell evil-terminal-cursor-changer evil-nerd-commenter evil-magit evil-leader dumb-jump dockerfile-mode diff-hl base16-theme avk-emacs-themes alchemist aggressive-indent ag))))
'(custom-safe-themes
(quote
("15348febfa2266c4def59a08ef2846f6032c0797f001d7b9148f30ace0d08bcf" "62c80c6889010c3f0656e81ae201754058fd44743076f8dc56c595c2b9b5e298" "49b36c626548d200f97144cedb44f0a48020fda221b9e2930dc7d95ef4013eb1" "c3e6b52caa77cb09c049d3c973798bc64b5c43cc437d449eacf35b3e776bf85c" "38dba83122d982aae1e9bed53cc268e2be9820bccc9087ef4418cad7bb9ef61b" "39fe48be738ea23b0295cdf17c99054bb439a7d830248d7e6493c2110bfed6f8" "85d609b07346d3220e7da1e0b87f66d11b2eeddad945cac775e80d2c1adb0066" "be4025b1954e4ac2a6d584ccfa7141334ddd78423399447b96b6fa582f206194" "cc60d17db31a53adf93ec6fad5a9cfff6e177664994a52346f81f62840fe8e23" "ba9be9caf9aa91eb34cf11ad9e8c61e54db68d2d474f99a52ba7e87097fa27f5" "0c311fb22e6197daba9123f43da98f273d2bfaeeaeb653007ad1ee77f0003037" "d96587ec2c7bf278269b8ec2b800c7d9af9e22d816827639b332b0e613314dfd" "5a7830712d709a4fc128a7998b7fa963f37e960fd2e8aa75c76f692b36e6cf3c" "0c3b1358ea01895e56d1c0193f72559449462e5952bded28c81a8e09b53f103f" "760ce657e710a77bcf6df51d97e51aae2ee7db1fba21bbad07aab0fa0f42f834" "16dd114a84d0aeccc5ad6fd64752a11ea2e841e3853234f19dc02a7b91f5d661" "eae831de756bb480240479794e85f1da0789c6f2f7746e5cc999370bbc8d9c8a" "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879" "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" "ef04dd1e33f7cbd5aa3187981b18652b8d5ac9e680997b45dc5d00443e6a46e3" "b3bcf1b12ef2a7606c7697d71b934ca0bdd495d52f901e73ce008c4c9825a3aa" "78c1c89192e172436dbf892bd90562bc89e2cc3811b5f9506226e735a953a9c6" default)))
'(package-selected-packages
(quote
(flatui-theme jira dockerfile-mode imenu-anywhere dumb-jump apropospriate-theme avk-emacs-themes punpun-theme git-gutter haml-mode multiple-cursors ujelly-theme cherry-blossom-theme firebelly-theme noctilux-theme yasnippet flycheck evil-magit magit rinari aggressive-indent agressive-indent exec-path-from-shell helm-ag flycheck-elixir-credo elixir-yasnippets markdown-mode helm-projectile ag evil-leader ruby-end helm projectile indent-guide solarized-theme base16-theme neotree alchemist rvm diff-hl ##)))
'(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.
)
;;; Set performance
(setq gc-cons-threshold 100000000)
; load custom config files
(load "~/.emacs.d/packages.el")
(load "~/.emacs.d/behaviour.el")
(load "~/.emacs.d/key-bindings.el")
;;; emacs ends here

1
javascript.el Normal file
View file

@ -0,0 +1 @@
(setq js-indent-level 2)

71
key-bindings.el Normal file
View file

@ -0,0 +1,71 @@
;;; keybindings.el --- Summary
;;; Commentary: Maciej Szlosarczyk keybindings
;;; Code:
;;;;;;;;; Emacs bindings ;;;;;;;;;;;;;;;;;;;;;
(global-set-key (kbd "RET") 'newline)
;;;;;;;;; Mac binding (fix) ;;;;;;;;;;;;;;;;;;
(define-key global-map [home] 'beginning-of-line)
(define-key global-map [end] 'end-of-line)
(global-set-key (kbd "s-<right>") 'end-of-line)
(global-set-key (kbd "s-<left>") 'beginning-of-line)
(global-set-key (kbd "s-<up>") 'scroll-down) ; WTF is this reverse, I dunno
(global-set-key (kbd "s-<down>") 'scroll-up)
;;;;;;;;; EVIL Leader ;;;;;;;;;;;;;;;;;;;;;;;;
(evil-leader/set-leader "<SPC>")
(evil-leader/set-key
"w" 'kill-buffer
"," 'previous-buffer
"." 'next-buffer
"k" 'kill-buffer-and-window
"rb" 'revert-buffer) ; Reload current file from disk
(evil-leader/set-key "hs" 'split-window-below)
(evil-leader/set-key "vs" 'split-window-right)
(evil-leader/set-key
"gk" 'windmove-up
"gj" 'windmove-down
"gl" 'windmove-right
"gh" 'windmove-left)
(evil-leader/set-key
"gs" 'magit-status
"gL" 'magit-log
"gco" 'magit-checkout)
(evil-leader/set-key "fc" 'global-flycheck-mode)
(evil-leader/set-key "al" 'align-regexp)
(evil-leader/set-key "ir" 'indent-region)
(evil-leader/set-key "ac" 'align-to-colon)
(evil-leader/set-key "cl" 'evilnc-comment-or-uncomment-lines)
(evil-leader/set-key "Ps" 'helm-projectile-switch-project)
(evil-leader/set-key "t" 'helm-projectile-find-file)
(evil-leader/set-key "ag" 'helm-projectile-ag)
(evil-leader/set-key "Pc" 'projectile-invalidate-cache)
(evil-leader/set-key "b" 'helm-buffers-list)
(evil-leader/set-key "<SPC>" 'company-yasnippet)
(evil-leader/set-key "rC" 'load-file "~/.emacs")
(evil-leader/set-key "Jl" 'dumb-jump-go); Jump to declaration
(evil-leader/set-key "Jh" 'dumb-jump-back); Jump back from declariation
(evil-leader/set-key "nt" 'neotree-toggle)
;;; VIM insert mode things
(define-key evil-insert-state-map "\C-a" 'company-yasnippet)
;;; Neotree conflict resolution
(add-hook 'neotree-mode-hook
(lambda ()
(define-key evil-normal-state-local-map (kbd "TAB") 'neotree-enter)
(define-key evil-normal-state-local-map (kbd "SPC") 'neotree-enter)
(define-key evil-normal-state-local-map (kbd "q") 'neotree-hide)
(define-key evil-normal-state-local-map (kbd "RET") 'neotree-enter)))
;;; key-bindings.el ends here

176
packages.el Normal file
View file

@ -0,0 +1,176 @@
;;; melpa.el -- summary
;;; Commentary:
;;; Put all the packages you want to install here.
;;; Code:
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(package-initialize)
; Behaviour
(unless (package-installed-p 'helm)
(package-refresh-contents)
(package-install 'helm))
(unless (package-installed-p 'evil)
(package-refresh-contents)
(package-install 'evil))
(unless (package-installed-p 'evil-leader)
(package-refresh-contents)
(package-install 'evil-leader))
(unless (package-installed-p 'evil-nerd-commenter)
(package-refresh-contents)
(package-install 'evil-nerd-commenter))
;; Rainbow delimiters
(unless (package-installed-p 'rainbow-delimiters)
(package-refresh-contents)
(package-install 'rainbow-delimiters))
;; Neotree
(unless (package-installed-p 'neotree)
(package-refresh-contents)
(package-install 'neotree))
;; Powerline with mode-line icons
(unless (package-installed-p 'smart-mode-line)
(package-refresh-contents)
(package-install 'smart-mode-line))
(unless (package-installed-p 'indent-guide)
(package-refresh-contents)
(package-install 'indent-guide))
(unless (package-installed-p 'projectile)
(package-refresh-contents)
(package-install 'projectile))
(unless (package-installed-p 'ag)
(package-refresh-contents)
(package-install 'ag))
(unless (package-installed-p 'helm-projectile)
(package-refresh-contents)
(package-install 'helm-projectile))
(unless (package-installed-p 'helm-ag)
(package-refresh-contents)
(package-install 'helm-ag))
(unless (package-installed-p 'aggressive-indent)
(package-refresh-contents)
(package-install 'aggressive-indent))
(unless (package-installed-p 'dumb-jump)
(package-refresh-contents)
(package-install 'dumb-jump))
; Run stuff directly from shell
(unless (package-installed-p 'exec-path-from-shell)
(package-refresh-contents)
(package-install 'exec-path-from-shell))
; Themes
(unless (package-installed-p 'base16-theme)
(package-refresh-contents)
(package-install 'base16-theme))
(unless (package-installed-p 'noctilux-theme)
(package-refresh-contents)
(package-install 'noctilux-theme))
(unless (package-installed-p 'ujelly-theme)
(package-refresh-contents)
(package-install 'ujelly-theme))
(unless (package-installed-p 'avk-emacs-themes)
(package-refresh-contents)
(package-install 'avk-emacs-themes))
(unless (package-installed-p 'flatui-theme)
(package-refresh-contents)
(package-install 'flatui-theme))
(unless (package-installed-p 'all-the-icons)
(package-refresh-contents)
(package-install 'all-the-icons))
(unless (package-installed-p 'atom-one-dark-theme)
(package-refresh-contents)
(package-install 'atom-one-dark-theme))
; Elixir
(unless (package-installed-p 'elixir-mode)
(package-refresh-contents)
(package-install 'elixir-mode))
(unless (package-installed-p 'alchemist)
(package-refresh-contents)
(package-install 'alchemist))
; Ruby
(unless (package-installed-p 'rvm)
(package-refresh-contents)
(package-install 'rvm))
(unless (package-installed-p 'ruby-end)
(package-refresh-contents)
(package-install 'ruby-end))
(unless (package-installed-p 'haml-mode)
(package-refresh-contents)
(package-install 'haml-mode))
(unless (package-installed-p 'yaml-mode)
(package-refresh-contents)
(package-install 'yaml-mode))
; Git
(unless (package-installed-p 'magit)
(package-refresh-contents)
(package-install 'magit))
(unless (package-installed-p 'diff-hl)
(package-refresh-contents)
(package-install 'diff-hl))
(unless (package-installed-p 'evil-magit)
(package-refresh-contents)
(package-install 'evil-magit))
; Code quality and helpers
(unless (package-installed-p 'flycheck)
(package-refresh-contents)
(package-install 'flycheck))
(unless (package-installed-p 'projectile)
(package-refresh-contents)
(package-install 'projectile))
(unless (package-installed-p 'yasnippet)
(package-refresh-contents)
(package-install 'yasnippet))
; Markdown helper
(unless (package-installed-p 'markdown-mode)
(package-refresh-contents)
(package-install 'markdown-mode))
(unless (package-installed-p 'dockerfile-mode)
(package-refresh-contents)
(package-install 'dockerfile-mode))
; Scala, Haskell, Rust
(unless (package-installed-p 'haskell-mode)
(package-refresh-contents)
(package-install 'haskell-mode))
(unless (package-installed-p 'scala-mode)
(package-refresh-contents)
(package-install 'scala-mode))
(unless (package-installed-p 'rust-mode)
(package-refresh-contents)
(package-install 'rust-mode))
;;; elpa.el ends here

23
ruby.el Normal file
View file

@ -0,0 +1,23 @@
(add-hook 'ruby-mode-hook
(aggressive-indent-mode))
(add-hook 'yaml-mode-hook
(lambda () (indent-guide-mode -1)))
(add-hook 'sql-mode-hook
(lambda () (indent-guide-mode -1)))
(defun align-to-colon (begin end)
"Align region to colon (:) signs"
(interactive "r")
(align-regexp begin end
(rx ":" (group (zero-or-more (syntax whitespace))) ) 1 1 ))
;; Do not align 'begin' and 'while' ;;
(setq ruby-align-to-stmt-keywords '(if begin case elseif rescue))
;; Do not indent inside the parenthasis
(setq ruby-deep-indent-paren nil)
;; Do not insert encoding comments ;;
(setq ruby-insert-encoding-magic-comment nil)