ソースを参照

Remove fzf configurations in favor of my fuzzy-finder

master
10sr 4年前
コミット
3b91bd63be
署名者: 10sr GPGキーID: 7BEC428194130EB2
1個のファイルの変更0行の追加112行の削除
  1. +0
    -112
      emacs.el

+ 0
- 112
emacs.el ファイルの表示

@@ -1094,118 +1094,6 @@ THEM are function and its args."

(auto-insert-mode 1)

;; fzf

;; Too slow in term buffer!
;; (set-variable 'fzf/executable "sk")
;; (set-variable 'fzf/args "--color bw --print-query")
;; Modified from hardcoded default to include:
;; - directories
;; - hidden files
;; - root directory (.)
;; - parent directory (..)
;; ripgrep cannot list directories...
;; (setenv "FZF_DEFAULT_COMMAND" "rg --files --hidden --follow --glob '!.git/*' --no-ignore")
(defvar my-fzf-default-command nil
"My fzf FZF_DEFAULT_COMMAND.")
(set-variable 'my-fzf-default-command
(let ((find (or (executable-find "bfs") ;; Breadth-first find https://github.com/tavianator/bfs
;; Use gfind if available?
"find"))
(fd (or (executable-find "fdfind")
(executable-find "fd"))))
(if fd
(concat "set -eu; set -o pipefail; "
"echo .; "
"echo ..; "
"command " fd " "
"--follow --hidden --no-ignore "
"--color always "
"2>/dev/null")
(concat "set -eu; set -o pipefail; "
"echo .; "
"echo ..; "
"command " find " -L . "
"-mindepth 1 "
"\\( -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune "
"-o -print "
"2> /dev/null "
"| "
"cut -b3-"))))
(set-variable 'fzf/window-height 45)
(set-variable 'fzf/args "--print-query --ansi --color='bg+:-1' --inline-info --cycle")
;; (set-variable 'fzf/args "--print-query --ansi --inline-info --cycle")
;; (set-variable 'fzf/args "--print-query --ansi --color=bw --inline-info --cycle")

(declare-function fzf "fzf" t)
(defun my-fzf-or-find-file ()
"Call fzf if usable or call `find-file'."
(declare (interactive-only t))
(interactive)
(if (and (executable-find "fzf")
(fboundp 'fzf)
(not (file-remote-p default-directory)))
(let ((process-environment (cl-copy-list process-environment)))
(setenv "FZF_DEFAULT_COMMAND" my-fzf-default-command)
(my-fzf))
(call-interactively 'find-file)))

(defvar fzf/position-bottom)
(declare-function fzf/start "fzf")
(declare-function term-reset-size "term")
(defun my-fzf ()
"Invoke `fzf' with my configurations."
(require 'fzf)
(let ((dir (or (ignore-errors
(require 'projectile)
(projectile-project-root))
default-directory)))
(set-variable 'fzf/window-height 12)
(set-variable 'fzf/args
(concat ;; "--print-query "
"--ansi "
"--color='bg+:-1' "
"--inline-info "
"--cycle "
;; TODO: fix
"--reverse "
;; "--print0 "
(format "--prompt='[%s]> ' "
dir)))
(fzf/start dir)
(let* ((buf (or (get-buffer "*fzf*")
(error "FZF buffer not found")))
(current-window (or (get-buffer-window buf)
(error "FZF window not found")))
(height (window-height current-window))
(root-window nil)
(new-window nil))
(with-current-buffer buf
(setq mode-line-format nil))
(jump-to-register :fzf-windows)
;; (delete-window current-window)
(setq root-window (frame-root-window))
(setq new-window (split-window root-window
(- height)
'below))
(select-window new-window)
(switch-to-buffer buf)
(term-reset-size (window-height)
(window-width))
)))

;; (define-key ctl-x-map "f" 'my-fzf-or-find-file)

(defun my-fzf-all-lines ()
"Fzf all lines."
(interactive)
(unless (executable-find "rg")
(error "rg not found"))
(let ((process-environment (cl-copy-list process-environment)))
(setenv "FZF_DEFAULT_COMMAND" "rg -nH --no-heading --hidden --follow --glob '!.git/*' --color=always ^")
(fzf)))
;; (define-key ctl-x-map "S" 'my-fzf-all-lines)

;; fuzzy-finder

(set-variable 'fuzzy-finder-default-command


読み込み中…
キャンセル
保存