class Utils::Editor
def activate
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 switch_to_index = `tmux list-panes -F '\#{pane_pid} \#{pane_index}'`.lines.find { |l| pid, index = l.split(' ') pid.to_i == $$ and next if `ps -eo ppid,command|grep ^#{pid}` =~ %r(/edit( |$)) break index.to_i end } switch_to_index and system "tmux select-pane -t #{switch_to_index}" end end