class Tmuxinator::Pane

Attributes

commands[R]
index[R]
project[R]
tab[R]

Public Class Methods

new(index, project, tab, *commands) click to toggle source
# File lib/tmuxinator/pane.rb, line 5
def initialize(index, project, tab, *commands)
  @commands = commands
  @index = index
  @project = project
  @tab = tab
end

Public Instance Methods

last?() click to toggle source
# File lib/tmuxinator/pane.rb, line 51
def last?
  index == tab.panes.length - 1
end
name() click to toggle source
# File lib/tmuxinator/pane.rb, line 32
def name
  project.name
end
pane_index() click to toggle source
# File lib/tmuxinator/pane.rb, line 40
def pane_index
  index + tab.project.pane_base_index
end
tmux_main_command(command) click to toggle source
# File lib/tmuxinator/pane.rb, line 24
def tmux_main_command(command)
  if command
    _send_target(command.shellescape)
  else
    ""
  end
end
tmux_pre_command() click to toggle source
# File lib/tmuxinator/pane.rb, line 16
def tmux_pre_command
  _send_target(tab.pre.shellescape) if tab.pre
end
tmux_pre_window_command() click to toggle source
# File lib/tmuxinator/pane.rb, line 20
def tmux_pre_window_command
  _send_target(project.pre_window.shellescape) if project.pre_window
end
tmux_split_command() click to toggle source
# File lib/tmuxinator/pane.rb, line 44
def tmux_split_command
  path = if tab.root?
           "#{Tmuxinator::Config.default_path_option} #{tab.root}"
         end
  "#{project.tmux} splitw #{path} -t #{tab.tmux_window_target}"
end
tmux_window_and_pane_target() click to toggle source
# File lib/tmuxinator/pane.rb, line 12
def tmux_window_and_pane_target
  "#{project.name}:#{window_index}.#{pane_index}"
end
window_index() click to toggle source
# File lib/tmuxinator/pane.rb, line 36
def window_index
  tab.index + project.base_index
end

Private Instance Methods

_send_keys(t, e) click to toggle source
# File lib/tmuxinator/pane.rb, line 61
def _send_keys(t, e)
  "#{project.tmux} send-keys -t #{t} #{e} C-m"
end
_send_target(e) click to toggle source
# File lib/tmuxinator/pane.rb, line 57
def _send_target(e)
  _send_keys(tmux_window_and_pane_target, e)
end