Class: Tmuxinator::Pane
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#tab ⇒ Object
readonly
Returns the value of attribute tab.
Instance Method Summary collapse
-
#initialize(index, project, tab, *commands) ⇒ Pane
constructor
A new instance of Pane.
- #last? ⇒ Boolean
- #multiple_commands? ⇒ Boolean
- #tmux_main_command(command) ⇒ Object
- #tmux_pre_command ⇒ Object
- #tmux_pre_window_command ⇒ Object
- #tmux_split_command ⇒ Object
- #tmux_window_and_pane_target ⇒ Object
Constructor Details
#initialize(index, project, tab, *commands) ⇒ Pane
Returns a new instance of Pane.
5 6 7 8 9 10 |
# File 'lib/tmuxinator/pane.rb', line 5 def initialize(index, project, tab, *commands) @commands = commands @index = index @project = project @tab = tab end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
3 4 5 |
# File 'lib/tmuxinator/pane.rb', line 3 def commands @commands end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
3 4 5 |
# File 'lib/tmuxinator/pane.rb', line 3 def index @index end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
3 4 5 |
# File 'lib/tmuxinator/pane.rb', line 3 def project @project end |
#tab ⇒ Object (readonly)
Returns the value of attribute tab.
3 4 5 |
# File 'lib/tmuxinator/pane.rb', line 3 def tab @tab end |
Instance Method Details
#last? ⇒ Boolean
53 54 55 |
# File 'lib/tmuxinator/pane.rb', line 53 def last? index == tab.panes.length - 1 end |
#multiple_commands? ⇒ Boolean
57 58 59 |
# File 'lib/tmuxinator/pane.rb', line 57 def multiple_commands? commands && commands.length > 0 end |
#tmux_main_command(command) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tmuxinator/pane.rb', line 34 def tmux_main_command(command) if command x = tab.index + project.base_index y = index + tab.project.base_index e = command.shellescape n = project.name "#{project.tmux} send-keys -t #{n}:#{x}.#{y} #{e} C-m" else "" end end |
#tmux_pre_command ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/tmuxinator/pane.rb', line 18 def tmux_pre_command return unless tab.pre t = tmux_window_and_pane_target e = tab.pre.shellescape "#{project.tmux} send-keys -t #{t} #{e} C-m" end |
#tmux_pre_window_command ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/tmuxinator/pane.rb', line 26 def tmux_pre_window_command return unless project.pre_window t = tmux_window_and_pane_target e = project.pre_window.shellescape "#{project.tmux} send-keys -t #{t} #{e} C-m" end |
#tmux_split_command ⇒ Object
46 47 48 49 50 51 |
# File 'lib/tmuxinator/pane.rb', line 46 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 ⇒ Object
12 13 14 15 16 |
# File 'lib/tmuxinator/pane.rb', line 12 def tmux_window_and_pane_target x = tab.index + project.base_index y = index + project.base_index "#{project.name}:#{x}.#{y}" end |