読者です 読者をやめる 読者になる 読者になる

破棄されたブログ

このブログは破棄されました。

find したファイル(たち)を Vim でまとめて開く方法

Vim7 のマニュアルからはなぜか消えてるけど、Vim7 でも使える。

3. Running Vim from xargs					*xargs*

The xargs program can be used to start a program with arguments that come from
stdin.  A typical example:

 find . -name "*.c" -print | xargs vim

A problem is that stdin for the program run by xargs is not setup properly,
which causes problems for Vim.  That is because Vim expects commands to come
from stdin.  The symptoms are that typed characters are echoed and don't take
effect until <Return> is hit.

This is really a problem in xargs.  To work around it, you can use this small
program:

 #include <unistd.h>
 #include <stdio.h>

 main(argc, argv)
 int argc;
 char **argv;
 {
 close(0); /* close stdin */
 dup(2); /* duplicate stdin from stderr */
 execvp(argv[1], argv + 1);
 perror("could not execute program");
 }

Store this in "start.c", compile it to "start" and put it somewhere in your
search path.  You might have to make a few adjustments for your system.  An
example of using this:

 find . -name "*.c" -print | xargs start vim
広告を非表示にする