0
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ちょっとメモ

Last updated at Posted at 2020-04-22

最近覚えた

置換前ワードを検索後に置換するとき

置換前ワードを検索で確認してから置換する場合置換前ワードを2回打ち込んでいた。
hogeをfugaに置換する場合hogeを省略できる。

/hoge
%s//fuga/

行番号

カーソル位置からの相対的な行番号表示
コピペが捗る

set relativenumber 

行番号の表示と同時にはできない。
行番号の表示を有効にするとカーソル行の行番号のみ表示される。
行番号の表示を無効にするとカーソル行は0を表示する。

set number

インデント調整

インデントを一段下げる,上げる
shiftwidthの値分インデントする

>>
<<

入力中に下げるとき

Ctrl+T

入力中に上げるとき

Ctrl+D

いつも再検索してしまう

文字コード変換

今開いているファイルが読めないときは文字コードを変更して再読込

e ++enc=utf-8
e ++enc=sjis
e ++enc=euc-jp

保存するときの文字コード指定

set fenc=utf-8
set fenc=sjis
set fenc=euc-jp

今の文字コードの確認

set enc=?
est fenc=?

改行コード変換

改行コードの確認

set ff?

改行コードを変更して開き直し

e ++ff=unix
e ++ff=dos
e ++ff=mac
0
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
0
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?