My name is Henrik and I'm an emacs addict. (Hello Henrik)

This commit is contained in:
Henrik Lissner
2015-05-20 22:28:41 -04:00
parent eafb74110f
commit 7d44ea4db4
50 changed files with 1154 additions and 2571 deletions

View File

@@ -1,4 +1,62 @@
(use-package projectile
:commands (projectile-ack
projectile-ag
projectile-compile-project
projectile-dired
projectile-grep
projectile-find-dir
projectile-find-file
projectile-find-tag
projectile-find-test-file
projectile-invalidate-cache
projectile-kill-buffers
projectile-multi-occur
projectile-project-root
projectile-recentf
projectile-regenerate-tags
projectile-replace
projectile-run-async-shell-command-in-root
projectile-run-shell-command-in-root
projectile-switch-project
projectile-switch-to-buffer
projectile-vc
projectile-project-p
helm-projectile-find-file
helm-projectile-recentf
helm-projectile-find-other-file
helm-projectile-switch-project)
:config
(progn
(setq-default projectile-enable-caching t)
(setq projectile-sort-order 'recentf
projectile-cache-file (concat my-tmp-dir "projectile.cache")
projectile-known-projects-file (concat my-tmp-dir "projectile.projects")
projectile-indexing-method 'alien
projectile-project-root-files project-root-files)
(add-to-list 'projectile-globally-ignored-files "ido.last")
(add-to-list 'projectile-globally-ignored-directories "assets")
(add-to-list 'projectile-other-file-alist '("scss" "css"))
(add-to-list 'projectile-other-file-alist '("css" "scss"))
(projectile-global-mode +1)
(use-package helm-projectile)
;; Don't show the project name in the prompts; I already know.
(defun projectile-prepend-project-name (string) helm-global-prompt)))
(use-package helm
:commands (helm
helm-M-x
helm-buffers-list
helm-semantic-or-imenu
helm-etags-select
helm-apropos
helm-recentf
helm-show-kill-ring
helm-bookmarks
helm-wg
my:helm-recentf)
:init
(evil-set-initial-state 'helm-mode 'emacs)
:config
(progn ; helm settings
(defvar helm-global-prompt ">>> ")
@@ -24,89 +82,7 @@
(my--cleanup-buffers-add "^\\*[Hh]elm.*\\*$")
(use-package helm-ag)
(use-package helm-css-scss ; https://github.com/ShingoFukuyama/helm-css-scss
:commands (helm-css-scss
helm-css-scss-multi
helm-css-scss-insert-close-comment))
(use-package helm-company :commands (helm-company))
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
;; regexp.
(evil-define-operator my:helm-ag-search (beg end &optional search hidden-files-p pwd-p regex-p)
:type inclusive
:repeat nil
(interactive "<r><a><!>")
(let* ((helm-ag-default-directory (if pwd-p default-directory (project-root)))
(helm-ag-command-option (concat (unless regex-p "-Q ")
(if hidden-files-p "--hidden ")))
(input "")
(header-name (format "Search in %s" helm-ag-default-directory)))
(if search
(progn
(helm-attrset 'search-this-file nil helm-ag-source)
(setq helm-ag--last-query search))
(if (and beg end (/= beg (1- end)))
(setq input (buffer-substring-no-properties beg end))))
(helm-attrset 'name header-name helm-ag-source)
(helm :sources (if search (helm-ag--select-source) '(helm-source-do-ag))
:buffer "*helm-ag*"
:input input
:prompt helm-global-prompt)))
(evil-define-operator my:helm-ag-regex-search (beg end &optional search bang)
:type inclusive :repeat nil
(interactive "<r><a><!>")
(my:helm-ag-search beg end search bang nil t))
(evil-define-operator my:helm-ag-search-cwd (beg end &optional search bang)
;; Ex-mode interface for `helm-do-ag'. If `bang', then `search' is interpreted
;; as regexp
:type inclusive :repeat nil
(interactive "<r><a><!>")
(my:helm-ag-search beg end search bang t nil))
(evil-define-operator my:helm-ag-regex-search-cwd (beg end &optional search bang)
:type inclusive :repeat nil
(interactive "<r><a><!>")
(my:helm-ag-search beg end search bang t t))
(use-package helm-swoop ; https://github.com/ShingoFukuyama/helm-swoop
:commands (helm-swoop helm-multi-swoop)
:config
(setq helm-swoop-use-line-number-face t
helm-swoop-split-with-multiple-windows t
helm-swoop-speed-or-color t
;; helm-swoop-split-window-function 'popwin:popup-buffer
))
;; Ex-mode interface for `helm-swoop', `helm-multi-swoop-all' (if `bang'), or
;; `helm-css-scss' and `helm-css-scss-multi' (if `bang') if major-mode is
;; `scss-mode'
(evil-define-command my:helm-swoop (&optional search bang)
:repeat nil
(interactive "<a><!>")
(if (eq major-mode 'scss-mode)
(if bang (helm-css-scss-multi search) (helm-css-scss search))
(if bang (helm-multi-swoop-all search) (helm-swoop :$query search))))
(use-package projectile
:init (setq-default projectile-enable-caching t)
:config
(progn
(projectile-global-mode +1)
(setq projectile-sort-order 'recentf
projectile-cache-file (concat my-tmp-dir "projectile.cache")
projectile-known-projects-file (concat my-tmp-dir "projectile.projects")
projectile-indexing-method 'alien)
(add-to-list 'projectile-globally-ignored-files "ido.last")
(add-to-list 'projectile-globally-ignored-directories "assets")
(add-to-list 'projectile-other-file-alist '("scss" "css"))
(add-to-list 'projectile-other-file-alist '("css" "scss"))
;; Don't show the project name in the prompts; I already know.
(defun projectile-prepend-project-name (string) helm-global-prompt)
(use-package helm-projectile)))
(require 'helm-files)
(progn ; helm hacks
;; No persistent header
@@ -142,8 +118,6 @@
(when force (force-mode-line-update))))
(progn ; evil
(evil-set-initial-state 'helm-mode 'emacs)
;; Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'. If
;; `bang', then `search' is interpreted as regexp
(evil-define-command my:helm-recentf (&optional bang)
@@ -157,6 +131,77 @@
"C-r" 'evil-ex-paste-from-register ; Evil registers in helm! Glorious!
[escape] 'helm-keyboard-quit)))
(use-package helm-ag
:commands (helm-ag
my:helm-ag-search
my:helm-ag-regex-search
my:helm-ag-search-cwd
my:helm-ag-regex-search-cwd)
:config
(progn
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
;; regexp.
(evil-define-operator my:helm-ag-search (beg end &optional search hidden-files-p pwd-p regex-p)
:type inclusive
:repeat nil
(interactive "<r><a><!>")
(let* ((helm-ag-default-directory (if pwd-p default-directory (project-root)))
(helm-ag-command-option (concat (unless regex-p "-Q ") (if hidden-files-p "--hidden ")))
(input "")
(header-name (format "Search in %s" helm-ag-default-directory)))
(if search
(progn
(helm-attrset 'search-this-file nil helm-ag-source)
(setq helm-ag--last-query search))
(if (and beg end (/= beg (1- end)))
(setq input (buffer-substring-no-properties beg end))))
(helm-attrset 'name header-name helm-ag-source)
(helm :sources (if search (helm-ag--select-source) '(helm-source-do-ag))
:buffer "*helm-ag*"
:input input
:prompt helm-global-prompt)))
(evil-define-operator my:helm-ag-regex-search (beg end &optional search bang)
:type inclusive :repeat nil
(interactive "<r><a><!>")
(my:helm-ag-search beg end search bang nil t))
(evil-define-operator my:helm-ag-search-cwd (beg end &optional search bang)
;; Ex-mode interface for `helm-do-ag'. If `bang', then `search' is interpreted
;; as regexp
:type inclusive :repeat nil
(interactive "<r><a><!>")
(my:helm-ag-search beg end search bang t nil))
(evil-define-operator my:helm-ag-regex-search-cwd (beg end &optional search bang)
:type inclusive :repeat nil
(interactive "<r><a><!>")
(my:helm-ag-search beg end search bang t t))))
(use-package helm-company :defer t)
(use-package helm-css-scss ; https://github.com/ShingoFukuyama/helm-css-scss
:commands (helm-css-scss
helm-css-scss-multi
helm-css-scss-insert-close-comment))
(use-package helm-swoop ; https://github.com/ShingoFukuyama/helm-swoop
:commands (helm-swoop helm-multi-swoop my:helm-swoop)
:config
(progn
(setq helm-swoop-use-line-number-face t
helm-swoop-split-with-multiple-windows t
helm-swoop-speed-or-color t
;; helm-swoop-split-window-function 'popwin:popup-buffer
)
;; Ex-mode interface for `helm-swoop', `helm-multi-swoop-all' (if `bang'), or
;; `helm-css-scss' and `helm-css-scss-multi' (if `bang') if major-mode is
;; `scss-mode'
(evil-define-command my:helm-swoop (&optional search bang)
:repeat nil
(interactive "<a><!>")
(if (eq major-mode 'scss-mode)
(if bang (helm-css-scss-multi search) (helm-css-scss search))
(if bang (helm-multi-swoop-all search) (helm-swoop :$query search))))))
(provide 'init-helm)
;;; init-helm.el ends here