Extra newline in my repl #9

Closed
trptcolin opened this Issue Apr 11, 2012 · 3 comments

Projects

None yet

3 participants

First off, this project rules, and I'm excited about the prospect of improving my very crappy, low-tech Clojure workflow.

When I send things to my buffer via the tslime replacement instructions in the readme (vmap <LocalLeader>vs "vy :call RunVimTmuxCommand(@v)<CR>), things work great except it sends an extra newline. Removing the word "Enter" from vimux.vim makes that unnecessary, but of course means an extra Enter press is necessary for firing up the REPL.

Any tips?

I'm wondering if there's a way to expose these two different use cases so I could use different shortcuts? Or if it's more likely I'm just doing something wrong :)

Owner

Thanks for letting me know about this. I do think I might pull the "tslime" behavior into vimux as a first-class function since they have different use cases.

I noticed this, too. However, might it not be solved simply by checking to see if the incoming text ends with a newline character? Essentially, don't send the enter key if the text ends with a newline character.

I tried to get this to work, but I ran into a bit of a snag. I attempted to remove the trailing newline character with chomp

def _send_command
    _run("send-keys -t #{target} '#{command.chomp.gsub("'", "\'")}'")
    ....

This actually works pretty well and seems to accomplish the goal (I am not a ruby programmer though ... so I may be wrong here). However, for a REPL like python, there can be a problem.

Let's say we send over a block of code (using vip) that comprises a def. The python interpreter needs an additional Enter in this situation in order to break free of the def intialization. I am not sure how it might be possible to create a solution to this problem without causing other problems. Any thoughts?

@benmills benmills closed this in c853343 Apr 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment