esamattis / slimux Goto Github PK
View Code? Open in Web Editor NEWSLIME inspired tmux integration plugin for Vim
Home Page: http://esa-matti.suuronen.org/blog/2012/04/19/slimux-tmux-plugin-for-vim/
License: Other
SLIME inspired tmux integration plugin for Vim
Home Page: http://esa-matti.suuronen.org/blog/2012/04/19/slimux-tmux-plugin-for-vim/
License: Other
Would it be possible to add some bits to make Haskell support nicer?
like if you are on a line with
main :: IO ()
it sends
:t main
to ghci.
Kind Regards,
Hello,
I just found out about Slimux (having previously been using vim-slime), and am excited to try it out! However, I haven't been able to get Slimux working, and so am wondering whether I'm doing something wrong, or if there might be a compatibility bug with my version of Tmux and/or Vim.
tmux -V
tells me that I'm using version 1.9avim --version
tells me that I'm using version "7.4 (2013 Aug 10)"Here are the steps I'm taking when trying to use Slimux:
tmux new-session -s "Test"
Ctrl+b %
5+5
5+5
:SlimuxREPLSendLine
SlimuxShellRun
, either (e.g., with just bash running in the other tmux pane, using :SlimuxShellRun ls *\**
in vim).SlimuxSendKeysPrompt
and SlimuxSendKeysLast
do work, however.Am I forgetting to set something up here? From the Readme and blog posts I've read, I'm unsure whether there's more setup I should be doing.
Not listed yet there.
I tried to setup "run the last command again" shortcut using the SlimuxSendKeys command.
Like this:
:SlimuxSendKeysPrompt
KEYS>C-C Up Enter
but it outputs
$ [A
[A: command not found
for some reason. It can be worked around like this
KEYS>C-C Enter Up Enter
Can you take a look at this @tarruda?
I run vim outside tmux and my REPL inside. In this setup something went broken lately - Slimux "eats" one pane, when I have one pane open it says there are none, if there are multiple, it seems to ignore the first.
When I set
let g:slimux_exclude_vim_pane = 0
it works correctly again, so it seems that this filtering breaks down somehow if vim itself is not inside tmux, I guess. It should not be necessary to set this option if vim is not even inside tmux.
It seems like this repository has not been updated for the last 4 years, even though there have been pull requests throughout this time.
To me personally, this repo represents the core of my workflow, so I would love to see it continue being maintained.
@esamattis any vision on potential further development or should there be an official fork that continues development?
functions and configurations have been added, docs are lagging behind.
using vundle and installing works great, but when I quit vim, the slimux commands are never available again. has anybody seen anything like this?
I have never seen a problem like this before.
cheers!
SlimuxREPLSendSelection sends the selection to target pane but doesnt execute it. Kind of weird.
On the other hand, SlimuxREPLSendLine sends to target pane and executes...
Is this the expected behaviour?
I noticed an error after sending a visual selection with python code containing imports. To reproduce this issue:
1 - Initiate tmux and create two panes (in my case, I hit C-b+").
2 - In the first pane, open a file with vim (I personally use neovim). In the second pane, start a session with ipython.
3 - In the pane you started vim, create a vertical split with vim (C-W v)
4 - (Optional) Open another file in the second vertical split created in step 3.
5 - Write some python imports in the first part of the vertical split
import sys
import os
6 - Visually select those lines and send them to the ipython pane
7 - This will trigger an error
I attach a couple of screenshots to make the explanation easier to follow.
For some reason, this only happens with imports.
Version information: tmux 2.0, Ubuntu GNOME 15.10, latest version of slimux.
Thanks
Line in question: https://github.com/epeli/slimux/blob/master/plugin/slimux.vim#L228
I've been using slimux for half a year now and I love it. Until recently I've been using bash as my default shell, but now I have really been enjoying fish (friendly interactive shell). I have found a problem whereby within a fish shell I start tmux, create two panes, open vim in the top pane and my repl in the bottom pane, I send the first line and hence select the bottom pane, but it appears in the top pane! The lines of vim get send back to vim and not to the repl!
If I repeat the above procedure from bash it works fine. Does anyone know what could cause this?
Thanks :)
In situations where you are making tweaks and repeatedly sending the same section of code, it would be helpful if you could just use marks and send a command like:
'a,'bSlimuxREPLSendSelection
It'd be cool if
:help slimux
brought up some of the documentation, just the commands in the readme and what they do would be great.
This is a great plugin that I use almost every day.
However, I have been facing issues with sending R code to the console. Whenever the code is small, I can send it to the console without any problem. However, when I select a big chunk and send to the console it breaks.
It seems that when the code is pasted on the console via tmux paste-buffer
, it gets somehow duplicated and I get an error. Whenever I copy and paste manually, the code is pasted correctly. Thus, I am not sure how to correct this problem.
I gave a go at escaping the R code by writing a custom function without any success:
function! SlimuxEscape_r(text)
"" Remove all empty lines and use soft linebreaks
let no_empty_lines = substitute(a:text, '\n\s*\ze\n', "", "g")
let no_empty_lines = substitute(no_empty_lines, "\n", "
", "g")
"" See if any non-empty lines sent at all
if no_empty_lines == "
"
return "
"
endif
"" Return the processed lines
return l:no_empty_lines, "
")."
"
endfunction
As an illustration, take the following code:
data.frame(
Intercept=1,
#aaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaa,
#aaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaa,
a = 23,
#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaaa,
#aaa = aaaa$aaa,
#aaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaa,
#aaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaaa,
b = 34,
#aaaaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaaaa,
c = 56,
#aaaaaaaaaa = aaaa$aaaaaaaaaa,
#aaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaa,
#aaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaa,
d = 56 #,
#aaaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaaa,
#aaaaaaaaaaaaaa = aaaa$aaaaaaaaaaaaaa,
#aaaaaaaaaaa = aaaa$aaaaaaaaaaa
)
Whenever I send to the console via :SlimuxREPLSendSelection<CR>
. The code is not pasted correctly and I get an error:
Error in data.frame(Intercept = 1, a = 23, b = 34, c = 56, aa$aaaaaaaaaaaaa, :
object 'aa' not found
However, if I copy and paste the above in the console it run without any problems.
Has anybody experienced a similar issue? Any way to fix it?
Does Slimux support ranges, like '5\s' to send the next 5 lines (similar to '5dd')? I get an E481: No range allowed if I try...
hi,guys.I see the video from @dvbuntu and decide to use the Slimux.
I install it by Vundle
,not the pathogen
.
Then i set the configure.
After that ,i want to test it .
But i don't how to use it in the tmux.
i use the C-c,C-c in the vim and C-b o change to another window, Then i don't know how to do .
Does everyone give me am example. Thanks.
I'm unable to send a single line (both with and without visual mode). Actually, only thing that works for me, is selecting more than one line in visual mode and using SlimuxREPLSendSelection.
Error detected while processing function SlimuxSendCode..<SNR>35_Send..<SNR>35_ExecFileTypeFn..SlimuxEscape_python:
line 44:
E121: Undefined variable: l:at_indent0
E15: Invalid expression: !l:at_indent0
@epeli confirmed that this is a Python-specific issue.
It would be great if I can set the current pane as default target pane. So that I don't need to config it for every new opened/reopened pane and no need to select the target pane among a list of panes. And it can also avoid the situation when you select a wrong pane, it could be messed up by the codes sent to it.
E.g. I have the following mapping
nmap j :SlimuxREPLSendLine
After sending a line to a tmux pane, the cursor is placed to the beginning of that line.
A lot of the time, I send line to tmux in insert mode using "j", and it is very inconvenient that the cursor position changes after that.
Would be nice if SlimuxREPLSendLine can be change to not change cursor position.
Hi,
I updated the linux version from centos 6 to centos 7, and when I try to send command with slimux to another tmux panel, I'm told
"
Enter: Select pane - Space/x: Test - C-c/q: Cancel
protocol version mismatch (client 7, server 8)
No additional panes found
"
Am I the only one who meet this problem in centos 7? How could I handle this ?
Thanks a lot!
:SlimuxREPLConfigure
The last step silently fails. Could Slimux prompt for a new target pane instead?
Everything works as expected however when sending an indented line, slimux doesn't cut indentation according the first line as I'd expect after looking at slimux/ftplugin/python.vim
The output of :scriptnames
lists the ftplugin, so I guess it's loaded. I tried sourcing it manually, still doesn't work.
Test file:
def test():
print "hello"
:SlimuxREPLSendLine
on the second line has the problem.
Vim log (truncated, started vim with -V9):
Executing BufEnter Auto commands for "*"
autocommand if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
Executing BufEnter Auto commands for "*"
autocommand sil! call s:LocalBrowse(expand("<amatch>"))
Calling shell to execute: "(tmux set-buffer -- ' print "hello"^M') >/tmp/vBj0Yn7/1 2>&1"
Calling shell to execute: "(tmux paste-buffer -t %1) >/tmp/vBj0Yn7/2 2>&1"
Executing CursorMoved Auto commands for "*"
autocommand call eclim#util#ShowCurrentError()
NerdTree before, eclim after, I am not sure whether it should display invoking SlimuxEscape_python.
Thank you for this plugin and your work.
I would like to report that sending from one vim to another works well in insert mode (as far as I have tried; i am a new user).
However, when the target vim is in normal mode the text is sent to a different location than the cursor position. It seems to prefer a particular position (i.e. it does not seem random as per my use).
It would be great if this would be solved. That is sending to another vim in normal mode would send the text to the position of the cursor.
Thank you
Slimux works quite well here.
But sometimes I split the panes, then the names of panes get messed up. Slimux gets confused of which pane to send the content.
Is there any way to bound slimux to a fixed pane?
It would be really great if it was possible to send any text object to REPL. For example, if I bind this function to gs
, I would be able to send 3 lines with gs2j
, or 2 paragraphs with gs2ap
. Or if I have a text object for entire buffer ae
, I could type gsae
to send the buffer.
I've come up with this:
" Send text object to tmux pane via slimux
nnoremap <silent> gs :<C-u>set opfunc=SlimuxREPLSendTextObject<CR>g@
nnoremap <silent> gss :SlimuxREPLSendLine<CR>
vnoremap <silent> gs :SlimuxREPLSendSelection<CR>
function! SlimuxREPLSendTextObject(type, ...) abort
let saved_unnamed_register = @@
silent exe "normal! '[V']y"
'[,']SlimuxREPLSendSelection
let @@ = saved_unnamed_register
endfunction
Note that it does not work with sub-line text objects, like iw
.
Is that screencast still available? The link seems broken.
It works pretty well with python, but the indentation seems to be messed up with ipython.
Hello,
Great plugin, invaluable to me. Having issues however, may have been on upgrade to iTerm2 3.0, not sure.
When I issue a SlimuxREPLSendLine, MacVim is unresponsive, with the cursor remaining in the vim command line (bottom).
Looking at running processes, seems to be tmux load-buffer -b Slimux -
the command that is causing the hanging. Killing that allows me to continue using vim.
Obviously I'm not able to send text out to the REPL however.
How to automatically set a pane to send commands to? Is this even possible?
This works perfectly fine ;
vim -
for i in range(1):
for j in range(1):
print 'Hello'
IPython [Using SlimuxREPLSendSelection] -
In [54]: for i in range(1):
....: for j in range(1):
....: print 'Hello'
....:
Hello
*Notice the spaces in my second indentation.
So when i try to indent back and do anything -
vim -
for i in range(1):
for j in range(1):
print 'Hello'
print 'BUG!'
IPython -
In [55]: for i in range(1):
....: for j in range(1):
....: print 'Hello'
....: print 'BUG!'
....:
File "<ipython-input-55-007af182e978>", line 4
print 'BUG!'
^
IndentationError: unindent does not match any outer indentation level
If you want to paste code into IPython, try the %paste and %cpaste magic functions.
IPython version : 4.2.1
vim version : 7.4
Any help would be appreciated, I really want to continue using Slimux.
Thank you.
Firstly, thanks for writing such an awesome plugin. Just one request, is it possible to configure slimux in any way such that when doing SlimuxREPLConfigure, it only suggests panes from the active session and not all the tmux sessions. I usually have more than one tmux session running, and it therefore ends up suggesting a long list of panes.
Thanks
In some cases there can be quite a few comment lines in the selected range and sending the comments to the target pane makes no sense. It would be great to have a flag/argument to SlimuxREPLSendSelection to strip out the comments before sending the selection to the target pane.
See 55a01a2#commitcomment-19102917 for details. An extraneous newline causes commands to be split up as follows:
/usr/bin/tmux
-V
instead of
/usr/bin/tmux -V
and the former causes shell errors.
SlimuxSendKeysLast prompts if one hasn't specified what to send, and then keeps sending that.
When someone uses SlimuxSendKeys command to send keys, however, the last sent gets overwritten and one would need to re-enter what was typed at the prompt.
I think separating the last-sent from the path by SlimuxSendKeys, and only involve the *Prompt and *Last commands it would avoid this problem.
I'm experiencing a problem, could this be a bug or am I doing something wrong? I'm using Vim 8.0.55 in tmux 2.3, Mac OS Sierra. Thank you!
:SlimuxSendKeys 'anything' <CR>
OR
:SlimuxSendKeys "traceback()" <CR>
Error detected while processing function SlimuxSendKeys[4]..<SNR>92_Send:
line 31:
E115: Missing quote: ' send-keys -t " . target . " " . keys)
E116: Invalid arguments for function system
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.