mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-31 14:43:40 -05:00
Help! I'm trapped in emacs!
This commit is contained in:
@@ -2,98 +2,14 @@
|
||||
:config
|
||||
(progn ; helm settings
|
||||
(defvar helm-global-prompt ">>> ")
|
||||
|
||||
(setq helm-quick-update t
|
||||
helm-idle-delay 0.01
|
||||
helm-input-idle-delay 0.01
|
||||
helm-reuse-last-window-split-state t
|
||||
helm-buffers-fuzzy-matching nil
|
||||
helm-candidate-number-limit 40
|
||||
helm-bookmark-show-location t)
|
||||
|
||||
(my--cleanup-buffers-add "^\\*[Hh]elm.*\\*$")
|
||||
|
||||
;; disable popwin-mode in an active Helm session It should be disabled
|
||||
;; otherwise it will conflict with other window opened by Helm persistent
|
||||
;; action, such as *Help* window.
|
||||
(add-hook! 'helm-after-initialize-hook (popwin-mode -1))
|
||||
|
||||
;; Restore popwin-mode after a Helm session finishes.
|
||||
(add-hook! 'helm-cleanup-hook (popwin-mode 1))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(use-package helm-ag
|
||||
: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 bang search)
|
||||
:type inclusive
|
||||
:repeat nil
|
||||
(interactive "<r><!><a>")
|
||||
(my:helm-ag-search beg end search bang nil t))
|
||||
|
||||
;; Ex-mode interface for `helm-do-ag'. If `bang', then `search' is interpreted
|
||||
;; as regexp
|
||||
(evil-define-operator my:helm-ag-search-cwd (beg end &optional search bang)
|
||||
: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-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 (my:helm-swoop helm-swoop helm-multi-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))))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(after "winner"
|
||||
;; Tell winner-mode to ignore helm buffers
|
||||
(dolist (bufname '("*helm recentf*"
|
||||
@@ -106,48 +22,109 @@
|
||||
"*Helm Swoop*"))
|
||||
(push bufname winner-boring-buffers)))
|
||||
|
||||
(after "company"
|
||||
(use-package helm-company
|
||||
:config
|
||||
(defun helm-company ()
|
||||
(interactive)
|
||||
(unless company-candidates
|
||||
(company-complete))
|
||||
(when company-point
|
||||
(helm :sources 'helm-source-company
|
||||
:buffer "*helm company*"
|
||||
:prompt helm-global-prompt
|
||||
:candidate-number-limit helm-company-candidate-number-limit)))))
|
||||
(my--cleanup-buffers-add "^\\*[Hh]elm.*\\*$")
|
||||
|
||||
(after "projectile"
|
||||
(use-package helm-projectile
|
||||
:config
|
||||
(setq projectile-switch-project-action 'helm-projectile))
|
||||
(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))
|
||||
|
||||
;; Don't show the project name in the prompts; I already know.
|
||||
(defun projectile-prepend-project-name (string)
|
||||
(format helm-global-prompt string))
|
||||
;; 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)))
|
||||
|
||||
;; All this for a smaller prompt (it was redundant with helm headers)
|
||||
(defmacro helm-projectile-command (command source prompt)
|
||||
`(defun ,(intern (concat "helm-projectile-" command)) (&optional arg)
|
||||
(interactive "P")
|
||||
(if (projectile-project-p)
|
||||
(projectile-maybe-invalidate-cache arg))
|
||||
(let ((helm-ff-transformer-show-only-basename nil)
|
||||
;; for consistency, we should just let Projectile take care of ignored files
|
||||
(helm-boring-file-regexp-list nil))
|
||||
(helm :sources ,source
|
||||
:buffer "*helm projectile*"
|
||||
: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))
|
||||
|
||||
(helm-projectile-command "switch-project" 'helm-source-projectile-projects helm-global-prompt)
|
||||
(helm-projectile-command "find-file" helm-source-projectile-files-and-dired-list helm-global-prompt)
|
||||
(helm-projectile-command "find-file-in-known-projects" 'helm-source-projectile-files-in-all-projects-list helm-global-prompt)
|
||||
(helm-projectile-command "find-file-dwim" 'helm-source-projectile-files-dwim-list helm-global-prompt)
|
||||
(helm-projectile-command "find-dir" helm-source-projectile-directories-and-dired-list helm-global-prompt)
|
||||
(helm-projectile-command "recentf" 'helm-source-projectile-recentf-list helm-global-prompt)
|
||||
(helm-projectile-command "switch-to-buffer" 'helm-source-projectile-buffers-list helm-global-prompt))
|
||||
(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"))
|
||||
(use-package helm-projectile)
|
||||
|
||||
;; Don't show the project name in the prompts; I already know.
|
||||
(defun projectile-prepend-project-name (string) (format helm-global-prompt string))
|
||||
|
||||
;; All this for a smaller prompt (it was redundant with helm headers)
|
||||
(defmacro helm-projectile-command (command source prompt)
|
||||
`(defun ,(intern (concat "helm-projectile-" command)) (&optional arg)
|
||||
(interactive "P")
|
||||
(if (projectile-project-p)
|
||||
(projectile-maybe-invalidate-cache arg))
|
||||
(let ((helm-ff-transformer-show-only-basename nil)
|
||||
;; for consistency, we should just let Projectile take care of ignored files
|
||||
(helm-boring-file-regexp-list nil))
|
||||
(helm :sources ,source
|
||||
:buffer "*helm projectile*"
|
||||
:prompt helm-global-prompt))))
|
||||
|
||||
(helm-projectile-command "switch-project" 'helm-source-projectile-projects helm-global-prompt)
|
||||
(helm-projectile-command "find-file" helm-source-projectile-files-and-dired-list helm-global-prompt)
|
||||
(helm-projectile-command "find-file-in-known-projects" 'helm-source-projectile-files-in-all-projects-list helm-global-prompt)
|
||||
(helm-projectile-command "find-file-dwim" 'helm-source-projectile-files-dwim-list helm-global-prompt)
|
||||
(helm-projectile-command "find-dir" helm-source-projectile-directories-and-dired-list helm-global-prompt)
|
||||
(helm-projectile-command "recentf" 'helm-source-projectile-recentf-list helm-global-prompt)
|
||||
(helm-projectile-command "switch-to-buffer" 'helm-source-projectile-buffers-list helm-global-prompt)))
|
||||
|
||||
(progn ; helm hacks
|
||||
;; No persistent header
|
||||
@@ -182,10 +159,6 @@
|
||||
(propertize (concat " " hlstr hlend) 'face 'helm-header))))
|
||||
(when force (force-mode-line-update))))
|
||||
|
||||
(progn ; popwin
|
||||
(push '("^\\*helm.*\\*$" :position bottom :regexp t :height 18)
|
||||
popwin:special-display-config))
|
||||
|
||||
(progn ; evil
|
||||
(evil-set-initial-state 'helm-mode 'emacs)
|
||||
|
||||
|
Reference in New Issue
Block a user