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

新環境構築:NeoVim/VSCode NeoVim拡張機能でのスペルチェックの無効化方法

1
Posted at

はじめに

  • ここではNeoVim / VSCode NeoVim拡張機能を使用した際のバグっぽいスペルチェックエラーの解決方法を記載します。
  • 私の環境では日本語や固有名詞はすべてこの赤波線が引かれていました。

発生イメージ

image.png

解決方法

.config/nvim/lua/config/autocmds.luaに以下を追加し再読込します。

-- すべてのファイル形式に対してスペルチェックを無効化したい場合
vim.api.nvim_create_autocmd("FileType",{
    pattern = "*",
    command = "setlocal nospell",
})

-- ↑ or ↓

-- 特定のファイル形式に対してスペルチェックを無効化したい場合
vim.api.nvim_create_autocmd("FileType",{
    pattern = "<無効化したいファイルタイプ> ex:markdown",
    command = "setlocal nospell",
})

原因

試したこと

~/.config/nvim/lua/config/options.luaに以下を追加しました。
通常であればこういった設定の記述で修正できるものですが今回は異なりました。

vim.opt.spell = false

解決方法ソース

原因予測

  1. NeoVim起動
  2. vim.opt.spell = falseが実行される
  3. LazyVim内部のautocmdFileTypeの識別イベント時にspellを有効化
  4. スペルチェックが有効化される
  5. スペルチェックエラー発生

そのため、今回はそのFileType識別イベントに対し、設定を上書きすることで対抗します。

最後に

いいねをいただけると泣いて喜びます ☺️

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