Summery
コンソール上のテキストエディタ。
機能を豊富に持った、上位のvimなどもありますが、viが使えれば、vimもOK。
これに慣れると、もうテキストエディタがチンケに見えてしかたがないらしい。(ホントか??)
Construction
$ vi [file-path]
Command
追記モード : a
挿入モード : i
モードから抜ける : [etc]
アンドゥー:u
コピペ
・1行コピー:yy
・1行カット:dd
・ペースト:p
・複数行削除:
1、開始行「ms」
2、終了行「me」
3、「:'s,'ed」
・複数行コピー:
1、開始行「ms」
2、終了行「me」
3、「:'s,'ey」+エンター
4、「p」
検索
・前方検索:/正規表現
・後方検索:?正規表現
・次の候補:n
・前の候補:N
カーソル
・行頭:0
・行末:$
・次画面:ctl+f
・前画面:ctl+b
Caution
ファイルを開く時に、権限に注意する事。
権限のないファイルをひらいてしまうと、保存ができないので、悲しい結末に・・・
Sample
# 行番号の表示
:set number
# データを保存
:w
# ファイルを閉じる(終了)
:q
# ファイルを閉じる時に保存もする
:wq
Discription
Vim is a text editor that is upwards compatible to Vi. It can be used to edit all
kinds of plain text. It is especially useful for editing programs.
There are a lot of enhancements above Vi: multi level undo, multi windows and buffers,
syntax highlighting, command line editing, filename completion, on-line help, visual
selection, etc.. See ":help vi_diff.txt" for a summary of the differences between Vim
and Vi.
While running Vim a lot of help can be obtained from the on-line help system, with the
":help" command. See the ON-LINE HELP section below.
Most often Vim is started to edit a single file with the command
vim file
More generally Vim is started with:
vim [options] [filelist]
If the filelist is missing, the editor will start with an empty buffer. Otherwise
exactly one out of the following four may be used to choose one or more files to be
edited.
file .. A list of filenames. The first one will be the current file and read into
the buffer. The cursor will be positioned on the first line of the
buffer. You can get to the other files with the ":next" command. To edit
a file that starts with a dash, precede the filelist with "--".
- The file to edit is read from stdin. Commands are read from stderr, which
should be a tty.
-t {tag} The file to edit and the initial cursor position depends on a "tag", a
sort of goto label. {tag} is looked up in the tags file, the associated
file becomes the current file and the associated command is executed.
Mostly this is used for C programs, in which case {tag} could be a func-
tion name. The effect is that the file containing that function becomes
the current file and the cursor is positioned on the start of the func-
tion. See ":help tag-commands".
-q [errorfile]
Start in quickFix mode. The file [errorfile] is read and the first error
is displayed. If [errorfile] is omitted, the filename is obtained from
the 'errorfile' option (defaults to "AztecC.Err" for the Amiga,
"errors.err" on other systems). Further errors can be jumped to with the
":cn" command. See ":help quickfix".
Vim behaves differently, depending on the name of the command (the executable may
still be the same file).
vim The "normal" way, everything is default.
ex Start in Ex mode. Go to Normal mode with the ":vi" command. Can also be
done with the "-e" argument.
view Start in read-only mode. You will be protected from writing the files. Can
also be done with the "-R" argument.
gvim gview
The GUI version. Starts a new window. Can also be done with the "-g" argu-
ment.
evim eview
The GUI version in easy mode. Starts a new window. Can also be done with
the "-y" argument.
rvim rview rgvim rgview
Like the above, but with restrictions. It will not be possible to start
shell commands, or suspend Vim. Can also be done with the "-Z" argument.
0 件のコメント:
コメントを投稿