0

I use SublimeText3 (Sublime Text Build 3059) to edit my code and terminal (trough screen (Screen version 4.01)) to execute it. To send code lines into screen automatically I use Sublime plugin SendText.

My problem is when I select more than 16 lines of code screen can't execute them and gives "Remote command too long" error.

My questions are:

  1. Is it possible to solve this problem (send much more lines of code into screen)?
  2. Is there an alternative way to send Sublime code lines into terminal/screen?
pogibas
  • 27,303
  • 19
  • 84
  • 117

1 Answers1

2

This is problem related to max length of screen's command. It is not connected with number of lines of selection.

There's pull request about this on SendText repo

if you want to have it ASAP, do the following:

# add in 
# class SendSelectionCommand(sublime_plugin.TextCommand):

        elif prog == "screen":
            # Get the full pathname of the tmux, if it's
            progpath = settings.get('paths').get('screen')
            # If path isn't specified, just call without path
            if not progpath:
                progpath = 'screen'

            if len(selection)<2000:
                subprocess.call([progpath, '-X', 'stuff', selection])
            else:
                with tempfile.NamedTemporaryFile() as tmp:
                    with open(tmp.name, 'w') as file:
                        file.write(selection)
                        subprocess.call([progpath, '-X', 'stuff', ". %s\n" % (file.name)])

From now on you are able to execute unlimited number of lines :).

test30
  • 3,496
  • 34
  • 26
  • there is limitation in max length of arguments passed via command line. This solution uses intermediate temp file for passing selected text. – test30 Apr 29 '15 at 13:09