是否可以从 capistrano 任务启动 vim?
Is it possible to launch vim from a capistrano task?
我想将 capistrano 用于远程服务器上与部署不直接相关的一组自定义任务,如果我可以开始 vim 使用 capistrano,这对我来说会很有用,我已经尝试过这个:
set :pty, true
execute "vim #{shared_path}/my_file.txt"
但我收到了这个(原因很明显)
01 stdin: is not a tty
01 Vim: Warning: Output is not to a terminal
01 Vim: Warning: Input is not from a terminal
不管怎么说,它都能正常工作吗?
据我所知,没有终端就无法启动 vim。您可以启动一个带有 vim 的终端,这里有几种方法可以做到这一点:
启动终端,如 st、xterm 或类似终端。示例:
x-terminal-emulator -e vim
st -e vim
xterm -e vim
这个解决方案不是最好的,因为终端仿真器可以有不同的开关来执行调用命令。 -e 正在为 st 和 xterm 工作。
更好的解决方案是启动一个 shell,如 zsh,bash 或类似的,因为几乎每个 shell 都使用相同的开关,即 - c 直接在里面启动一个程序。示例:
zsh -c vim
bash -c vim
我想将 capistrano 用于远程服务器上与部署不直接相关的一组自定义任务,如果我可以开始 vim 使用 capistrano,这对我来说会很有用,我已经尝试过这个:
set :pty, true
execute "vim #{shared_path}/my_file.txt"
但我收到了这个(原因很明显)
01 stdin: is not a tty
01 Vim: Warning: Output is not to a terminal
01 Vim: Warning: Input is not from a terminal
不管怎么说,它都能正常工作吗?
据我所知,没有终端就无法启动 vim。您可以启动一个带有 vim 的终端,这里有几种方法可以做到这一点:
启动终端,如 st、xterm 或类似终端。示例:
x-terminal-emulator -e vim
st -e vim
xterm -e vim
这个解决方案不是最好的,因为终端仿真器可以有不同的开关来执行调用命令。 -e 正在为 st 和 xterm 工作。
更好的解决方案是启动一个 shell,如 zsh,bash 或类似的,因为几乎每个 shell 都使用相同的开关,即 - c 直接在里面启动一个程序。示例:
zsh -c vim
bash -c vim