Created
December 6, 2024 08:42
-
-
Save talentestors/e0a56165e844f1e796bf46e7c380d772 to your computer and use it in GitHub Desktop.
For neovim & vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local autocmd = vim.api.nvim_create_autocmd | |
| -- nvim-tree 自动关闭 | |
| -- 定义是否为启动后的第一次 BufEnter 事件 | |
| local is_first_bufenter_after_start = true | |
| autocmd("BufEnter", { | |
| nested = true, | |
| group = 'myAutoGroup', | |
| callback = function() | |
| -- 如果是启动后的第一个 BufEnter 事件,则跳过处理 | |
| if is_first_bufenter_after_start then | |
| is_first_bufenter_after_start = false | |
| return | |
| end | |
| -- 检查是否是最后一个窗口并且当前缓冲区是 NvimTree | |
| if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then | |
| vim.cmd("quit") | |
| end | |
| end, | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- local shell | |
| -- zsh | |
| if vim.o.shell:match('%f[%w]zsh%f[^%w]') then | |
| vim.o.shellcmdflag = '-s' | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment