Module: Lab42::Tmux::Window::Command

Extended by:
Forwarder
Includes:
VimCommand
Included in:
Lab42::Tmux::Window
Defined in:
lib/lab42/tmux/window/command.rb,
lib/lab42/tmux/window/command/vim_command.rb

Defined Under Namespace

Modules: VimCommand

Instance Method Summary collapse

Methods included from VimCommand

#vim_command, #vim_commands, #vim_set_commands

Instance Method Details

#tmux_cd_project_homeObject



22
23
24
# File 'lib/lab42/tmux/window/command.rb', line 22

def tmux_cd_project_home
  tmux_send_keys "cd #{session.project_home}"
end

#tmux_commandsObject



26
27
28
29
30
# File 'lib/lab42/tmux/window/command.rb', line 26

def tmux_commands
  [(commands || [])].flatten.map{ |cmd|
    tmux_send_keys cmd
  }
end

#tmux_new_window(rename: false) ⇒ Object

TODO: Check for dead code here!



12
13
14
15
16
17
18
19
20
# File 'lib/lab42/tmux/window/command.rb', line 12

def tmux_new_window( rename: false )
  [ tmux( "new-window -t #{session_name}#{new_window_name}" ) ] +
    (rename ? [] : [
      tmux( "set-window-option -t #{designation} automatic-rename off" ),
      tmux( "set-window-option -t #{designation} allow-rename off" )
  ]) +
  [tmux_cd_project_home] +
  tmux_commands
end

#tmux_send_keys(keys, cm: true) ⇒ Object



31
32
33
# File 'lib/lab42/tmux/window/command.rb', line 31

def tmux_send_keys keys, cm: true
  tmux "send-keys -t #{designation} #{keys.inspect}#{lprefix( cm && "C-m" )}"
end