Skip to content

Instantly share code, notes, and snippets.

@eightbitraptor
Created January 23, 2014 17:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eightbitraptor/8582810 to your computer and use it in GitHub Desktop.
Save eightbitraptor/8582810 to your computer and use it in GitHub Desktop.
;; Remove Scroll bar and toolbar, leave the menu though, it can be useful
(toggle-scroll-bar -1)
(menu-bar-mode 1)
(tool-bar-mode 0)
;; Start in the Scratch buffer by default
(blink-cursor-mode 0)
(setq initial-scratch-message "")
(setq inhibit-startup-message t)
;; Set the font
(set-face-attribute 'default nil :font "Menlo-16")
;; Store emacs customisation system stuff in a seperate file
(setq custom-file "~/.emacs.d/customisations.el")
(load custom-file)
;; Set up package archives and bootstrap Pallet
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")
("Tromey" . "http://tromey.com/elpa/")))
;; Globally enable ido-mode and turn on fuzzy matching
(ido-mode t)
(setq ido-enable-flex-matching t)
;; Pull in $PATH and some other stuff from bash
(exec-path-from-shell-initialize)
;; Highlight Whitespace
(setq whitespace-style '(face tabs trailing))
(global-whitespace-mode t)
;; Turn off auto-saving - git handles this for me :)
(setq auto-save-default nil)
;; make mouse wheel scrolling smoother
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))
;; use y/n instead of yes/no to save typing at prompts
(fset 'yes-or-no-p 'y-or-n-p)
;; use Shift-Arrows to move between windows
(when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings))
;; Put backup files in the backup directory
(setq backup-directory-alist
(list (cons "." (expand-file-name "backup" user-emacs-directory))))
;; ido mode should ignore case
(setq ido-case-fold t)
;; F11 toggles Fullscreen mode
(global-set-key (kbd "<f9>") 'toggle-frame-fullscreen)
;; C-w kills word (like bash)
(global-set-key "\C-w" 'backward-kill-word)
;; M-x hurts my hands after a while
(global-set-key "\C-x\C-m" 'execute-extended-command)
(global-set-key "\C-c\C-m" 'execute-extended-command)
(global-set-key (kbd "<f2>") 'next-buffer)
(global-set-key (kbd "<f3>") 'previous-buffer)
(global-set-key (kbd "<f4>") 'kill-buffer-and-window)
;; Open line above like O in Vim
(defun open-line-above ()
"Open a line above the line the point is at. Then move to that line and indent according to mode"
(interactive)
(indent-according-to-mode)
(move-beginning-of-line 1)
(newline)
(previous-line)
(indent-according-to-mode))
(global-set-key (kbd "C-o") 'open-line-above)
;; Fixes whitespace transgressions
(defun clean-up-buffer-or-region ()
"Untabifies, indents and deletes trailing whitespace from buffer or region."
(interactive)
(save-excursion
(unless (region-active-p)
(mark-whole-buffer))
(untabify (region-beginning) (region-end))
(save-restriction
(narrow-to-region (region-beginning) (region-end))
(delete-trailing-whitespace))))
(global-set-key (kbd "C-c n") 'clean-up-buffer-or-region)
;; Sometimes I get confused - this cleans the world again
(defun kill-all-buffers ()
(interactive)
(loop for buf in (buffer-list)
do (kill-buffer buf)))
(add-hook 'ruby-mode-hook
(lambda () (run-hooks 'mph-ruby-mode-hook)))
(add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment