2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Vimのヘルプの見方

Posted at

自分はVimの操作をすぐに忘れてしまって、インターネット検索に頼ってばかりいて、いちいち面倒だなあと思っていたのですが、ヘルプの見方が少しわかっただけで楽になったので共有したいと思います。

Vimの基本操作

コマンドラインからvimtutorと入力すると、Vimのチュートリアルが見られます。
まずはこれで基本操作を覚えます。ヘルプを見るのにも必要になってくるので…。

ヘルプの開き方

Vimを起動して:hしてEnter
(:helpでも同じ)

ヘルプの見方

  • 基本的なことはヘルプを開いた直後の画面に書いてあります。
  • 編集画面と同じように、ヘルプ画面の中を移動できます。
  • ヘルプは内容ごとに複数のページで構成されていて、CTRL-]で別のページにジャンプできます。(タグジャンプ)。前のページに戻るときはCTRL-Oです。(ヘルプを開いた直後のページに書いてあります)

よく使うコマンドを調べる

ヘルプを1ページ分くらい下にスクロールすると、以下のような記述が見つかります。

BASIC:
quickref        Overview of the most common commands you will use

このquickrefという文字のところまでカーソルを移動してタグジャンプCTRL-]すると、よく使うコマンドのページにジャンプできます。こんな感じのページにジャンプするはずです。

                                                           quickref Contents
   tag      subject                        tag      subject
  Q_ct    list of help files              Q_re    Repeating commands
  Q_lr    motion: Left-right              Q_km    Key mapping
  Q_ud    motion: Up-down                 Q_ab    Abbreviations
  Q_tm    motion: Text object             Q_op    Options
  Q_pa    motion: Pattern searches        Q_ur    Undo/Redo commands
  Q_ma    motion: Marks                   Q_et    External commands
  Q_vm    motion: Various                 Q_qf    Quickfix commands
  Q_ta    motion: Using tags              Q_vc    Various commands
  Q_sc    Scrolling                       Q_ce    Ex: Command-line editing
  Q_in    insert: Inserting text          Q_ra    Ex: Ranges
  Q_ai    insert: Keys                    Q_ex    Ex: Special characters

motion(移動)、insert(挿入)…など、やりたいことごとに、さらにタグジャンプできるようになっています。

Q_de    change: Deleting text

自分は行末の改行を削除して次の行とくっつけるということをしたかったので、ここからジャンプしました。

J       N  J            join N-1 lines (delete <EOL>s)

ジャンプした先でこのような記述を見つけました。大文字のJをタイプするだけで良いようだとわかりました。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?