splhack (owner)

Revisions

gist: 122977 Download_button fork
public
Public Clone URL: git://gist.github.com/122977.git
vim-ruby-debugger quickhack for MacVim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/vim/plugin/ruby_debugger.vim b/vim/plugin/ruby_debugger.vim
index d9b1f47..7c838a0 100644
--- a/vim/plugin/ruby_debugger.vim
+++ b/vim/plugin/ruby_debugger.vim
@@ -1464,6 +1464,9 @@ function! s:Server._get_pid_attempt(bind, port)
     let netstat = system("netstat -anop tcp")
     let pid_match = matchlist(netstat, ':' . a:port . '\s.\{-}LISTENING\s\+\(\d
\+\)')
     let pid = len(pid_match) > 0 ? pid_match[1] : ""
+ elseif has("mac")
+ let pid = system("lsof -i tcp:" . a:port . " | grep LISTEN | awk '{print $2
}'")
+ let pid = substitute(pid, '\n', '', '')
   elseif executable('lsof')
     let pid = system("lsof -i 4tcp@" . a:bind . ':' . a:port . " | grep LISTEN
| awk '{print $2}'")
     let pid = substitute(pid, '\n', '', '')