"Shamefully stolen from http://stackoverflow.com/a/6271254/794380 function! vebugger#util#get_visual_selection() " Why is this not a built-in Vim script function?! let [lnum1, col1] = getpos("'<")[1:2] let [lnum2, col2] = getpos("'>")[1:2] let lines = getline(lnum1, lnum2) let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)] let lines[0] = lines[0][col1 - 1:] return join(lines, "\n") endfunction function! vebugger#util#selectProcessOfFile(ofFile) let l:fileName=fnamemodify(a:ofFile,':t') let l:resultLines=split(vimproc#system('ps -o pid,user,comm,start,state,tt -C '.fnameescape(l:fileName)),'\r\n\|\n\|\r') if len(l:resultLines)<=1 throw 'No matching process found' endif if &lines