Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac app based on platypus #11

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Mac app based on platypus #11

wants to merge 13 commits into from

Conversation

justjake
Copy link
Collaborator

TmuxIde.app: open files in Nvim + Tmux

I've started a project based on Appear's libraries to open files in Nvim +
Tmux. I prefer Tmux and terminal-based programs to GUI editors, so I've always
wanted to set console Vim as my default application for many filetypes.

I've built a proof-of-concept scipt that intelligently opens clicked files in
Nvim sessions inside Tmux windows. We use
Platypus to turn the script into a Mac native
app, and duti to assign our new app as the default
editor.

This project will eventually be split into its own repo, but lives in Appear
for now.

Set up Neovim:

  1. set up Neovim
  2. Set up Neovim Remote.
    Follow the nvr install instructions. Make sure the binary ends up in
    /usr/local/bin, /usr/bin, or /bin.
  3. make sure you've got tmux in /usr/local/bin, too. brew install tmux if not.
  4. stick this in your .bashrc or .zshrc so that each Neovim process gets it's own socket:
    bash mkdir -p "$HOME/.vim/sockets/" NVIM_LISTEN_ADDRESS="$HOME/.vim/sockets/vim-zsh-$$.sock"
    Without this snippet, we'll be unable to query or control existing nvim sessions.

Build the app:

  1. brew install platypus, which is the app builder
  2. bundle exec rake app builds into ./build/TmuxIde.app

Use it as the default for all of your source code files:

  1. Notify OS X that your app exits by running it once, you can find it in
    ./build/TmuxIde.app. It'll display a dialog and then exit.
  2. brew install duti, which is a tool we use to change default application for filetypes.
  3. bundle exec rake app_defaults will assign all source code extensions to
    open in TmuxIde by default.

If you have any issues with the app, you can tail -f /tmp/tmux-ide-*.log to
view log messages.

Demo

appear-tmux-vim

Jake Teton-Landis added 13 commits October 9, 2016 12:47
this task outputs an app in ./build/TmuxIde.app which contains a copy of
the current Appear gem. The entrypoint is in tools/app-entry.rb, which
is slightly different from bin/appear:

- use /usr/bin/ruby
- use local copy of appear instead of some sort of gem thing

this requires platypus, so `brew install platypus`
Sometimes you can't connect to a socket. This commit hacks away around
that by ignoring Nvim sockets that we can't read pid() from.
Again, we pull the list of file extensions from MacVim. Thanks MacVim!
This makes it feel lighter-weight to open random files.
Also, build releaseable app by default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant