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 1 year has passed since last update.

Fernのdrawerでファイルを開いた時drawerを自動的に閉じる

Last updated at Posted at 2022-12-19

環境

NVIM v0.8.0-1210-gd367ed9b2
Windows 10 Home
lambdalisue/fern.vim v1.51.4

動機

で提案されているような

vim.keymap.set("n", "<CR>", "<Plug>(fern-action-open)" .. "<Plug>(fern-close-drawer)", {buffer = true})

といったキーマップだと、tキーの新しいタブで開く方法でFernを自動的に閉じることができない。

方法

init.lua
vim.api.nvim_create_augroup("vimrc", {})
vim.api.nvim_create_autocmd("WinEnter", {
  callback = function()
    if(vim.bo.filetype ~= "fern") then
      vim.cmd("FernDo close -stay")
    end
  end,
})

備考

引用元のIssueがやや古いため、もしかしたら既により良い解決策が実装されているかもしれません。

0
0
2

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?