バッファが切り替わったタイミングで`filetype`が`aerial`の場合、`MiniCursorword`のハイライトを無効化する。 ```lua require('mini.cursorword').setup() vim.api.nvim_create_autocmd('BufEnter', { pattern = '*', callback = function() local filetype = vim.bo.filetype if filetype == 'aerial' then vim.api.nvim_set_hl(0, 'MiniCursorword', { fg = 'NONE', bg = 'NONE' }) else vim.api.nvim_set_hl(0, 'MiniCursorword', { fg = 'lightgray', bg = 'darkcyan' }) end end }) ``` > [!question] filetypeイベントではなく[[BufEnter]]イベントを指定したのは...? > > [[FileTypeイベントではフローティングウィンドウを閉じたときに実行されない]]ため、[[BufEnter]]が必要。 > [!hint] > [[ファイルタイプ (Vim)|ファイルタイプ]]の確認は [[カレントバッファのファイルタイプを表示 (Neovim)|カレントバッファのファイルタイプを表示]] を参照。