Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions autoload/tmuxify.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ endif
let g:autoloaded_tmuxify = 1

" s:SID() {{{1
function s:SID() abort
function! s:SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')
endfun

Expand Down Expand Up @@ -125,13 +125,13 @@ function! tmuxify#pane_set(bang, ...) abort
echo 'tmuxify: Invalid Pane ID!'
return
endif
let [session, window, pane] = split(descriptor_string, '\W')
let [session, window, pane] = s:parsePane(descriptor_string)
else
let [session, window, pane] = split(a:1, '\W')
let [session, window, pane] = s:parsePane(a:1)
endif
else
let descriptor = input('Session:Window.Pane> ', '', 'custom,<SNR>'. s:SID() .'_complete_descriptor')
let [session, window, pane] = split(descriptor, '\W')
let [session, window, pane] = s:parsePane(descriptor)
endif

execute "let " . scope . "session = session"
Expand All @@ -147,6 +147,12 @@ function! tmuxify#pane_set(bang, ...) abort
execute "let " . scope . "pane_id = str2nr(pane_id)"
endfunction

function! s:parsePane(str) abort
let pat = '\v(.*):(\d+)\.(\d+)'
let [ignored, session, window, pane; rest] = matchlist(a:str, pat)
return [session, window, pane]
endfunction

" tmuxify#pane_run() {{{1
function! tmuxify#pane_run(bang, ...) abort
if empty(a:bang)
Expand Down