Skip to content

Commit bacf009

Browse files
graywhtpope
authored andcommitted
Add support for tmux (like GNU screen)
1 parent 4ea060b commit bacf009

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

autoload/rails.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,8 @@ function! s:app_background_script_command(cmd) dict abort
819819
endif
820820
elseif exists("$STY") && !has("gui_running") && screen && executable("screen")
821821
silent exe "!screen -ln -fn -t ".s:sub(s:sub(a:cmd,'\s.*',''),'^%(script|-rcommand)/','rails-').' '.cmd
822+
elseif exists("$TMUX") && !has("gui_running") && screen && executable("tmux")
823+
silent exe '!tmux new-window -d -n "'.s:sub(s:sub(a:cmd,'\s.*',''),'^%(script|-rcommand)/','rails-').'" "'.cmd.'"'
822824
else
823825
exe "!".cmd
824826
endif
@@ -1501,7 +1503,7 @@ function! s:app_server_command(bang,arg) dict
15011503
else
15021504
let screen = g:rails_gnu_screen
15031505
endif
1504-
if has("win32") || has("win64") || (exists("$STY") && !has("gui_running") && screen && executable("screen"))
1506+
if has("win32") || has("win64") || (exists("$STY") && !has("gui_running") && screen && executable("screen")) || (exists("$TMUX") && !has("gui_running") && screen && executable("tmux"))
15051507
call self.background_script_command('server '.a:arg)
15061508
else
15071509
" --daemon would be more descriptive but lighttpd does not support it

doc/rails.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,8 +1043,8 @@ existing project from the menu. Defaults to the README.
10431043

10441044
*rails-screen* *g:rails_gnu_screen* >
10451045
let g:rails_gnu_screen=1
1046-
Use GNU Screen (if it is running) to launch |:Rscript| console and |:Rserver|
1047-
in the background. Enabled by default.
1046+
Use GNU Screen or Tmux (if it is running) to launch |:Rscript| console and
1047+
|:Rserver| in the background. Enabled by default.
10481048

10491049
*g:rails_history_size* >
10501050
let g:rails_history_size=5

0 commit comments

Comments
 (0)