diff --git a/emacs/.emacs.d/.gitignore b/emacs/.emacs.d/.gitignore index 51ff89c..d3adaa1 100644 --- a/emacs/.emacs.d/.gitignore +++ b/emacs/.emacs.d/.gitignore @@ -1,8 +1,3 @@ -history -ac-comphist.dat -elpa -auto-save-list -projectile-bookmarks.eld -quelpa -recentf -custom.el +* +!init.el +!custom.el diff --git a/emacs/.emacs.d/custom.el b/emacs/.emacs.d/custom.el new file mode 100644 index 0000000..0c63658 --- /dev/null +++ b/emacs/.emacs.d/custom.el @@ -0,0 +1,14 @@ +(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. + '(custom-safe-themes + (quote + ("196cc00960232cfc7e74f4e95a94a5977cb16fd28ba7282195338f68c84058ec" default)))) +(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. + ) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 628914e..22cdaac 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -125,6 +125,7 @@ :ensure :config (progn (projectile-global-mode) + (setq projectile-switch-project-action 'projectile-dired) )) (use-package helm @@ -149,6 +150,12 @@ (setq helm-quick-update t) (setq helm-bookmark-show-location t) (setq helm-buffers-fuzzy-matching t) + (defun smart-for-files () + "Call `helm-projectile' if `projectile-project-p', otherwise fallback to `helm-for-files'." + (interactive) + (if (projectile-project-p) + (helm-projectile) + (helm-for-files))) ;;; Save current position to mark ring (add-hook 'helm-goto-line-before-hook 'helm-save-current-pos-to-mark-ring) @@ -159,6 +166,7 @@ ;;; Keyboard mappings (global-set-key (kbd "M-y") 'helm-show-kill-ring) (global-set-key (kbd "C-x b") 'helm-mini) + (global-set-key (kbd "C-x p") 'smart-for-files) (global-set-key (kbd "C-x C-f") 'helm-find-files) (global-set-key (kbd "C-h SPC") 'helm-all-mark-rings) (global-set-key (kbd "C-c h o") 'helm-occur) @@ -187,9 +195,9 @@ (define-key evil-visual-state-map "Q" 'call-last-kbd-macro) ;;; Evil helm ;; (define-key evil-normal-state-map (kbd "C-p") 'helm-mini) - (evil-leader/set-key "p" 'helm-mini) + (evil-leader/set-key "p" 'smart-for-files) (evil-leader/set-key "" 'helm-M-x) - (define-key evil-normal-state-map (kbd ",f") 'helm-swoop) + (define-key evil-normal-state-map (kbd ",s") 'helm-swoop) (define-key evil-normal-state-map (kbd ",a") 'helm-ag) (define-key evil-normal-state-map (kbd ",y") 'helm-show-kill-ring) @@ -286,7 +294,7 @@ "';'.join(get_ipython().Completer.all_completions('''%s'''))\n") (add-hook 'python-mode-hook 'auto-complete-mode) - ;; (add-hook 'python-mode-hook '(lambda () (require 'nose))) + (add-hook 'python-mode-hook '(lambda () (require 'nose))) (eval-after-load "python" '(progn @@ -306,11 +314,11 @@ (use-package org :ensure t :config (progn - (use-package evil-org :ensure t) + ;; (use-package evil-org :ensure t) (define-key global-map "\C-cl" 'org-store-link) (define-key global-map "\C-ca" 'org-agenda) (evil-leader/set-key "a" 'org-agenda) - (evil-org-mode) + ;; (evil-org-mode) (setq org-log-done t) @@ -377,18 +385,19 @@ ) ) -(use-package paredit - :diminish paredit-mode +(use-package smartparens + :diminish smartparens-mode :init :config (progn (use-package evil-paredit - (add-hook 'clojure-mode-hook 'enable-paredit-mode) - (add-hook 'cider-repl-mode-hook 'enable-paredit-mode) - (add-hook 'lisp-mode-hook 'enable-paredit-mode) - (add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode) - (add-hook 'lisp-interaction-mode-hook 'enable-paredit-mode) - (add-hook 'ielm-mode-hook 'enable-paredit-mode) - (add-hook 'json-mode-hook 'enable-paredit-mode) + (use-package evil-smartparens + :ensure) + (add-hook 'clojure-mode-hook 'smartparens-mode) + (add-hook 'cider-repl-mode-hook 'evil-smartparens-mode-mode) + (add-hook 'lisp-mode-hook 'evil-smartparens-mode-mode) + (add-hook 'emacs-lisp-mode-hook 'evil-smartparens-mode-mode) + (add-hook 'lisp-interaction-mode-hook 'evil-smartparens-mode-mode) + (add-hook 'ielm-mode-hook 'evil-smartparens-mode-mode) :ensure ) ) @@ -438,8 +447,15 @@ (savehist-mode 1) (show-paren-mode t) (column-number-mode) +(when (fboundp 'winner-mode) + (winner-mode 1)) +;;; Other key bindings +(define-key global-map "\C-ch" 'winner-undo) +(define-key global-map "\C-cl" 'winner-redo) + + ;; set a default font (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10")) ;; emacs doesn't actually save undo history with revert-buffer