Skip to content

Instantly share code, notes, and snippets.



Last active Jan 4, 2018
What would you like to do?
Dot files
(require 'package)
(setq package-archives '(("gnu" . "")
("melpa" . "")
("marmalade" . "")
("org" . "")
("sunrise" . "")))
(defun package-install-if-not (package)
"Install PACKAGE if it's not installed yet."
(unless (package-installed-p package)
(package-install package)))
(package-install-if-not 'use-package)
(setq package-enable-at-startup nil)
(require 'use-package))
(put 'use-package 'lisp-indent-function 1)
(setq use-package-always-ensure t)
;; recent files list by C-x C-r
(recentf-mode 1)
(setq recentf-max-menu-items 11)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
;; CTRL+T create new tab
;; CTRL+TAB switch between tabs
;; CTRL+shift+TAB mac-toggle-tab-group-overview
;; go to file or link by M-RET
(global-set-key (kbd "M-RET") 'find-file-at-point)
;; switch between tabs (mac only fewature)
(global-set-key (kbd "A-<right>") 'mac-next-tab)
(global-set-key (kbd "A-<left>") 'mac-previous-tab)
;; 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)))
;; auto close brackets
(electric-pair-mode 1)
;; make emacs ask for y or n instead of yes or no
(fset 'yes-or-no-p 'y-or-n-p)
;;(global-unset-key (kbd "M-SPC") )
;; prevent passing macos system shortcuts from emacs to the os (f.e. CMD + h)
(setq mac-pass-command-to-system nil)
;; there is no easy way to have some CMD + something shortcuts work
;; I've remapped switch imput source to Alt + SPC
;; and Alfred to Alt + Esc
;; prevent errors with external utils if the default shell isn't sh (I use fish)
(setq shell-file-name "/bin/sh")
;; used to maked modeline less cluttered
;; adds :diminish to use-package
(use-package diminish)
(use-package delight)
;; highlight matching parenthesis
(use-package paren
(setq show-paren-style 'parenthesis)
(show-paren-mode 1))
;; use project specific editor configs
(use-package editorconfig
(editorconfig-mode 1))
;; used to manage personal key bindings
;; adds :bind to use-package
(use-package bind-key)
;; :quelpa keyword for use-package
(use-package quelpa)
(use-package quelpa-use-package)
;; make package menu awesome
(use-package paradox
;; make M-x much more convinient
(use-package smex
:defines smex-save-file
(setq smex-save-file "~/.cache/emacs/smex-items")
;; expand region by semantic units
(use-package expand-region
("C-=" . er/expand-region))
;; make help system better
(use-package helpful
(("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)))
;; give completion superpowers to emacs ui
;; C-c C-r to resume last ivy action
(use-package ivy
(ivy-mode t)
ivy-use-virtual-buffers t
ivy-count-format "%d/%d ")
(("C-c C-r" . ivy-resume)))
;; shorter shortcuts for ivy
(use-package ivy-hydra)
;; ivy completion extras and custom shortcuts
(use-package counsel
(require 'iso-transl)
(("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)))
;; nice forward search
(use-package counsel-extras
:ensure nil
(counsel-extras :repo "a13/counsel-extras" :fetcher github :version original)
(("C-s" . counsel-extras-grep-or-isearch-or-swiper)))
;; ivy for regex
(use-package swiper)
;; more friendly interface for ivy
(use-package ivy-rich
:defines ivy-rich-abbreviate-paths ivy-rich-switch-buffer-name-max-length
(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))
;; move around screen by sequence of letters
(use-package avy
(("C-:" . avy-goto-char)
("C-'" . avy-goto-char-2)
("M-g M-g" . avy-goto-line)
("M-g w" . avy-goto-word-1)))
;; great git client
(use-package magit)
;; highlight uncommitted changes
(use-package diff-hl
((magit-post-refresh . diff-hl-magit-post-refresh)
(prog-mode . diff-hl-mode)
(dired-mode . diff-hl-dired-mode)))
;; the silver searcher for emacs
(use-package ag)
;; project management tool
(use-package projectile
(setq projectile-completion-system 'ivy)
(diminish 'projectile-mode '(:eval
(let ((ppn (projectile-project-name)))
(unless (string= ppn "-")
(format " 📂%s" ppn)))))
(use-package counsel-projectile
;; configurable code snippets ala textmate
(use-package yasnippet
:diminish yas-minor-mode
(setq yas-prompt-functions '(yas-completing-prompt yas-ido-prompt))
(prog-mode . yas-minor-mode))
;; advanced syntax checker
;;(use-package flycheck
;; :diminish flycheck-mode
;; :hook
;; (prog-mode . flycheck-mode))
;; hide namespace prefix while editing elisp package
(use-package nameless
(emacs-lisp-mode . nameless-mode)
(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
(ipretty-mode 1))
;; complete everything, universal completion framework
(use-package company
(after-init . global-company-mode))
;; emojis for in Emacs! :cactus: -> 🌵
(use-package company-emoji
(add-to-list 'company-backends 'company-emoji)
(set-fontset-font t 'symbol
(font-spec :family
(if (eq system-type 'darwin)
"Apple Color Emoji"
nil 'prepend))
;; show keybindings for incomplete command
(use-package which-key
:diminish which-key-mode
;; Fish shell syntax
(use-package fish-mode)
;; Scheme
(use-package geiser)
;; Clojure
(use-package clojure-mode
:delight "(λ)")
;; Additional syntax highlightning
(use-package clojure-mode-extra-font-locking)
(use-package clojure-snippets)
;; Exhaustive Clojure development package
(use-package cider
;; sadly, we can't use :diminish keyword here, yet
(diminish 'cider-mode
'(:eval (format " 🍏%s" (cider--modeline-info)))))
;; Clojure code style fixer helper
(use-package kibit-helper)
;; JavaScript
(use-package js2-mode
:delight "{js}")
;; React
(use-package rjsx-mode
:delight "{jsx}")
;; Hints and autocompletion for JS
(use-package company-tern
(add-to-list 'company-backends 'company-tern)
(js2-mode . (lambda ()
(delight 'tern-mode "" 'tern))))
(use-package prettier-js
:diminish (prettier-js-mode . "👸🏻")
(js2-mode . prettier-js-mode)
(rxjs-mode . prettier-js-mode))
;; dumb goto definition which is actually quite smart
(use-package dumb-jump
(("M-g j" . dumb-jump-go)
("M-g p" . dumb-jump-back))
(setq dumb-jump-selector 'ivy)
(setq dumb-jump-aggressive nil))
;; Make Emacs dark 🧛🏻‍♀️
(use-package zenburn-theme)
;; Add best font
(set-face-attribute 'default nil :family "Input" :height 160)
(use-package all-the-icons)
(setq initial-buffer-choice (recentf-open-files))
;; 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 (quelpa-use-package quelpa diminish use-package)))
'(tramp-syntax (quote default) nil (tramp)))
;; 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
You can’t perform that action at this time.