【问题标题】:SublimeText with screen: Remote command too long带屏幕的 SublimeText:远程命令太长
【发布时间】:2014-08-25 11:10:14
【问题描述】:

我使用 SublimeText3 (Sublime Text Build 3059) 来编辑我的代码和终端(通过screen (Screen version 4.01))来执行它。为了将代码行自动发送到屏幕上,我使用了 Sublime 插件SendText

我的问题是当我选择超过 16 行代码时屏幕无法执行它们并给出“远程命令太长”错误。

我的问题是

  1. 是否有可能解决这个问题(将更多的代码行发送到屏幕上)?
  2. 是否有其他方法可以将 Sublime 代码行发送到终端/屏幕?

【问题讨论】:

  • 什么操作系统? linux还是mac?

标签: screen sublimetext3 sublime-text-plugin


【解决方案1】:

这是与屏幕命令的最大长度有关的问题。它与选择的行数无关。

SendText repo 上有关于此的拉取请求

如果您想尽快获得它,请执行以下操作:

# 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)])

从现在开始,您可以无限执行行数:)。

【讨论】:

  • 通过命令行传递的参数的最大长度有限制。此解决方案使用中间临时文件来传递选定的文本。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-11-25
  • 1970-01-01
  • 2023-01-23
  • 2011-09-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多