VIMを使う (2)

VIMからコピーして他のアプリケーションにペーストするには?

vim、gvim まとめて VIM と言います。
他のアプリケーションにコピーするには、VIM からクリップボードへコピーする必要がある。

===== コピー開始 =====
コピーしたい文章のはじめにカーソルを置いて、

[ v ] とコマンドする。
  ( --ビジュアル-- (--VISUAL--) モードになる。)

コピーしたい文章の終わりにカーソルを移動して、
  (コピーしたい文章が反転している状態)

[ "+y ] とコマンドする。
===== コピー完了 =====


クリップボードへコピーが出来たら、通常どおりにペースト( Ctrl+v )出来る。
マウスの右クリックから「貼り付け」でも良い。

===== ペースト =====
[ Ctrl + v ] でペースト出来る。
===== ペースト =====



他のアプリケーションから、VIMにペーストするには?

クリップボードに入ったものを VIM にペーストするコマンドを使う。

===== ペースト開始 =====
ペーストしたい所にカーソルを置いて、

[ "+P ] とコマンドする。(カーソルの前に挿入)

[ "+p ] とコマンドする。(カーソルの後ろに挿入)

マウスの右クリックから「貼り付け」を選ぶ。
===== ペースト完了 =====


[:help usr_09.txt] するとマニュアルが見れます。



あとがき

VIM からのコピー&ペーストはマウスを使うと簡単だけど、知っていると何かの役に立つかな~と。
vi (TTY) で行数を表示(:set number)してマウスでコピーする時に、行数まで反転されてコピーされてしまうので、今まで[:set nonumber]してからやってたりしてた。
(gvimでは問題ないけど。)
ビジュアルモードから今回のようにコピーすれば、行数も反転されずにコピー出来ることがわかったし、マニュアル(説明書)は読まないとダメだな~と。

VIM のマニュアルっておもしろいね。
vimtutor には「オマエモナー」とかあったし。授業なんかで使う時にあると楽しいよね。
:help usr_02.txt には、こんな文もあった。

<:help usr_02.txt>
*usr_02.txt*    For Vim version 7.3.  Last change: 2010 Jul 20

VIM USER MANUAL - by Bram Moolenaar

The first steps in Vim


This chapter provides just enough information to edit a file with Vim. Not
well or fast, but you can edit. Take some time to practice with these
commands, they form the base for what follows.

|02.1| Running Vim for the First Time
|02.2| Inserting text
|02.3| Moving around
|02.4| Deleting characters
|02.5| Undo and Redo
|02.6| Other editing commands
|02.7| Getting out
|02.8| Finding help

<----- 前後省略 ----->

One way to remember these commands is that h is on the left, l is on the
right and j points down. In a picture: >

k
h l
j

The best way to learn these commands is by using them. Use the "i" command to
insert some more lines of text. Then use the hjkl keys to move around and
insert a word somewhere. Don't forget to press <Esc> to go back to Normal
mode. The |vimtutor| is also a nice way to learn by doing.

For Japanese users, Hiroshi Iwatani suggested using this:

Komsomolsk
^
|
Huan Ho <--- ---> Los Angeles
(Yellow river) |
v
Java (the island, not the programming language)

============================================================================
<----- 以下省略 ----->

日本から見た方向?で言っているのかな??