Feature-rich mouseless control of macOS Finder, inspired by vim/ranger.
Feature-rich control of macOS Finder without the mouse, inspired by vim and ranger.
rl
: Duplicate selected file and open the copy.axw
: Select all files, move them to the other window, close current window..f.d.
: Show hidden files, select first hidden file, delete it, hide dotfiles
again.AM
: Select files (but not folders), create a new directory, move selected
files into that directory, and start renaming the directory (enters insert
mode).azmhp
: Select all files and folders, zip them, (wait for zipping to finish),
and move the archive one directory upList View
.:help
Press ?
in Finder to display the cheatsheet above. Generally,
everything in brackets only applies to the uppercase version of the key.m
marks the current selection as "to be moved." The next
paste-operation p
moves the files. A move can be aborted via esc
.x
moves the
selection to the other window, and X
copies the selection to the other
window.q
and navigated via hjkl
. Use esc
or press q
again to close the context-menu.f
, works similar to f
in vim, expecting
another character afterward. For example, fh
jumps to the next file that
starts with the letter h
.-bkp
suffix: Add suffix -bkp
to the file. If it already has
such a suffix, remove it. Useful for debugging as well.Tab
goes to the next file in alphabetical order, even when the view is
not sorted alphabetically. (This is actually a built-in feature of Finder,
but worth mentioning since barely anyone knows about it.)Y
copies the content of the selected file, while
P
pastes text from the clipboard into the selected file (appending).Ctrl+g
opens the file at
GitHub and also copies the URL to the clipboard.[!NOTE] Pressing
return
in a prompt window, for example when replacing a file, mistakenly puts you in Insert Mode. Unfortunately, Karabiner is not able to detect whether the front window is a regular Finder window or a prompt. The workaround is to either pressesc
to go back to Normal Mode, or to usetab
and thenspace
to select the correct action in the prompt window.
Run this in your terminal:
brew install karabiner-elements # Install Karabiner (if not already installed)
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" && killall Finder # set default view to "List"
open "karabiner://karabiner/assets/complex_modifications/import?url=https://raw.githubusercontent.com/chrisgrieser/finder-vim-mode/main/finder-vim.json"
curl -sL "https://raw.githubusercontent.com/chrisgrieser/finder-vim-mode/main/extras/cheatsheet.png" --create-dirs --output "$HOME/.config/karabiner/assets/finder-vim-mode/cheatsheet.png"
Activate the plugin: Import
→ Enable
Karabiner users: If you already use Karabiner and have another modification
affecting the Capslock
key, the other modification must come below the
Finder Vim Mode in the list of modifications. (Karabiner prioritizes
modifications further on top of the list.)
Alfred users: In the Appearance
Options, you need to set
the Focusing
behavior to Compatibility Mode
for Karabiner to detect
Alfred being active.
Spotlight users: You need to install the Spotlight addon. The addon has to be above the Finder Vim Mode in the list of modifications.
# install Spotlight addon
open "karabiner://karabiner/assets/complex_modifications/import?url=https://raw.githubusercontent.com/chrisgrieser/finder-vim-mode/main/addons/finder-vim-spotlight-addon.json"
[!NOTE]
I do not use Raycast, but Raycast should be supported with either the Spotlight addon or by enabling some sort of compatibility mode. For proper Raycast support, please open an issue.
Unfortunately, Karabiner has no mechanism for auto-updating plugins. Therefore, you have to install updates manually by re-running the code above. You can check for the last commit date to see whether there has been an update:
Since Karabiner plugins are only hotkey re-mappings without proper scripting mechanisms, this plugin has some limitations:
esc
to get back to Normal Mode. (Or, you know,
just do not use the mouse. You're a vim user, after all.)vimrc
or to let the user
configure the keybindings themselves in any way, at least not with a
Karabiner plugin. If you want to rebind keys, you have to change the
respective key manually in the JSON file.System Settings → General → Language & Region → Preferred Languages
)Other than a nicer appearance, a GUI does have a few advantages:
Reveal current file in Finder
feature, which
is quite handy but does not work with a TUI file manager.cmd+tab
, or other app switchers (for example, rcmd
).
With a TUI, you'd have to switch to your Terminal, and then switch to your
file manager, requiring basically an extra step.Karabiner plugins are essentially hotkey configurations in form of a JSON file. Since the amount of configurations for this plugin is rather large, the resulting JSON file ~6000 lines. To make that manageable, this plugin is written in YAML, where features such as anchors and aliases reduce the lines of code to only ~1000 lines.
If you want to fork this plugin, it is recommended to work with the YAML file and "compile" it to the JSON required by Karabiner. You can do so with yq:
# `explode()` required to resolve the anchors and aliases
yq --output-format=json 'explode(.)' finder-vim.yaml > finder-vim.json
The cheatsheet has been created with http://www.keyboard-layout-editor.com/.
About Me
In my day job, I am a sociologist studying the social mechanisms underlying the
digital economy. For my PhD project, I investigate the governance of the app
economy and how software ecosystems manage the tension between innovation and
compatibility. If you are interested in this subject, feel free to get in touch.