Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update slimux

  • Loading branch information...
commit e035c9034e7fe97f1ddcf3b80c993798b402f642 1 parent 65f7d91
Esa-Matti Suuronen authored
Showing with 27 additions and 2 deletions.
  1. +1 −1  bundle/slimux/README.md
  2. +26 −1 bundle/slimux/plugin/slimux.vim
2  bundle/slimux/README.md
View
@@ -15,7 +15,7 @@ used for the first time. The configuration happens interactively. You will see
list of available tmux panes and you can choose one by hitting enter on top of
one.
-Also REPL commands can have custom pre, post and escape hooks. These allow
+Also REPL commands can have custom pre, post and escape hooks. These allows
interaction with some more complex REPLs such as the CoffeeScript REPL.
This plugin borrows ideas and some code from [vim-slime][].
27 bundle/slimux/plugin/slimux.vim
View
@@ -9,6 +9,12 @@ let s:retry_send = {}
function! g:_SlimuxPickPaneFromBuf(tmux_packet)
+ let pos = getpos(".")[1]
+ if pos < 3
+ echo "select a pane"
+ return
+ end
+
" Get current line under the cursor
let line = getline(".")
@@ -36,11 +42,30 @@ function! s:SelectPane(tmux_packet)
" Put tmux panes in the buffer. Must use cat here because tmux might fail
" here due to some libevent bug in linux.
" Try 'tmux list-panes -a > panes.txt' to see if it is fixed
- %!tmux list-panes -a | cat
+
+ " Set header for the menu buffer
+ call setline(1, "Select tmux pane with Enter key")
+ call setline(2, "")
+
+ " Add previous selection as the first
+ let last = a:tmux_packet["target_pane"]
+ if len(last) != 0
+ call setline(3, last . ": (previous)")
+ endif
+
+ " List all tmux panes at the end
+ normal G
+ read !tmux list-panes -a | cat
+ call setpos(".", [0, 3, 0, 0])
+
+ " Hilight what we can select
+ highlight MyGroup ctermbg=green guibg=green
+ match MyGroup '^\([^ ]\+\)\:'
" bufhidden=wipe deletes the buffer when it is hidden
setlocal bufhidden=wipe buftype=nofile
setlocal nobuflisted nomodifiable noswapfile nowrap
+ setlocal cursorline nocursorcolumn
" Hide buffer on q and <ESC>
nnoremap <buffer> <silent> q :hide<CR>
Please sign in to comment.
Something went wrong with that request. Please try again.