Last active
March 26, 2018 07:12
-
-
Save Nek/c0428c4b9e7b73ff2c5cbf0286a59305 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
(require 'package) | |
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") | |
("melpa" . "https://melpa.org/packages/") | |
("marmalade" . "https://marmalade-repo.org/packages/") | |
("org" . "http://orgmode.org/elpa/") | |
("sunrise" . "http://joseito.republika.pl/sunrise-commander/"))) | |
(package-initialize) | |
(defun package-install-if-not (package) | |
"Install PACKAGE if it's not installed yet." | |
(unless (package-installed-p package) | |
(package-refresh-contents) | |
(package-install package))) | |
(package-install-if-not 'use-package) | |
(setq package-enable-at-startup nil) | |
(eval-when-compile | |
(require 'use-package)) | |
(put 'use-package 'lisp-indent-function 1) | |
(setq use-package-always-ensure t) | |
;; :quelpa keyword for use-I. | |
;; package-enable-at-need startup it to use packages directly from git repos. | |
(use-package quelpa) | |
(use-package quelpa-use-package) | |
;; Add :diminish and :delight to make mode-line less cluttered | |
(use-package diminish) | |
(use-package delight) | |
;; Add :bind to easily add package specific key bindings | |
(use-package bind-key) | |
(use-package exec-path-from-shell | |
:ensure t | |
:if (memq window-system '(mac ns x)) | |
:config | |
(setq exec-path-from-shell-variables '("PATH")) | |
(exec-path-from-shell-initialize)) | |
;; Better list-packages | |
(use-package paradox | |
:config | |
(paradox-enable)) | |
;; Fix some annoyances | |
;; Store all backup and autosave files in the tmp dir | |
(setq backup-directory-alist | |
`((".*" . ,temporary-file-directory))) | |
(setq auto-save-file-name-transforms | |
`((".*" ,temporary-file-directory t))) | |
;; Disable lock files (they prevent simultaneous editing) | |
(setq create-lockfiles nil) | |
;; Set Emacs default shell | |
;; This prevents errors if you use a shell different from /bin/sh (I use fish) | |
(setq shell-file-name "/bin/sh") | |
;; Prevent passing MacOs system shortcuts from Emacs to the OS (f.e. CMD + h) | |
;; I couldn't make CMD+SPC work and had to remap "switch input source" | |
;; command to ALT+SPC | |
(setq mac-pass-command-to-system nil) | |
;; Make emacs ask for y or n instead of yes or no | |
(fset 'yes-or-no-p 'y-or-n-p) | |
;; Configure built-in features | |
;; Go to file or link by M-RET | |
(global-set-key (kbd "M-RET") 'find-file-at-point) | |
;; Auto close brackets | |
(electric-pair-mode 1) | |
(use-package treemacs) | |
;; M-x all-the-icons-install-fonts | |
(use-package all-the-icons) | |
(use-package all-the-icons-dired | |
:config | |
(defun rg/all-the-icons-dired-hook () | |
(setq-local all-the-icons-dired-displayed nil) | |
(all-the-icons-dired--display)) | |
;;;###autoload | |
(define-minor-mode rg/all-the-icons-dired-mode | |
"Display all-the-icons icon for each files in a dired buffer." | |
:lighter " rg/all-the-icons-dired-mode" | |
(if (and (display-graphic-p) rg/all-the-icons-dired-mode) | |
(progn | |
(add-hook 'dired-after-readin-hook 'rg/all-the-icons-dired-hook t t) | |
(when (derived-mode-p 'dired-mode) | |
(all-the-icons-dired--display))) | |
(remove-hook 'dired-after-readin-hook 'rg/all-the-icons-dired-hook t) | |
(dired-revert))) | |
:hook | |
(dired-mode . rg/all-the-icons-dired-mode)) | |
(use-package flycheck | |
:delight "") | |
;; List of recent files and projects on startup screen | |
(use-package dashboard | |
:diminish | |
:diminish page-break-lines-mode | |
:init | |
(setq dashboard-startup-banner "~/.emacs.d/acid.png") | |
(setq dashboard-banner-logo-title "🔥👹Welcome to Madness!👹🔥") | |
(setq dashboard-items '((recents . 7) | |
(projects . 7))) | |
(toggle-frame-maximized) | |
:config | |
(dashboard-setup-startup-hook)) | |
;; Highlight matching parenthesis | |
(use-package paren | |
:init | |
(setq show-paren-style 'parenthesis) | |
:config | |
(show-paren-mode 1)) | |
;; use project specific editor configs | |
(use-package editorconfig | |
:diminish | |
:config | |
(editorconfig-mode 1)) | |
;; Add autocompletion to M-x | |
(use-package smex | |
:defines smex-save-file | |
:config | |
(setq smex-save-file "~/.cache/emacs/smex-items") | |
(smex-initialize)) | |
;; Expand region by semantic units | |
(use-package expand-region | |
:bind | |
("C-=" . er/expand-region)) | |
;; Make help system better | |
(use-package helpful | |
:bind | |
(("C-h f" . helpful-callable) | |
("C-h v" . helpful-variable) | |
("C-h k" . helpful-key) | |
("C-c C-d" . helpful-at-point) | |
("C-h F" . helpful-function) | |
("C-h C" . helpful-command))) | |
;; Completion for Emacs minibuffers | |
;; C-c C-r to resume last ivy action | |
(use-package ivy | |
:diminish | |
:config | |
(ivy-mode t) | |
(setq | |
ivy-use-virtual-buffers t | |
ivy-count-format "(%d/%d) ") | |
:bind | |
(("C-c C-r" . ivy-resume))) | |
;; Shorter shortcuts for ivy | |
(use-package ivy-hydra) | |
;; Ivy completion extras and custom shortcuts | |
(use-package counsel | |
:init | |
(require 'iso-transl) | |
:bind | |
(("M-x" . counsel-M-x) | |
("M-y" . counsel-yank-pop) | |
("C-x C-f" . counsel-find-file) | |
("C-c C-SPC" . counsel-mark-ring) | |
("<f10>" . counsel-tmm) | |
:map iso-transl-ctl-x-8-map | |
("RET" . counsel-unicode-char) | |
:map help-map | |
("f" . counsel-describe-function) | |
("v" . counsel-describe-variable) | |
("b" . counsel-descbinds))) | |
;; Better search in buffer | |
(use-package counsel-extras | |
:ensure nil | |
:quelpa | |
(counsel-extras :repo "a13/counsel-extras" :fetcher github :version original) | |
:bind | |
(("C-s" . counsel-extras-grep-or-isearch-or-swiper))) | |
;; Ivy for regex | |
(use-package swiper) | |
;; Better interface for ivy | |
(use-package ivy-rich | |
:defines ivy-rich-abbreviate-paths ivy-rich-switch-buffer-name-max-length | |
:config | |
(setq ivy-rich-abbreviate-paths t) | |
(setq ivy-rich-switch-buffer-name-max-length 45) | |
(ivy-set-display-transformer 'ivy-switch-buffer 'ivy-rich-switch-buffer-transformer)) | |
;; Undo tree | |
(use-package undo-tree) | |
;; Git client | |
(use-package magit | |
:bind | |
("C-c g b" . magit-blame) | |
("C-c g m" . magit)) | |
(use-package git-gutter | |
:diminish | |
:config | |
(global-git-gutter-mode +1) | |
(custom-set-variables | |
'(git-gutter:update-interval 2) | |
'(git-gutter:modified-sign "*") | |
'(git-gutter:added-sign "+") | |
'(git-gutter:deleted-sign "-") | |
'(git-gutter:hide-gutter nil)) | |
) | |
;; Highlight uncommitted changes | |
;; (use-package diff-hl | |
;; :hook | |
;; ((magit-post-refresh . diff-hl-magit-post-refresh) | |
;; (prog-mode . diff-hl-mode) | |
;; (dired-mode . diff-hl-dired-mode))) | |
(use-package git-link | |
:bind | |
("C-c g l" . git-link)) | |
;; The silver searcher for emacs | |
(use-package ag) | |
;; Project management tool | |
(use-package projectile | |
:init | |
(setq projectile-completion-system 'ivy) | |
:config | |
(diminish 'projectile-mode '(:eval | |
(let ((ppn (projectile-project-name))) | |
(unless (string= ppn "-") | |
(format " %s " ppn))))) | |
(projectile-mode) | |
) | |
(use-package counsel-projectile | |
:config | |
(counsel-projectile-mode) | |
:bind | |
("M-p" . counsel-projectile) | |
) | |
;; Configurable code snippets ala textmate | |
(use-package yasnippet | |
:diminish yas-minor-mode | |
:config | |
(yas-reload-all) | |
(setq yas-prompt-functions '(yas-completing-prompt yas-ido-prompt)) | |
:hook | |
(prog-mode . yas-minor-mode)) | |
;; Hide namespace prefix while editing elisp package | |
(use-package nameless | |
:hook | |
(emacs-lisp-mode . nameless-mode) | |
:config | |
(setq nameless-private-prefix t)) | |
;; A tool that suggests elisp function by provided input and output | |
(use-package suggest) | |
;; Pretty print the result of the last evaluated elisp expression | |
(use-package ipretty | |
:config | |
(ipretty-mode 1)) | |
;; complete everything, universal completion framework | |
(use-package company | |
:diminish | |
:hook | |
(after-init . global-company-mode) | |
) | |
;; Emojis for in Emacs! :cactus: -> 🌵 | |
;; (use-package company-emoji | |
;; :config | |
;; (add-to-list 'company-backends 'company-emoji) | |
;; (set-fontset-font t 'symbol | |
;; (font-spec :family | |
;; (if (eq system-type 'darwin) | |
;; "Apple Color Emoji" | |
;; "Symbola")) | |
;; nil 'prepend)) | |
;; Show keybindings for incomplete command | |
(use-package which-key | |
:diminish which-key-mode | |
:init | |
(which-key-mode)) | |
(use-package htmlize) | |
;; Folding | |
;; (use-package hideshow | |
;; :hook | |
;; (prog-mode . hs-minor-mode) | |
;; :bind | |
;; ("C-<return>" . hs-toggle-hiding)) | |
(use-package lisp-mode | |
:ensure nil | |
:delight " " | |
) | |
;; Fish shell syntax | |
(use-package fish-mode) | |
;; Scheme | |
(use-package geiser) | |
;; Clojure | |
(use-package clojure-mode | |
:delight " ") | |
(use-package clojurescript-mode | |
:delight " ") | |
;; Additional syntax highlightning | |
(use-package clojure-mode-extra-font-locking) | |
(use-package clojure-snippets) | |
;; Exhaustive Clojure development package | |
;; it formats buffer and attempts to return to original position. | |
(defun cider-format-buffer-back () (interactive) | |
(let (p) | |
(setq p (point)) | |
(cider-format-buffer) | |
(goto-char p))) | |
(defun add-clj-format-before-save () (interactive) | |
(add-hook 'before-save-hook | |
'cider-format-buffer-back | |
t t)) | |
;; (add-hook 'clojure-mode-hook | |
;; 'add-clj-format-before-save) | |
(use-package cider | |
:config | |
(setq cider-cljs-lein-repl | |
"(do (require 'figwheel-sidecar.repl-api) | |
(figwheel-sidecar.repl-api/start-figwheel!) | |
(figwheel-sidecar.repl-api/cljs-repl))") | |
;; sadly, we can't use :diminish keyword here, yet | |
(diminish 'cider-mode | |
'(:eval (format " 🍏%s " (cider--modeline-info)))) | |
;; :hook | |
;; (clojure-mode . add-clj-format-before-save) | |
) | |
;; Clojure code style fixer helper | |
(use-package kibit-helper) | |
(use-package smartparens | |
:diminish | |
:bind | |
(("C-c <right>" . sp-forward-slurp-sexp) | |
("C-c <left>" . sp-forward-barf-sexp)) | |
:config | |
(require 'smartparens-config) | |
:hook | |
(prog-mode . smartparens-mode)) | |
(insert (all-the-icons-icon-for-file "eee.jsx")) | |
;; JavaScript | |
(use-package js2-mode | |
:delight "" | |
:diminish hs-mode | |
:init | |
;; Disable js2 mode linting | |
(setq js2-mode-show-strict-warnings nil) | |
(setq js2-mode-show-parse-errors nil) | |
:config | |
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))) | |
;; (use-package js2-refactor | |
;; :diminish | |
;; :hook | |
;; (js2-mode . js2-refactor-mode) | |
;; ) | |
(use-package indium | |
:diminish indium-interaction-mode | |
:hook | |
(js2-mode . indium-interaction-mode)) | |
;; React | |
(use-package rjsx-mode | |
:delight "" | |
:diminish js2-mode | |
:config | |
(add-to-list 'auto-mode-alist '("containers\\/.*\\.js\\'" . rjsx-mode))) | |
;;(insert (all-the-icons-icon-for-file "foo.html")) | |
;;(insert (all-the-icons-icon-for-file "foo.txt")) | |
;;(insert (all-the-icons-icon-for-file "foo.yaml")) | |
(use-package eldoc | |
:delight "") | |
(defun setup-tide-mode () | |
"Set up Tide mode." | |
(interactive) | |
(tide-setup) | |
(flycheck-mode +1) | |
(setq flycheck-check-syntax-automatically '(save-mode-enabled)) | |
(eldoc-mode +1) | |
(tide-hl-identifier-mode +1) | |
(company-mode +1)) | |
(use-package tide | |
:diminish | |
:ensure t | |
:config | |
(setq tide-tsserver-executable "/usr/local/bin/tsserver") | |
(setq company-tooltip-align-annotations t) | |
(setq tide-sort-completions-by-kind t) | |
(setq tide-completion-detailed t) | |
(setq tide-hl-identifier-idle-time 0) | |
;; (add-hook 'before-save-hook 'tide-format-before-save) | |
(add-hook 'js2-mode-hook #'setup-tide-mode) | |
(flycheck-add-next-checker 'javascript-eslint 'javascript-tide 'append) | |
;; (add-hook 'web-mode-hook | |
;; (lambda () | |
;; (when (string-equal "jsx" (file-name-extension buffer-file-name)) | |
;; (setup-tide-mode)))) | |
(flycheck-add-mode 'javascript-eslint 'web-mode) | |
(flycheck-add-next-checker 'javascript-eslint 'jsx-tide 'append) | |
) | |
;; Code formatter | |
;; (use-package prettier-js | |
;; :diminish (prettier-js-mode . "👸🏻") | |
;; :hook | |
;; (js2-mode . prettier-js-mode) | |
;; (rjsx-mode . prettier-js-mode)) | |
;; Go to a definition of anything and back | |
(use-package dumb-jump | |
:bind | |
(("M-g j" . dumb-jump-go) | |
("M-g p" . dumb-jump-back)) | |
:init | |
(setq dumb-jump-selector 'ivy) | |
(setq dumb-jump-aggressive nil)) | |
;; Get rid of UI noise | |
(menu-bar-mode -1) | |
(tool-bar-mode -1) | |
(scroll-bar-mode -1) | |
;; Make sortcuts work in cyrillic layout | |
(use-package reverse-im | |
:config | |
(reverse-im-activate "russian-computer")) | |
;; Make Emacs dark | |
(use-package plan9-theme) | |
;; Set custom font | |
(set-face-attribute 'default nil :family "Input" :height 160) | |
'(cider-cljs-lein-repl | |
"(do (require 'figwheel-sidecar.repl-api) | |
(figwheel-sidecar.repl-api/start-figwheel!) | |
(figwheel-sidecar.repl-api/cljs-repl))") :diminish | |
(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. | |
'(browse-url-chromium-program | |
"/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary") | |
'(cider-cljs-lein-repl | |
"(do (require 'figwheel-sidecar.repl-api) | |
(figwheel-sidecar.repl-api/start-figwheel!) | |
(figwheel-sidecar.repl-api/cljs-repl))") | |
'(git-gutter:added-sign "+") | |
'(git-gutter:deleted-sign "-") | |
'(git-gutter:hide-gutter nil) | |
'(git-gutter:modified-sign "*") | |
'(git-gutter:update-interval 2) | |
'(package-selected-packages | |
(quote | |
(indium quelpa-use-package quelpa diminish use-package))) | |
'(projectile-globally-ignored-directories | |
(quote | |
(".idea" ".ensime_cache" ".eunit" ".git" ".hg" ".fslckout" "_FOSSIL_" ".bzr" "_darcs" ".tox" ".svn" ".stack-work" "node_modules" "build" "config" "public" "scripts"))) | |
'(tramp-syntax (quote default) nil (tramp))) | |
(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. | |
) | |
(provide 'init) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment