Skip to content

Instantly share code, notes, and snippets.

@pch
Created April 23, 2020 08:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pch/d556d5f59205a45e9e068872df55c55b to your computer and use it in GitHub Desktop.
Save pch/d556d5f59205a45e9e068872df55c55b to your computer and use it in GitHub Desktop.
How to Use macOS Finder as a MacVim File Drawer

How to Use macOS Finder as a MacVim File Drawer

When I switched to Vim from TextMate 2, the feature I missed the most was a decent file drawer (no, NERDTree doesn't cut it). I'm happy with fzf.vim, but having the project tree in front of you can be really useful from time to time, e.g. when working with unfamiliar codebase, a new project etc.

The solution for it is surprisingly simple (although not without flaws): use MacVim with a Finder window in Split View mode:

How?

In order for it to work, you'll need to:

  • open your project directory in Finder, switch to List View and resize the window until the sidebar disappears
  • in MacVim preferences, set "Open files from applications" to "in the current window" and select "and set the argslist" from the dropdown - this allows to open files from the Finder window in the current MacVim window (file will be opened in a new buffer)
  • open both applications in a split view side-by-side (click & hold the green dot in the upper left-hand corner)

Drawbacks

As mentioned, there are some obvious flaws in this approach:

  • it probably won't work with a non-gui vim.
  • Finder has no way to store window settings on a per-directory basis. Yes, it will remember that the given directory should be displayed in a list view, but if you resize the window and remove the sidebar, Finder will use these settings for all subsequent sessions...
  • no way to fire up the project with a single shell command

If you have suggestions how to improve it, let me know in the comments.

💡 App idea alert: I've tried to find a stand-alone macOS app that would work like a Finder file tree (only without sidebar, columns, toolbar - essentially TextMate file drawer without the editor 😉), but it doesn't seem to exist...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment