using xargs vim with gnu screen

匿名 (未验证) 提交于 2019-12-03 01:39:01

问题:

I've got a weird problem where if i do something like this in a gnu screen window, that window starts responding in weird ways

ls *.cpp | xargs vim 

After I exit from vim, the screen window doesn't echo any command. It even does not echo CR.

Any suggestions?

回答1:

Piping changes vim's stdin and causes problems. Try this instead (for bash, zsh, etc.):

vim $(find . -name "*.cpp") 


回答2:

How about vim *.cpp?

Maybe for file in *.cpp; do vim "$file"; done could work too. Edit each file and exit.

Or start vim and add all cpp files with following command: :argadd *.cpp



回答3:

When using Vim in a pipe like this, you'll probably notice the following warning:

Vim: Warning: Input is not from a terminal 

That's Vim telling you that it cannot function as it's supposed to be (i.e. in interactive mode; you can still use it in "batch mode" by feeding it Ex commands to process). That explains the weirdness you experience after Vim quits.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!