Mercurial > hg > Members > atton > pmux
annotate lib/pmuxinator/pane.rb @ 2:67a6071afec7
Rename tmuxinator -> pmuxinator
$ zmv **/*tmuxinator* **/*pmuxinator*
$ gsed -e 's/tmuxinator/pmuxinator/g' -i **/*.*
$ gsed -e 's/Tmuxinator/Pmuxinator/g' -i **/*.*
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 21 Jul 2014 08:32:00 +0900 |
parents | |
children |
rev | line source |
---|---|
2
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 module Pmuxinator |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 class Pane |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 attr_reader :commands, :project, :index, :project, :tab |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 def initialize(index, project, tab, *commands) |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 @commands = commands |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 @index = index |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 @project = project |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 @tab = tab |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 end |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 def tmux_window_and_pane_target |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 "#{project.name}:#{tab.index + project.base_index}.#{index + project.base_index}" |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 end |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 def tmux_pre_command |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 tab.pre ? "#{project.tmux} send-keys -t #{tmux_window_and_pane_target} #{tab.pre.shellescape} C-m" : "" |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 end |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 def tmux_pre_window_command |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 project.pre_window ? "#{project.tmux} send-keys -t #{tmux_window_and_pane_target} #{project.pre_window.shellescape} C-m" : "" |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22 end |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 def tmux_main_command(command) |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 command ? "#{project.tmux} send-keys -t #{project.name}:#{tab.index + project.base_index}.#{index + tab.project.base_index} #{command.shellescape} C-m" : "" |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 end |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 def tmux_split_command |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 "#{project.tmux} splitw -t #{tab.tmux_window_target}" |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 end |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 def last? |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 index == tab.panes.length - 1 |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 end |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 def multiple_commands? |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 commands && commands.length > 0 |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 end |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 end |
67a6071afec7
Rename tmuxinator -> pmuxinator
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 end |