2

I'd like to be able to quickly skip to the bottom of a cascade of otherwise empty directories. Consider the following directory structure:

foo/
  bar/
    baz/
      a.txt
      b.txt

If I were in foo/ with helm-find-files, I'd like to get to baz/ quickly. I can think of two possible solutions.

  1. Somehow configure helm to provide a shortcut to baz/ when in foo/, so the find file buffer might look like:

    .
    ..
    bar/baz
    bar
    

    And bar/baz is maybe marked in a different color.

  2. Have the active selection automatically set to the first member of the current directory instead of ., i.e.

    .      <-- selection is usually here after entering a new directory
    ..
    one/   <-- instead, automatically highlight this
    two/
    three.txt
    

    That way, baz/ is two keypresses from foo/.

If I could implement both of these then I'd really be flying. I tried helm-ff-auto-update-initial-value but did not find it useful. You still have to type the first three letters of the directory to enter it automatically. Actually typing even just one character of the directory is not satisfactory. Hiding . and .. has been proposed but is a hack and not supported by the developers, see here and here.

0

I figured out how to do #2.

(defun tsj/helm-ff-skip-past-dots ()
  (if (and (equal "Find Files" (assoc-default 'name (helm-get-current-source)))
       (s-ends-with? "/." (helm-get-selection)))
  (with-helm-window
    (forward-line 2)
    (helm-mark-current-line))))

(with-eval-after-load 'helm-files
  (advice-add 'helm--update-move-first-line
      :after #'tsj/helm-ff-skip-past-dots))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.