macOSを使っています
ターミナルソフトはAlacrittyかiterm シェルはzsh
以前vimを使っていたがほとんど忘れてしまったからまた一からやり直したい
以前の設定ファイル・プラグインは全て削除した
1,最低限のinit.vim
1, init.vimとは
neovimの設定ファイル
vimで言う.vimrc
vimscriptで書かれている
2, init.vimの場所
~/.config/nvim/init.vim
なかったら作る(↓作り方)
terminal
$mkdir .config/nvim
$cd .config/nvim
$nvim init.vim
3, init.vimのスクリプト
誰かが作ってるやつを必要そうなやつだけ少しずつパクらさせていただいています
init.vim
set encoding=utf-8 "文字コード
setnumber "行番号を表示
set title "ファイル名を表示
set splitbelow "新しいウィンドウを下に開く
set splitright "新しいウィンドウを右に開く
set noequalalways "ウィンドウサイズの自動調整を無効に
set wildmenu "wildmenuオプションを有効
set hls "検索結果をハイライト
set ruler "カーソルの位置表示を行う
set clipboard=unnamed "ヤンクでクリップボードにコピー
set showmatch "対応する括弧を強調表示
set nrformats= "すべての数を10進数として扱う
set expandtab "入力モードでTabキー押下時に半角スペースを挿入
set tabstop=4 "タブ文字の表示幅
set shiftwidth=2 "インデント幅
2, dein.vimの基本設定
1, dein.vimとは?
暗黒美無王Shougoさんが作っているvimのpluginを管理するためのplugin
https://github.com/Shougo/dein.vim
2, dein.vimのインストール
https://github.com/Shougo/dein.vimに書いてあるようにするだけでいい
ターミナルで
terminal
$curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh
$sh ./installer.sh ~/.cache/dein
次に、init.vimに
init.vim
"dein.vim settingif&compatible
set nocompatible
endif" Add the dein installation directory into runtimepathset runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vimif dein#load_state('~/.cache/dein')call dein#begin('~/.cache/dein')"Load TOMLcall dein#load_toml('~/.config/nvim/dein.toml',{'lazy':0})call dein#load_toml('~/.config/nvim/dein_lazy.toml',{'lazy':1})call dein#end()call dein#save_state()endifif dein#check_install()call dein#install()endiffiletype plugin indent on
syntax on
と書いてvimを再起動
3, dein.vimのpluginをtomlを使って管理
tomlを使うとvimの起動時に起動するpluginと遅延して起動するpluginを分けて設定することができる
terminal
~/.config/nvim $nvim dein.toml
とdein.tomlを作成
dein.toml
[[plugins]]repo='Shougo/dein.vim'
とする
terminal
~/.config/nvim $nvim dein_lazy.toml
dein_lazy.tomlという名前の空ファイルを作って保存しておく
これでpluginのインストールは楽になる
3, colorschemeの設定
デフォルトは見づらいからcolorschemeだけ設定する
プラグインとカラースキームとかは https://vimawesome.comから検索できる
なかなか便利
今回はmaterialを使う
dein.tomlに
dein.toml
[[plugins]]repo='jdkanani/vim-material-theme'
をつけたす
init.vimの最後に
init.vim
set termguicolors "重要!!
set background=darkcolorscheme material-theme
これでcolorschemeのインストールは完了
次回はコマンドかな?