changeset 6:4d8f8b2bb7a9

Implement synchronize panes note: https://github.com/tmuxinator/tmuxinator/pull/97
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Mon, 21 Jul 2014 20:07:22 +0900
parents 8ebb2d954968
children 442e7e73781c
files lib/pmuxinator/assets/debugger.yml lib/pmuxinator/assets/template.erb lib/pmuxinator/window.rb
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/pmuxinator/assets/debugger.yml	Mon Jul 21 19:38:24 2014 +0900
+++ b/lib/pmuxinator/assets/debugger.yml	Mon Jul 21 20:07:22 2014 +0900
@@ -13,4 +13,4 @@
       panes:
         - echo hg update -r 100
         - echo hg update -r 50
-      synchironize: true
+      synchronize: true
--- a/lib/pmuxinator/assets/template.erb	Mon Jul 21 19:38:24 2014 +0900
+++ b/lib/pmuxinator/assets/template.erb	Mon Jul 21 20:07:22 2014 +0900
@@ -55,6 +55,7 @@
 
   <%= window.tmux_select_first_pane %>
     <%- end -%>
+  <%= window.tmux_synchronize_panes %>
   <%- end -%>
 
   <%= tmux %> select-window -t <%= base_index %>
--- a/lib/pmuxinator/window.rb	Mon Jul 21 19:38:24 2014 +0900
+++ b/lib/pmuxinator/window.rb	Mon Jul 21 20:07:22 2014 +0900
@@ -11,12 +11,14 @@
       @pre = nil
       @project = project
       @index = index
+      @synchronize = false
 
       value = window_yaml.values.first
 
       if value.is_a?(Hash)
         @layout = value["layout"] ? value["layout"].shellescape : nil
         @pre = value["pre"] if value["pre"]
+        @synchronize = value['synchronize'] unless value['synchronize'].blank?
 
         @panes = build_panes(value["panes"])
       else
@@ -86,5 +88,13 @@
     def tmux_select_first_pane
       "#{project.tmux} select-pane -t #{tmux_window_target}.#{panes.first.index + project.base_index}"
     end
+
+    def tmux_synchronize_panes
+      if @synchronize
+        "#{project.tmux} set-window-option -t #{tmux_window_target} synchronize-panes on"
+      else
+        ''
+      end
+    end
   end
 end