123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'lib/utils/editor.rb', line 123
def activate
if Array(config.vim_default_args).include?('-g')
edit_remote("stupid_trick#{rand}")
sleep pause_duration
edit_remote_send('<ESC>:bw<CR>')
else
pstree = PSTree.new
switch_to_index =
`tmux list-panes -F '\#{pane_pid} \#{pane_index}'`.lines.find { |l|
pid, index = l.split(' ')
pid = pid.to_i
if pstree.find { |ps| ps.pid != $$ && ps.ppid == pid && ps.cmd =~ %r(/edit( |$)) }
break index.to_i
end
}
switch_to_index and system "tmux select-pane -t #{switch_to_index}"
end
end
|