Skip to content

Instantly share code, notes, and snippets.

@mattjbarlow
Created September 8, 2014 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattjbarlow/0ae810aa572827e5f25c to your computer and use it in GitHub Desktop.
Save mattjbarlow/0ae810aa572827e5f25c to your computer and use it in GitHub Desktop.
.emacs for Chef users
;;; set EDITOR to emacsclient so that knife commands open in your Emacs session.
(server-start)
;;; You should have tons of buffers, ibuffer makes them easy to manage.
(require 'ibuffer)
;;; For editing markdwon files
(require 'markdown-mode)
;;; For heat and other templates
(require 'yaml-mode)
;;; Setup a workgroup for Chef. Split windows with test specs and recipes and shell.
(require 'workgroups)
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(workgroups-mode 1)
(wg-load "~/.emacs.d/workgroups")
(setq wg-mode-line-on nil)
(setq wg-morph-on nil)
(setq wg-no-confirm t)
(setq wg-use-faces nil)
(setq wg-switch-on-load nil)
;;; When windows pop up to provide output, just hit C-c C-l to go back
;;; to previous config.
(winner-mode 1)
(global-set-key (kbd "C-c C-l") 'winner-redo)
(global-set-key (kbd "C-c C-h") 'winner-undo)
(require 'ido)
;;; More windows management settings.
(global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-<down>") 'shrink-window)
(global-set-key (kbd "S-C-<up>") 'enlarge-window)
;;; Useful to make sure you are not going over 80 columns.
(setq column-number-mode 1)
;;; Make emacs cleaner
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;;; Never lose your buffers.
(desktop-save-mode 1)
(setq desktop-restore-frames nil)
(setq desktop-path '("~/"))
(setq desktop-dirname "~/")
(setq desktop-base-file-name "emacs-desktop")
;;; Put all your backups in one location instead of littering the filesystem.
(setq backup-directory-alist `(("." . "~/.saves")))
(setq backup-by-copying t)
(setq delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
;;;
;;; ido settings
;;;
(setq ido-everywhere t)
(ido-mode 1)
;; Run this when working on recipes and other ruby files to get instant feedback.
(defun rsyntax ()
(interactive)
(compile (format "ruby -c %s" (buffer-file-name))))
;;;
;;; ibuffer settings
;;;
(global-set-key (kbd "C-x C-b") 'ibuffer-other-window)
;;; Hotkey to switch buffers without a modifier.
(global-set-key (kbd "<f1>") 'ido-switch-buffer)
;;; Organize your buffers.
(setq ibuffer-saved-filter-groups
(quote (("default"
("ruby" (mode . ruby-mode))
("dired" (mode . dired-mode))
("emacs" (or
(name . "^\\*scratch\\*$")
(name . "^\\*Messages\\*$")))))))
;;; Super important, since you have lots of files open with same names.
;;; This will make sure they are easily discernable by providing abs path.
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment