Finding Files


One important note about projectile and flx: their matching is aggressive. This is a nice feature most of the time, except when you want to open a new file. They'll eagerly find you some file–any file–that matches the name you're trying to enter. So, to turn this off temporarily press: C-f.

(require-package 'f) ;; undeclared dependency?
(require-package 'projectile)


(global-set-key   (kbd "C-x f") 'projectile-find-file)

(global-unset-key (kbd "<f4>"))
(global-set-key   (kbd "<f4>") 'projectile-find-file)

(def-projectile-commander-method ?j
  (let* ((opts (projectile-current-project-files))
         (file (ido-completing-read
                "Find file: "
                nil nil nil nil
                (car (cl-member-if
                      (lambda (f)
                        (string-match "core\\.clj\\'" f))
    (find-file (expand-file-name
                file (projectile-project-root)))
    (run-hooks 'projectile-find-file-hook)

The default mode-line “lighter” for Projectile Mode is:

  (format " Projectile[%s]" (projectile-project-name)))

That's a bit much for me; I like things minimal. So, I reset it to be blank:

(setq projectile-mode-line nil)

Fuzzy Matching of File and Command Names

Fuzzy matching is brought in with the flx package.

(require-package 'flx-ido)
(require 'flx-ido)

(ido-mode 1)
(ido-everywhere 1)
(flx-ido-mode 1)

(setq ido-enable-flex-matching t)
(setq ido-use-faces t)

SMEX shows recently used commands on the M-x prompt:

Smex is a M-x enhancement for Emacs. Built on top of Ido, it provides a convenient interface to your recently and most frequently used commands. And to all the other commands, too.

(require-package 'smex)

(setq smex-save-file (concat user-emacs-directory ".smex-items"))
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "C-c x") 'smex-major-mode-commands)

Open Recent Files

Enable “Open Recent” and give it a keybinding:

(recentf-mode 1)
(global-set-key (kbd "C-c f") 'recentf-open-files)

Author: Toby Tripp

Created: 2018-03-04 Sun 00:37