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?

More than 3 years have passed since last update.

nvimでcocをセットアップする

Posted at

coc

セッティング

~/.config/nvim/init.vim
" Use release branch (recommend)
Plug 'neoclide/coc.nvim', {'branch': 'release'}

" Or build from source code by using yarn: https://yarnpkg.com
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}

PlugInstallでインストールする

cocでは、LSPのマネージャーとしても動作する。
LSPというのは、Language Server Protocolという、Microsoftが言い始めた概念のよう。

例えば、Go用のLSPをインストールする場合このような感じでインストールする。

CocInstall coc-go

インストール済の拡張機能を確認するコマンド

CocList extenstion

terraform-lspを使う場合は、Coc-Installからはダウンロードできないようで、下記でセッティングする。

lspのバイナリをダウンロード

wget https://github.com/juliosueiras/terraform-lsp/releases/download/v0.0.12/terraform-lsp_0.0.12_linux_amd64.tar.gz
tar xvzf terraform-lsp_0.0.12_linux_amd64.tar.gz
sudo mv terraform-lsp /usr/local/bin/

:CocConfigを実行すると表示されるので、下記のようにする

~/.config/nvim/coc-settings.json
{
	"languageserver": {
    "terraform": {
      "command": "terraform-lsp",
      "filetypes": ["terraform"],
      "initializationOptions": {}
    }
	}
}

このような感じで、普段使っているIDEみたく補完が効くようになる

image.png

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?