Skip to content

Instantly share code, notes, and snippets.

@kliph
Created June 20, 2016 14:23
Show Gist options
  • Save kliph/7e325ed7d0f94f8415ab0acddc3971c9 to your computer and use it in GitHub Desktop.
Save kliph/7e325ed7d0f94f8415ab0acddc3971c9 to your computer and use it in GitHub Desktop.
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
;; "y or n" instead of "yes or no"
(defalias 'yes-or-no-p 'y-or-n-p)
;; M-x git to show `magit-status'
(defalias 'git 'magit-status)
;; Use `ibuffer' instead of the default buffer `list-buffers' interface
(global-set-key (kbd "C-x C-b") 'ibuffer)
;; Use ido-mode and a vertical layout for handy buffer switching.
;; Sourced from
;; https://lorefnon.me/2014/02/02/configuring-emacs-for-rails.html ,
;; which as it turns out, is a great resource for setting emacs up to
;; work on Rails projects.
;; NOTE: You'll need to M-x `customize-group' `ido' and set Ido Mode
;; to `both' to enable `ido-mode' for both file and buffer switching.
(require 'ido)
(setq ido-decorations (quote ("\n-> " "" "\n " "\n ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]")))
(defun ido-disable-line-truncation () (set (make-local-variable 'truncate-lines) nil))
(add-hook 'ido-minibuffer-setup-hook 'ido-disable-line-truncation)
(defun ido-define-keys () ;; C-n/p is more intuitive in vertical layout
(define-key ido-completion-map (kbd "C-n") 'ido-next-match)
(define-key ido-completion-map (kbd "C-p") 'ido-prev-match))
(add-hook 'ido-setup-hook 'ido-define-keys)
;; Setup `flx-ido' for fuzzy file and buffer finding. Kind of like C-p in `vim'
(require 'flx-ido)
(flx-ido-mode 1)
(setq ido-enable-flex-matching t)
;; And if you want to use `ido' to browse directories with dired (who
;; doesn't?), you'll need to set this:
(setq ido-show-dot-for-dired t)
;; Let's try using `projectile'!
;; See: https://lorefnon.me/2014/02/02/configuring-emacs-for-rails.html
(projectile-global-mode)
(global-set-key (kbd "C-c C-p f") 'projectile-find-file)
(global-set-key (kbd "C-c C-p C-f") 'projectile-find-file)
;; BELOW HERE BE DRAGONS
(custom-set-variables
;; 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.
'(css-indent-offset 2)
'(custom-safe-themes
(quote
("8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default)))
'(ido-mode (quote both) nil (ido))
'(indent-tabs-mode nil)
'(js-indent-level 2)
'(ruby-insert-encoding-magic-comment nil)
'(visible-bell nil))
(custom-set-faces
;; 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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment