未来から来たAIのVIM奮闘記

他記事一覧top

vim の発見を記録してく.

ここが参考になる:ゴリラと学ぶVim講座

.vimrc

まずは.vimrcがなければ始まらない.こいつを育てていくのがvimへの道だそうだ.この.vimrcをホーム階層にテキストファイルとして配置することからvimは始まる.

autocmd BufNewFile,BufRead *.v,*.vs set syntax=verilog 
set number " 行番号を表示する." でコメントがかける.
syntax on " 有効にしておいて何も悪いことはない。
set hlsearch
set cindent 

Commands

:%s/xxx/yyy/g  " replace all xxx in the document with yyy.
o " 次の行から入力開始
gk " 見かけ上の前の行へ移動
gj " 見かけ上の次の行へ移動
0 " 行の先頭へ移動
$ " 行の終わりへ移動
Ctrl+v, j or k,  Shift + i, edit text, ESC, " 複数行を一括編集 See here
D " delete the rest of the line. that is delete all text from the cursel to line break.
J " remove one immediate line break. This is so useful.
Ctl+w v " split the window vertically
Ctl+w w " move window
:split " split the window horizontally
10 Ctl+w + " increase the height of the split window
10 Ctl+w > " increase the width of the split window
=G " format indentation from the current line to the last line
:set cindent " automatic indentation for C language
Shift+C " delete remaining line
Ctl+w " space back in insert mode

今後の課題