Emacs navigation between files with same names

后端 未结 3 1622
刺人心
刺人心 2021-01-19 02:41

I\'ve long been a fan of GNU Emacs\' file navigation model. I\'ve been switching buffers with C-x C-f ..., C-x b; C-mouse-1 occasiona

3条回答
  •  时光取名叫无心
    2021-01-19 03:20

    Along with using uniquify to obtain more helpful buffer names, you might want to look into using ibuffer groups for your "spatial arrangement" needs. You can create named groups based on sets of filters, and you can filter on file path(*), so you could easily have separate groups for each of those directories.

    I highly recommend binding C-xC-b to ibuffer as a replacement for the default.

    Aside from that, if you use ido-mode in conjunction with the uniquify config, then when you type C-xb to switch buffers, you can type and match against any part of the (uniquified) buffer name. If you enable ido-enable-flex-matching (or alternatively, use something like LustyExplorer instead) then you can type unconnected parts of that buffer name, and the fuzzy matching will narrow the list intelligently (e.g. typing "mez2" might be enough to isolate "message.zcml|ui2").

    (*) Personally I prefer ibuffer to match dired buffers as well as file buffers when I make a filename filter, so I redefine that filter accordingly:

    ;; Enable ibuffer-filter-by-filename to filter on directory names too.
    (eval-after-load "ibuf-ext"
      '(define-ibuffer-filter filename
         "Toggle current view to buffers with file or directory name matching QUALIFIER."
         (:description "filename"
          :reader (read-from-minibuffer "Filter by file/directory name (regexp): "))
         (ibuffer-awhen (or (buffer-local-value 'buffer-file-name buf)
                            (buffer-local-value 'dired-directory buf))
           (string-match qualifier it))))
    

提交回复
热议问题