My full Emacs configuration consists of multiple packages and a few thousand lines of elisp code. The whole thing is then synchronized between my development machines so that I have a common environment to work in.
This setup works well enough, but it's a little heavyweight. For machines that don't require the full configuration - such as a Raspberry Pi - I use a much more streamlined setup. This version strips away some graphical elements I don't use, puts backup files in a single location, and sets up packages that I use every day.
The packages I use most frequently are:
- use-package - For cleaner configuration files.
- no-littering - For keeping my
~/.emacs.d/
tidy. - helm - For faster navigation.
;; Turn off menu bar, tool bar, and scroll bar. (if (fboundp 'menu-bar-mode) (menu-bar-mode -1)) (if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) ;; Turn off the splash screen. (setq inhibit-startup-message t) ;; Set path to .emacs.d (setq dotfiles-dir (file-name-directory (or (buffer-file-name) load-file-name))) ;; Don't use tabs for indentation. (setq-default indent-tabs-mode nil) (setq-default tab-width 4) ;; Enable upcase/downcase region. (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) ;; Store backup files under ~/.emacs.d/backups (setq backup-directory-alist `(("." . ,(expand-file-name (concat dotfiles-dir "backups"))))) ;; Maximize window when frame opens. (add-to-list 'default-frame-alist '(fullscreen . maximized)) (require 'use-package)
I use helm
for finding files, switching buffers, and running commands with
M-x
. The configuration looks like this:
;; ------------------------------------------------- ;; -- Helm - automatic completion buffers. (use-package helm :diminish helm-mode :init (require 'helm-config) (customize-set-variable 'helm-ff-lynx-style-map t) (customize-set-variable 'helm-imenu-lynx-style-map t) (customize-set-variable 'helm-semantic-lynx-style-map t) (customize-set-variable 'helm-occur-use-ioccur-style-keys t) (helm-mode 1) :config (add-to-list 'helm-completing-read-handlers-alist '(switch-to-buffer . ido)) :bind (("C-c h" . helm-mini) ("M-x" . helm-M-x) ("C-x C-f" . helm-find-files) ("C-x b" . helm-buffers-list)) :custom (helm-candidate-number-limit 100) (helm-idle-delay 0.0) (helm-input-idle-delay 0.01) (helm-quick-update t) (helm-M-x-requires-pattern nil) (helm-ff-skip-boring-files t))
If I'm doing any kind of programming work I'll want magit and projectile
installed too. I use the defaults for magit
, and my projectile
configuration
is also pretty slim:
;; ------------------------------------------------- ;; -- Projectile - project navigation (use-package projectile :diminish projectile-mode :config (projectile-mode) :custom (projectile-keymap-prefix (kbd "C-c p")) (projectile-enable-caching t) (projectile-completion-system 'default)) (use-package helm-projectile :init (helm-projectile-on))
Finally there are some key bindings that I like:
;; Disable C+z closing because I'm too clumsy. (global-set-key "\C-z" #'ignore) ;; Use M-` to switch between frames. (global-set-key "\M-`" #'other-frame) ;; Jump to a line number. (global-set-key "\C-x\C-l" #'goto-line)