FakeVimのモードとコマンド
FakeVim モードでは、メインエディタでのほとんどのキー入力がインターセプトされ、Vimに似た方法で解釈されます。サポートされているコマンドのほとんどは、移動コマンドを続けて実行したり、ビジュアルモードで実行したり、レジスタと組み合わせて使用したり、繰り返し回数を前置して指定したりすることができます。
以下のセクションでは、サポートされているモードでエミュレートされるコマンドと、その機能がVimとどのように異なるかについて説明します:
- Normal
- ビジュアル
- コマンドライン (:)
- 挿入および置換
Vim の使用方法に関する詳細については、Vim ウェブサイトのVim ドキュメントを参照してください。
通常モードとビジュアルモード
h/j/k/l、<C-U>、<C-D>、<C-F>、<C-B>、gg、G、0、^などの基本的な移動、$- 単語の移動(例:
w、e)、b ciwや3dawなどの「Inner/a」の動き、ya{fおよびt移動[ and \c ]移動- { および } 段落の移動
- レジスタを使った削除・変更・ヤンク・貼り付け
- 元に戻すおよびやり直し
<C-A>および<C-X>10進数、8進数、16進数の形式で数値を増減します(例:128<C-A>を"0x0ff"の前またはその時点で実行すると、"0x17f"に変更されます).直前の変更を繰り返します/search、?search、*、#、n、N— Vim では正規表現の構文のほとんどが使用されますが、\<および\>は QRegExp の\bと同じである点が例外です@また、q(マクロの記録と実行)の特殊キーは、<S-Left>- マーク
gvは最後のビジュアル選択範囲に移動します。その周囲のテキストが編集されている場合は、移動先が異なる場合があります=、<<、>>を使用したインデント。移動、カウント、およびビジュアルモードでのインデント- 上/下への移動(例:
~、gU、gu i、a、o、I、A、およびO挿入モードへの移行- ウィンドウのスクロール(例:
zt、zb)、zz - 行の折り返し移動(例:
gj、gk、g0、g^)、g$
コマンドラインモード
:map、:unmap、:inoremapなど:sourcevimrc ファイルの各行をソースとして読み込み:substitute範囲内の式を置換する:'<,'>!cmd外部コマンドによるフィルタリング(例::%!sortを使用してファイル内の行をソートする):<range>sor[t][!]:.!cmd外部コマンドの標準出力を挿入する:read:yank、:delete、:change:move、:join:20特定のアドレスへ移動する:history:registers,:display:nohlsearch:undo,:redo:normal:<,:>set formatoptions=、Vimのドキュメントにある「:h fo-table」を参照してください。現在サポートされている文字:fo-j
挿入モード
<C-O>単一のコマンドを実行し、挿入モードに戻ります<C-V>生の文字を挿入します<insert>置換モードを切り替えます
オプション
:set ... を使用して、次の表にリストされているオプションを設定します:
| 正式名称 | 短縮名 | 引数 |
|---|---|---|
autoindent | ai | |
backspace | bs | indent,eol,start |
blinkingcursor | bc | |
clipboard | cb | |
expandtab | et | |
hlsearch | hls | |
ignorecase | ic | |
incsearch | is | |
iskeyword | isk | 以下の文字の組み合わせ:@,48-57,_,192-255,a-z,A-Z |
relativenumber | rnu | |
scrolloff | so | |
shiftwidth | sw | |
showcmd | sc | |
smartcase | scs | |
smartindent | si | |
smarttab | sta | |
startofline | sol | |
tabstop | ts | |
tildeop | top | |
usecoresearch | ucs | |
wrapscan | ws |
Vimrc の例
" highlight matched set hlsearch " case insensitive search set ignorecase set smartcase " search while typing set incsearch " wrap-around when searching set wrapscan " show pressed keys in lower right corner set showcmd " tab -> spaces set expandtab set tabstop=4 set shiftwidth=4 " keep a 5 line buffer for the cursor from top/bottom of window set scrolloff=5 " X11 clipboard set clipboard=unnamed " use ~ with movement set tildeop " mappings nnoremap ; : inoremap jj <Esc> " clear highlighted search term on space noremap <silent> <Space> :nohls<CR> " reselect visual block after indent vnoremap < <gv vnoremap > >gv " MOVE LINE/BLOCK nnoremap <C-S-J> :m+<CR>== nnoremap <C-S-K> :m-2<CR>== inoremap <C-S-J> <Esc>:m+<CR>==gi inoremap <C-S-K> <Esc>:m-2<CR>==gi vnoremap <C-S-J> :m'>+<CR>gv=gv vnoremap <C-S-K> :m-2<CR>gv=gv
「Vim のような編集」および「FakeVim」も参照してください 。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.