Browse Source

Simplify

master
10sr 5 years ago
parent
commit
b7a42d8a53
Signed by: 10sr GPG Key ID: 7BEC428194130EB2
1 changed files with 32 additions and 29 deletions
  1. +32
    -29
      emacs.el

+ 32
- 29
emacs.el View File

@@ -734,43 +734,46 @@ found, otherwise returns nil."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; file handling ;; file handling


(when (and (autoload-eval-lazily 'fzf)
(executable-find "fzf"))
;; Too slow!
;; (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 (..)
(let* ((find (if (executable-find "bfs")
;; Breadth-first find https://github.com/tavianator/bfs
"bfs"
"find"))
(defcmd (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-")))
(setenv "FZF_DEFAULT_COMMAND" defcmd))
(set-variable 'fzf/window-height 45)
)
;; fzf
;; Too slow!
;; (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 (..)
(let* ((find (if (executable-find "bfs")
;; Breadth-first find https://github.com/tavianator/bfs
"bfs"
"find"))
(defcmd (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-")))
(setenv "FZF_DEFAULT_COMMAND" defcmd))
(set-variable 'fzf/window-height 45)
(defun my-fzf-or-find-file () (defun my-fzf-or-find-file ()
"Call fzf if usable or call find-file." "Call fzf if usable or call find-file."
(declare (interactive-only t)) (declare (interactive-only t))
(interactive) (interactive)
(if (and (fboundp 'fzf)
(if (and (executable-find "fzf")
(fboundp 'fzf)
(not (file-remote-p default-directory))) (not (file-remote-p default-directory)))
(fzf) (fzf)
(call-interactively 'find-file))) (call-interactively 'find-file)))
(define-key ctl-x-map (kbd "f") 'my-fzf-or-find-file) (define-key ctl-x-map (kbd "f") 'my-fzf-or-find-file)


;; recently

(when (safe-require-or-eval 'recently) (when (safe-require-or-eval 'recently)
(recently-mode 1)) (recently-mode 1))


@@ -1632,8 +1635,8 @@ ARG is num to show, or defaults to 7."
(define-key dired-mode-map "e" 'wdired-change-to-wdired-mode) (define-key dired-mode-map "e" 'wdired-change-to-wdired-mode)
(define-key dired-mode-map "i" 'dired-get-file-info) (define-key dired-mode-map "i" 'dired-get-file-info)
;; (define-key dired-mode-map "f" 'find-file) ;; (define-key dired-mode-map "f" 'find-file)
;; (define-key dired-mode-map "z" 'fzf)
(define-key dired-mode-map "f" 'my-fzf-or-find-file) (define-key dired-mode-map "f" 'my-fzf-or-find-file)
(define-key dired-mode-map "z" 'fzf)
(define-key dired-mode-map "!" 'shell-command) (define-key dired-mode-map "!" 'shell-command)
(define-key dired-mode-map "&" 'async-shell-command) (define-key dired-mode-map "&" 'async-shell-command)
(define-key dired-mode-map "X" 'dired-do-async-shell-command) (define-key dired-mode-map "X" 'dired-do-async-shell-command)


Loading…
Cancel
Save