Last active
December 12, 2015 09:19
-
-
Save jaydonnell/4750333 to your computer and use it in GitHub Desktop.
.emacs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(if window-system | |
(tool-bar-mode -1)) | |
(load-theme 'deeper-blue t) | |
(set-face-attribute 'default nil :height 140) | |
(require 'package) | |
(package-initialize) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/")) | |
(require 'ido) | |
(ido-mode t) | |
(setq ido-enable-prefix nil | |
ido-enable-flex-matching t | |
ido-auto-merge-work-directories-length nil | |
ido-create-new-buffer 'always | |
ido-use-filename-at-point 'guess | |
ido-use-virtual-buffers t | |
ido-handle-duplicate-virtual-buffers 2 | |
ido-max-prospects 10) | |
;; Display ido results vertically, rather than horizontally | |
(setq ido-decorations (quote ("\n-> " "" "\n " "\n ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))) | |
(defun ido-disable-line-trucation () (set (make-local-variable 'truncate-lines) nil)) | |
(add-hook 'ido-minibuffer-setup-hook 'ido-disable-line-trucation) | |
(require 'smex) | |
(smex-initialize) | |
(require 'anything) | |
(require 'anything-match-plugin) | |
(require 'anything-config) | |
(setq recentf-max-saved-items 500) | |
(defun anything-c-sources-git-project-for (pwd) | |
(loop for elt in | |
'(("Modified files (%s)" . "--modified") | |
("Untracked files (%s)" . "--others --exclude-standard") | |
("All controlled files in this project (%s)" . "")) | |
collect | |
`((name . ,(format (car elt) pwd)) | |
(init . (lambda () | |
(unless (and ,(string= (cdr elt) "") ;update candidate buffer every time except for that of all project files | |
(anything-candidate-buffer)) | |
(with-current-buffer | |
(anything-candidate-buffer 'global) | |
(insert | |
(shell-command-to-string | |
,(format "git ls-files $(git rev-parse --show-cdup) %s" | |
(cdr elt)))))))) | |
(candidates-in-buffer) | |
(type . file)))) | |
(defun anything-git-project () | |
(interactive) | |
(let* ((pwd (shell-command-to-string "echo -n `pwd`")) | |
(sources (anything-c-sources-git-project-for pwd))) | |
(anything-other-buffer sources | |
(format "*Anything git project in %s*" pwd)))) | |
(global-set-key (kbd "s-j") 'find-file) | |
(global-set-key (kbd "s-0") 'delete-window) | |
(global-set-key (kbd "s-d") 'anything) | |
(global-set-key (kbd "s-1") 'delete-other-windows) | |
(global-set-key (kbd "s-2") 'split-window-vertically) | |
(global-set-key (kbd "s-3") 'split-window-horizontally) | |
(global-set-key (kbd "s-i") 'hippie-expand) | |
(global-set-key (kbd "s-/") 'comment-region) | |
(global-set-key (kbd "s-o") 'other-window) | |
;;(global-set-key (kbd "A-f") 'ido-find-file) | |
(global-set-key (kbd "s-k") 'ido-kill-buffer) | |
(global-set-key (kbd "M-x") 'smex) | |
(global-set-key (kbd "s-r") 'eval-last-sexp) | |
(global-set-key (kbd "M-X") 'smex-major-mode-commands) | |
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command) | |
(global-set-key (kbd "s-<up>") 'beginning-of-buffer) | |
(global-set-key (kbd "s-<down>") 'end-of-buffer) | |
(global-set-key (kbd "s-<right>") 'end-of-line) | |
(global-set-key (kbd "s-<left>") 'beginning-of-line) | |
(global-set-key (kbd "M-n") 'anything-git-project) | |
(defun kill-other-buffers () | |
"Kill all other buffers." | |
(interactive) | |
(mapc 'kill-buffer | |
(delq (current-buffer) | |
(remove-if-not 'buffer-file-name (buffer-list))))) | |
(setenv "PATH" (concat "/usr/local/bin" path-separator (getenv "PATH"))) | |
(setq exec-path (append exec-path '("/usr/local/bin"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment