LoginSignup
0
1

More than 3 years have passed since last update.

【Windows10】NetVim環境を一から整える(with scoop)

Last updated at Posted at 2020-10-31

注意(2020-10-31現在)

  • インストール手順中の2箇所でエラーを確認しています。
  • 調べた限りでは問題なさそうなのですが、確証がありません。
    • それぞれのエラーのスナップショットに「問題なさそう」の根拠を書いています。
  • プラグイン環境は整えましたが使っていません。

1.きっかけ

  1. ふと思い立ってメモツールを探し、CubNoteを見つける。
  2. 欲張って更に探してObsidianを見つける。気に入った。
  3. VIM操作環境を改善する。
  4. キーバインドを調べる道すがら、NeoVimを知る。
  5. アレコレして何となく分かる。 ← 今ココ

2.想定読者

  • Windows10でvi環境を導入したいと思っている。
  • Windows10vim/nvimを導入して間もない。
  • nvimを使いこなしているけど、気分転換に初だった頃の自分を振り返りたい。

3.方針

  • この際だから、zip形式で提供されるソフトはScoopで管理する。
  • bashperlpythonrubyのスクリプトを書くことを想定する。
    • 動かす環境は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) 
  • mkdir .cache (dein公式の説明に従う。以降も同様に)
  • mkdir .cache\dein
  •  Invoke-WebRequest https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.ps1 -OutFile installer.ps1 (インストラーのダウンロード)
  • Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser (実行権限の設定)
  • .\installer.ps1 .\.cache\dein (インストール)
    • エラーと思われる赤いメッセージが表示されるが、目的のものは入っているように見える。
  • 実行時にメッセージで案内されるコードをinit.vomに挿入する。

設定ファイル(2020-10-30現在)

ginit.vimとinit.vimの棲み分け

  • nvim.exenvim-qt.exe共通の設定はinit.vimに書く。
  • ctermfgctermbgの設定は、nvim-qt.exeにも有効。
    • nvim-qt.exe限定にする時は、guifgguibgを使う。 ### 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で使うフォントを入れる

  1. フォントをダウンロードして、ZIPを解凍。
  2. Windows10の設定を呼び出して「フォント」で検索。
  3. 「フォント設定」を選んぶ。
  4. 画面で指定されている場所にフォントファイルをドラッグ&ドロップ

7.参考ページ一覧

Scoop

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-----------------------------

インストール時(スナップショット)

「標準エラーの出力先云々」という説明を見つけた。
2020-10-31 deinInstall.png

コマンド実行時(スナップショット)

init.vim 内に dein#check_install() による判定を入れ、起動時のエラーはなし。
2020-10-31 deinCall.png

9.雑感

以上

0
1
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
1