1
0
mirror of https://github.com/balkian/dotfiles.git synced 2024-11-21 19:52:29 +00:00

More emacs

This commit is contained in:
J. Fernando Sánchez 2016-01-07 12:59:23 +01:00
parent 90d6b9aad9
commit 18af6196b3
3 changed files with 47 additions and 22 deletions

View File

@ -1,8 +1,3 @@
history *
ac-comphist.dat !init.el
elpa !custom.el
auto-save-list
projectile-bookmarks.eld
quelpa
recentf
custom.el

14
emacs/.emacs.d/custom.el Normal file
View File

@ -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.
)

View File

@ -125,6 +125,7 @@
:ensure :ensure
:config (progn :config (progn
(projectile-global-mode) (projectile-global-mode)
(setq projectile-switch-project-action 'projectile-dired)
)) ))
(use-package helm (use-package helm
@ -149,6 +150,12 @@
(setq helm-quick-update t) (setq helm-quick-update t)
(setq helm-bookmark-show-location t) (setq helm-bookmark-show-location t)
(setq helm-buffers-fuzzy-matching 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 ;;; Save current position to mark ring
(add-hook 'helm-goto-line-before-hook 'helm-save-current-pos-to-mark-ring) (add-hook 'helm-goto-line-before-hook 'helm-save-current-pos-to-mark-ring)
@ -159,6 +166,7 @@
;;; Keyboard mappings ;;; Keyboard mappings
(global-set-key (kbd "M-y") 'helm-show-kill-ring) (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 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-x C-f") 'helm-find-files)
(global-set-key (kbd "C-h SPC") 'helm-all-mark-rings) (global-set-key (kbd "C-h SPC") 'helm-all-mark-rings)
(global-set-key (kbd "C-c h o") 'helm-occur) (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) (define-key evil-visual-state-map "Q" 'call-last-kbd-macro)
;;; Evil helm ;;; Evil helm
;; (define-key evil-normal-state-map (kbd "C-p") 'helm-mini) ;; (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 "<SPC>" 'helm-M-x) (evil-leader/set-key "<SPC>" '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 ",a") 'helm-ag)
(define-key evil-normal-state-map (kbd ",y") 'helm-show-kill-ring) (define-key evil-normal-state-map (kbd ",y") 'helm-show-kill-ring)
@ -286,7 +294,7 @@
"';'.join(get_ipython().Completer.all_completions('''%s'''))\n") "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
(add-hook 'python-mode-hook 'auto-complete-mode) (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" (eval-after-load "python"
'(progn '(progn
@ -306,11 +314,11 @@
(use-package org (use-package org
:ensure t :ensure t
:config (progn :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-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda) (define-key global-map "\C-ca" 'org-agenda)
(evil-leader/set-key "a" 'org-agenda) (evil-leader/set-key "a" 'org-agenda)
(evil-org-mode) ;; (evil-org-mode)
(setq org-log-done t) (setq org-log-done t)
@ -377,18 +385,19 @@
) )
) )
(use-package paredit (use-package smartparens
:diminish paredit-mode :diminish smartparens-mode
:init :init
:config (progn :config (progn
(use-package evil-paredit (use-package evil-paredit
(add-hook 'clojure-mode-hook 'enable-paredit-mode) (use-package evil-smartparens
(add-hook 'cider-repl-mode-hook 'enable-paredit-mode) :ensure)
(add-hook 'lisp-mode-hook 'enable-paredit-mode) (add-hook 'clojure-mode-hook 'smartparens-mode)
(add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode) (add-hook 'cider-repl-mode-hook 'evil-smartparens-mode-mode)
(add-hook 'lisp-interaction-mode-hook 'enable-paredit-mode) (add-hook 'lisp-mode-hook 'evil-smartparens-mode-mode)
(add-hook 'ielm-mode-hook 'enable-paredit-mode) (add-hook 'emacs-lisp-mode-hook 'evil-smartparens-mode-mode)
(add-hook 'json-mode-hook 'enable-paredit-mode) (add-hook 'lisp-interaction-mode-hook 'evil-smartparens-mode-mode)
(add-hook 'ielm-mode-hook 'evil-smartparens-mode-mode)
:ensure :ensure
) )
) )
@ -438,8 +447,15 @@
(savehist-mode 1) (savehist-mode 1)
(show-paren-mode t) (show-paren-mode t)
(column-number-mode) (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 ;; set a default font
(add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10")) (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10"))
;; emacs doesn't actually save undo history with revert-buffer ;; emacs doesn't actually save undo history with revert-buffer