あっきぃ日誌

鉄道ブログのような技術系ブログのようななにか

Debian(Raspbian) Stretchのvimで変わった挙動をどうにかする

Raspbian Stretchから、vimをインストールしたあとで挙動がいろいろ変わってしまい、なかなか慣れませんね……。マウスで範囲選択しようとするとビジュアルモードに入ってしまってターミナルでコピペできなくなったり、貼り付けようとするとオートインデントが働いて貼り付けたい文書がぶっ壊れたり。viだと単機能すぎてつらいけど、このvimだと逆に機能モリモリ過ぎてキツい。

対処するには.vimrc書けばいいらしいんですが、オーバーライドするだけっぽいので、今回は根本から潰してみました。いや、.vimrc書いたほうが良いのかもしれんけど、まあ、こういうパラメータが影響しているというやつのまとめとして見てもらえたら良いかもしれません。

/etc/vim/vimrc.local からたどっていくと、大体は /usr/share/vim/vim80/defaults.vim に書かれていて、ここをいじれば良いようです。

ビジュアルモードの無効化

/usr/share/vim/vim80/defaults.vim の67行目あたり。"でコメントアウト

" In many terminal emulators the mouse works just fine.  By enabling it you
" can position the cursor, Visually select and scroll with the mouse.
if has('mouse')
  set mouse=a
endif

↓

" In many terminal emulators the mouse works just fine.  By enabling it you
" can position the cursor, Visually select and scroll with the mouse.
" if has('mouse')
"   set mouse=a
" endif

オートインデントを無効化する

/usr/share/vim/vim80/defaults.vim の92行目。

filetype plugin indent on

↓

filetype plugin indent off

カーソルが画面下 or 上まで行ってないのにスクロールされるのをやめる

/usr/share/vim/vim80/defaults.vim の42行目あたり。

" Show a few lines of context around the cursor.  Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5

↓

" Show a few lines of context around the cursor.  Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=0