(require 'package)
Use MELPA as primary source
(add-to-list 'package-archives
'("melpa" . "https://stable.melpa.org/packages/"))
Add org-contrib repo.
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
We’re all set up.
(package-initialize)
Don’t forget to install use-package
. use-package
is the core of
this config.
(unless (package-installed-p 'use-package) (package-install 'use-package))
As a heavy keyboard user, I never used the menubar anyway.
(menu-bar-mode -1)
I’m not sure why beginners find downcase-region
and
upcase-region
commands confusing. Let’s enable them.
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
Customizations will be stored in customizations.el
(use-package customizations
:defer t
:init
(setq custom-file (locate-user-emacs-file "customizations.el"))
(load custom-file))
At first default keybinding for moving between windows (C-x o
)
looked strange for me. So I opted to use windmove
library, which
allows to select windows using shift + arrow keys. (S-left
and so
on).
(use-package windmove
:config
(windmove-default-keybindings))
When it comes to session persisting, Emacs, no surprise, already has a solution. Built-in desktop library provides such functionality.
(use-package desktop
:init
(desktop-save-mode t))
This config uses Ivy as completion frontend.
(use-package ivy :ensure t)
Other completion functions
(use-package counsel :ensure t)
(use-package counsel-projectile
:ensure t
:bind
("C-x C-p" . counsel-projectile-find-file)
("C-x C-o" . counsel-projectile-ag))
(use-package smex
:ensure t
:bind
("M-x" . smex))
(use-package projectile
:init
(projectile-mode))
Switch to project buffers using projectile-switch-to-buffer
,
fallback to switch-to-buffer
otherwise.
(use-package akhramov-projectile-switch-to-buffer
:load-path
(lambda () (locate-user-emacs-file "packages"))
:bind
("C-x b" . akhramov-projectile-switch-to-buffer))
Drop-in replacement for standard comment-dwim
(use-package comment-dwim-2
:ensure t
:bind
("M-;" . comment-dwim-2))
Multicursor support
(use-package multiple-cursors
:ensure t
:bind
("M-]" . mc/mark-next-like-this))
(use-package flycheck
:ensure t
:init
(add-hook 'after-init-hook 'global-flycheck-mode))
(use-package magit :ensure t)
Eshell fish-like autosuggestions
(use-package esh-autosuggest
:hook (eshell-mode . esh-autosuggest-mode)
:ensure t)
I used to run terminals in Emacs for long. Let’s take a step towards eshell. Meshelle glues projectile and eshell with ivy.
(use-package meshelle
:load-path
(lambda () (locate-user-emacs-file "packages"))
:bind
("C-x p" . meshelle))
(use-package org-mode
:ensure org-plus-contrib
:bind ("C-c a" . org-agenda))
(use-package org-wild-notifier
:ensure t
:init (org-wild-notifier-mode))
(use-package alert :ensure t)
Wild notifier. Spiky, but works. Upon click wild-notifier
- Focuses terminal
- Executes commands (e.g.
switch-buffer
)
(when (string-equal system-type "darwin")
(use-package wild-notifier
:init (setf alert-default-style 'wild)
:load-path (lambda () (locate-user-emacs-file "packages"))))
(use-package agda2-mode
:mode "\\.agda\\'"
:load-path
(lambda () (file-name-directory (shell-command-to-string "agda-mode locate")))
:init
(bind-key "C-c ." 'agda2-goal-and-context-and-inferred)
(bind-key "C-c C-s" 'agda2-solve-maybe-all))
I don’t always write C code, but when I do it’s always in Ruby style
(use-package ruby-style
:load-path
(lambda () (locate-user-emacs-file "packages/vendor")))
(use-package elm-mode :ensure t)
(use-package js2-mode
:ensure t
:init
(add-hook 'js-mode-hook 'js2-minor-mode))
Parens and indentation with parinfer:
(use-package parinfer
:ensure t
:init
(progn
(setq parinfer-extensions
'(defaults ; should be included.
pretty-parens ; different paren styles for different modes.
smart-yank)) ; Yank behavior depend on mode.
(add-hook 'clojure-mode-hook #'parinfer-mode)
(add-hook 'emacs-lisp-mode-hook #'parinfer-mode)
(add-hook 'common-lisp-mode-hook #'parinfer-mode)
(add-hook 'scheme-mode-hook #'parinfer-mode)
(add-hook 'lisp-mode-hook #'parinfer-mode)))
(use-package enh-ruby-mode
:ensure t
:init
(add-hook 'ruby-mode-hook 'enh-ruby-mode))
(use-package vue-mode :ensure t)
This theme is as cool as it sounds
(use-package cyberpunk-theme
:ensure t
:defer t
:init
(load-theme 'cyberpunk t))
Tweak modline with smart-mode-line package
(use-package smart-mode-line
:ensure t
:defer t
:config
:init
(setq sml/theme 'respectful)
(sml/setup))