Created
February 9, 2013 09:34
-
-
Save bouzuya/4744701 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function! s:insert_tmux_buffer() | |
| let buffers = split(system('tmux list-buffers'), '\n') | |
| if empty(buffers) | |
| return | |
| endif | |
| let buffers_origin1 = map(buffers, | |
| \ 'substitute(v:val, ''\V\^\d\+'', ''\=submatch(0) + 1'', '''')') | |
| call insert(buffers_origin1, 'tmux list-buffers', 0) | |
| let selected_index = inputlist(buffers_origin1) - 1 | |
| if selected_index >= 0 | |
| let buffer = system(printf('tmux show-buffer -b %d', selected_index)) | |
| call append('.', split(buffer, '\n')) | |
| endif | |
| endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment