News for hackers. Stuff that matters.
Re:Benefits of using tmux – streamlining your development en... by minhajuddin on Tuesday November 08, 2016 @04:04PM (#12903922)
I use a tool called tummy (https://github.com/minhajuddin/tummy full disclosure: built by me) which allows me to create a Tmuxfile per project. A typical file looks like this:

  session "liveform"
  directory "/home/minhajuddin/r/liveform/frontend"

  window "src", [
    pane("vim TODO"),
  ]

  window "server-pry", [
    pane("puma --port 3000 --config <(echo '')"),
    pane("rails c", :horizontal),
  ]

  window "play", [
    pane("git status"),
  ]

  window "misc", [
    pane("sidekiq"),
    #pane("httpdebug", :horizontal),
    pane("cd ~/s/html; fs", :horizontal),
    pane("guard", :horizontal),
  ]

  # vim: filetype=ruby
Re:Benefits of using tmux – streamlining your development en... by positr0n on Tuesday November 08, 2016 @04:21PM (#12904046)
I used to use tools like that (tummy, teamocil, etc) but I've since discovered tmux-resurrect. It persists tmux sessions, windows, panes, and a whitelist of non-destructive commands like vim and top across reboots. Now my tmux sessions just organically grow and shrink as necessary and I never worry about having to recreate them.

Of course I can see the case for combining both tools. If you have a lot of projects, and/or want REPLs loaded you might not want them sitting around in memory for months if you're not going to use them.

It is trivial to get working. Just use tmux plugin manager to install tmux-resurrect and tmux-continuum.

https://github.com/tmux-plugins/tpm

Example usage in my dotfiles: https://github.com/positron/dotfiles/blob/master/.tmux.conf#...

Re:Benefits of using tmux – streamlining your development en... by nnutter on Tuesday November 08, 2016 @05:37PM (#12904581)
Does it save environment variables too?
Re:Benefits of using tmux – streamlining your development en... by minhajuddin on Tuesday November 08, 2016 @11:25PM (#12906029)
It doesn't save anything, it is just a startup script to get your tmux session set up the way you want. You can however, have env vars in the script or source from a particular file. e.g.

  session "grnc_hub"
  directory "/home/minhajuddin/a/grnc_hub"

  window "server", [
    pane("RAILS_ENV=production rails s"),
    pane("source ./.env && rails s"),
  ]
  ...
Re:Benefits of using tmux – streamlining your development en... by funksta on Tuesday November 08, 2016 @06:35PM (#12904959)
I don't believe it does save env vars. However, as an owner of a crashy 2010 MBP, tmux-resurrect saves my bacon several times a week. I very highly recommend it.
Re:Benefits of using tmux – streamlining your development en... by toddnni on Wednesday November 09, 2016 @01:11AM (#12906632)
No, but add an autoenv script of your choice, like zsh-autoenv and the combination is nearly perfect.
Re:Benefits of using tmux – streamlining your development en... by minhajuddin on Tuesday November 08, 2016 @04:24PM (#12904072)
I've tried tmux resurrect. Wasn't for me. With a predefined script I can close and open many windows with abandon. Also, creating the initial script is simple enough. I guess different strokes for different folks :)
Re:Benefits of using tmux – streamlining your development en... by jitl on Tuesday November 08, 2016 @04:48PM (#12904253)
I've been working on a Tmux manipulation library in Ruby as part of another project of mine, called Appear. Appear can raise any process to the front of your GUI (if your GUI is macOS), even if that process is in a disconnected Tmux session.

I'm also working on a little app that allows you to open files in Finder into console Tmux+Nvim.

Project: https://github.com/airbnb/appear

Tmux library source: https://github.com/airbnb/appear/blob/master/lib/appear/tmux...

Tmux library docs: http://www.rubydoc.info/gems/appear/Appear/Tmux

Example usage: https://github.com/airbnb/appear/blob/master/lib/appear/edit...

Nvim+Tmux file handler app: https://github.com/airbnb/appear/pull/11

Re:Benefits of using tmux – streamlining your development en... by highd on Tuesday November 08, 2016 @06:23PM (#12904888)
Nice! I've hacked some shell scripts together to do something similar, but this is way better!
Re:Benefits of using tmux – streamlining your development en... by dxhdr on Tuesday November 08, 2016 @04:16PM (#12904003)
Your github seems to be missing the code!

  require "tummy/version"

  module Tummy
    # Your code goes here...
  end
Re:Benefits of using tmux – streamlining your development en... by minhajuddin on Tuesday November 08, 2016 @04:19PM (#12904028)
All of the code is actually in a executable script https://github.com/minhajuddin/tummy/blob/master/exe/tummy

I am a bit biased, but it has been working very nicely for me. It also has ability to pass raw tmux arguments for things which aren't supported by it.