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?

個人的vimめも。

Last updated at Posted at 2025-02-10

はじめに

個人的vimrc設定とか便利機能とか。随時更新。

.vimrc
" setting
"文字コードをUFT-8に設定
set fenc=utf-8
" バックアップファイルを作らない
set nobackup
" スワップファイルを作らない
set noswapfile
" 編集中のファイルが変更されたら自動で読み直す
set autoread
" バッファが編集中でもその他のファイルを開けるように
set hidden
" 入力中のコマンドをステータスに表示する
set showcmd


" 見た目系
" 行番号を表示
set number
" 現在の行を強調表示
set cursorline
" 現在の行を強調表示(縦)
" 行末の1文字先までカーソルを移動できるように
set virtualedit=onemore
" インデントはスマートインデント
set smartindent
" ビープ音を可視化
set visualbell
" 括弧入力時の対応する括弧を表示
set showmatch
" ステータスラインを常に表示
set laststatus=2
" コマンドラインの補完
set wildmode=list:longest
" 折り返し時に表示行単位での移動できるようにする
nnoremap j gj
nnoremap k gk
" シンタックスハイライトの有効化
syntax enable


" 検索系
" 検索文字列が小文字の場合は大文字小文字を区別なく検索する
set ignorecase
" 検索文字列に大文字が含まれている場合は区別して検索する
set smartcase
" 検索文字列入力時に順次対象文字列にヒットさせる
set incsearch
" 検索時に最後まで行ったら最初に戻る
set wrapscan
" 検索語をハイライト表示
set hlsearch
" ESC連打でハイライト解除
nmap <Esc><Esc> :nohlsearch<CR><Esc>

set undofile

packadd termdebug 
set mouse=a
let g:termdebug_wide = 163

filetype plugin on

"ウィンドウ操作
nnoremap wh <C-w>h
nnoremap wj <C-w>j
nnoremap wk <C-w>k
nnoremap wl <C-w>l

"ウィンドウサイズ変更
nnoremap >> <C-w>>
nnoremap << <C-w><
nnoremap ++ <C-w>+
nnoremap -- <C-w>-

"Netrwをツリー状に
let g:netrw_liststyle = 3

検索系

例えばcファイルに絞って検索。

:vimgrep パターン *.c

以下の方が速い。

:grep -rnF パターン *.c

quickfixで検索結果一覧に飛べるようになる。

:copen

Netrw

標準プラグインのファイルエクスプローラー。
以下を.vimrcに追記する。

"netrw有効
filetype plugin on

ツリー状に表示するにはvimrcに以下を追加する。

let g:netrw_liststyle = 3

エクスプローラーを開きたいディレクトリで以下実行。

vim .

o:水平に開く
v:垂直に開く
t:新しいタブで開く

参考にさせて頂いた方々

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?