Last active
November 15, 2018 08:45
-
-
Save tek-nishi/45580226be67f1604d7587567f89edfa to your computer and use it in GitHub Desktop.
work around dumb-jump with git grep
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
;; FIXME:git grepが日本語を含むパスを検索できないのためのwork around | |
;; 外部コマンド実行時にcdで検索パスを決めるようにした | |
(defun dumb-jump-generate-git-grep-command (look-for cur-file proj regexes lang exclude-paths) | |
"Generate the git grep response based on the needle LOOK-FOR in the directory PROJ." | |
(let* ((filled-regexes (dumb-jump-populate-regexes look-for regexes 'git-grep)) | |
(ggtypes (when (f-ext cur-file) (dumb-jump-get-git-grep-type-by-language lang))) | |
(cmd (concat "cd " | |
proj | |
";" | |
dumb-jump-git-grep-cmd | |
" --color=never --line-number" | |
(if dumb-jump-git-grep-search-untracked | |
" --untracked" | |
"") | |
" -E")) | |
(fileexps (s-join " " (--map (format "\"*.%s\"" it) ggtypes))) | |
(exclude-args (s-join " " | |
(--map (shell-quote-argument (concat ":(exclude)" it)) | |
exclude-paths))) | |
(regex-args (shell-quote-argument (s-join "|" filled-regexes)))) | |
(if (= (length regexes) 0) | |
"" | |
(dumb-jump-concat-command cmd regex-args "--" fileexps exclude-args)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment