注意(2020-10-31現在)
- インストール手順中の2箇所でエラーを確認しています。
- 調べた限りでは問題なさそうなのですが、確証がありません。
- それぞれのエラーのスナップショットに「問題なさそう」の根拠を書いています。
- プラグイン環境は整えましたが使っていません。
1.きっかけ
- ふと思い立ってメモツールを探し、CubNoteを見つける。
- 欲張って更に探してObsidianを見つける。気に入った。
- VIM操作環境を改善する。
- キーバインドを調べる道すがら、NeoVimを知る。
- アレコレして何となく分かる。 ← 今ココ
2.想定読者
-
Windows10
でvi環境を導入したいと思っている。 -
Windows10
でvim
/nvim
を導入して間もない。 -
nvim
を使いこなしているけど、気分転換に初だった頃の自分を振り返りたい。
3.方針
- この際だから、zip形式で提供されるソフトは
Scoop
で管理する。 -
bash
、perl
、python
、ruby
のスクリプトを書くことを想定する。- 動かす環境はcygwin。
-
nvim-gt
、PowerShellでnvim
、Cygwinでnvim
が使える。- 起動時のエラーまでは対処した
ginit.vim
/init.vim
を用意する。
- 起動時のエラーまでは対処した
4.Scoopのセットアップ
利用方針
- インストーラーがあるソフトは基本的にインストーラーを使う。
- Scoopに管理を任せるソフト
- インストール先が
c:\python
になるPython - zip形式で提供されるソフト。
- インストール先が
- Scoopにも対応してないソフトは
c:\Local
に置く。
前提
- Windows10利用者は一人。環境変数
SCOOP=c:\Scoop
と設定する。- 環境変数
SCOOP_GLOBAL
は効かなかった。 - 念の為
SCOOP_GLOBAL=c\:Scoop\global
で、システム変数に設定しておく。
- 環境変数
手順(PowerShell)
-
scoop uninstall scoop
(option)- 残っているフォルダーに「消したらヤバいもの」がないことを確認して削除。
-
set-executionpolicy unrestricted -s cu
(実行権限の設定) -
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
(インストール) -
scoop help
(確認) -
Get-Command scoop
(インストールされたフォルダーの確認) -
scoop install git
(事後処理の準備) -
scoop update
(事後処理)
5.NeoVimのセットアップ
前提
-
XDG_CONFIG=HOME=c:\Users\USERNAME\.config
を設定しておく。
手順(PowerShell)
scoop install neovim
手順(PowerShell)
:call dein#install()
のエラーの原因が不明のため、init.vim
についてはdein.vim
なしの内容になっています。(2020-10-30)
2. mkdir .cache
(dein公式の説明に従う。以降も同様に)
3. mkdir .cache\dein
4. Invoke-WebRequest https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.ps1 -OutFile installer.ps1
(インストラーのダウンロード)
5. Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
(実行権限の設定)
6. .\installer.ps1 .\.cache\dein
(インストール)
- エラーと思われる赤いメッセージが表示されるが、目的のものは入っているように見える。
7. 実行時にメッセージで案内されるコードをinit.vom
に挿入する。
設定ファイル(2020-10-30現在)
ginit.vimとinit.vimの棲み分け
-
nvim.exe
、nvim-qt.exe
共通の設定はinit.vim
に書く。 -
ctermfg
、ctermbg
の設定は、nvim-qt.exe
にも有効。-
nvim-qt.exe
限定にする時は、guifg
、guibg
を使う。
-
ginit.vim
set guifont=Cica:h16
set guifontwide=Cica:h16
init.vim
- 本来は絶対パスが表示されている箇所を、
$HOME
に置き換えています。 - インストーラーが提案した内容に加えて「dein#check_install()」を追加。
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,cp932
set fileformats=unix,dos,mac
set whichwrap=b,s,[,],,~
set number
set smartindent
set showcmd
set ruler
set cursorline
set incsearch
set t_Co=256
highlight Normal ctermbg=black ctermfg=grey
highlight StatusLine ctermfg=black ctermbg=grey
highlight CursorLine ctermbg=darkgray
highlight Search guifg=red guibg=darkblue
if &compatible
set nocompatible
endif
set runtimepath+=$HOME\.cache\dein\repos\github.com\Shougo\dein.vim
if dein#load_state('$HOME\.cache\dein')
call dein#begin('$HOME\.cache\dein')
call dein#add('$HOME\.cache\dein\repos\github.com\Shougo\dein.vim')
"call dein#add('Shougo/neosnippet.vim')
"call dein#add('Shougo/neosnippet-snippets')
call dein#end()
call dein#save_state()
endif
filetype plugin indent on
syntax enable
if dein#check_install()
call dein#install()
endif
6.NetVimで使うフォントを入れる
- フォントをダウンロードして、ZIPを解凍。
- Windows10の設定を呼び出して「フォント」で検索。
- 「フォント設定」を選んぶ。
- 画面で指定されている場所にフォントファイルをドラッグ&ドロップ
7.参考ページ一覧
Scoop
- https://qiita.com/eamat/items/c91be7a9eb71a709b32b (手順)
- https://nodachisoft.com/common/jp/article/jp000013/ (環境変数)
NeoVim
- https://vim.blue/what-is-neovim/ (概要の理解)
- https://qiita.com/kishiro/items/b11a50dd287f503e56aa (手順)
- https://vim.blue/neovim-setting-file-path/ (環境変数)
- https://github.com/Shougo/dein.vim (dein.vim公式)
- https://qiita.com/huyu398/items/587161b0709e84c141a4 (ペースト問題の解説)
フォント
- https://ikuchan-web.com/prgraming-font-install/ (手順)
- https://vim.blue/guifont-settings/ (おすすめフォント)
- https://github.com/miiton/Cica (Cica、使用中)
- https://hkmc.jp/note/vim/neovim_clipboard.html (クリップボードへのYank)
8.トラブル
インストール時(コピペ)
- 本来は絶対パスが表示されている箇所を、
$HOME
に置き換えています。
PS $HOME> .\installer.ps1 .\.cache\
Install to "$HOME\.cache\repos\github.com\Shougo\dein.vim"...
Begin fetching dein...
git.exe : Cloning into '$HOME\.cache\repos\github.com\Shougo\dein.vim'...
発生場所 C:\Scoop\shims\git.ps1:3 文字:69
+ ... n.expectingInput) { $input | & $path @args } else { & $path @args }
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Cloning into 'C...go\dein.vim'...:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Done.
Please add the following settings for dein to the top of your vimrc (Vim) or init.vim (NeoVim) file:
"dein Scripts-----------------------------
…
インストール時(スナップショット)
コマンド実行時(スナップショット)
init.vim
内に dein#check_install()
による判定を入れ、起動時のエラーはなし。