From 0aeb586f4c6e72aade7ed7e3e639c890176b44dd Mon Sep 17 00:00:00 2001 From: Dennis Chan Date: Wed, 16 Jul 2025 10:10:38 +0800 Subject: [PATCH] refactoring --- init.lua | 20 +++++++++++++++++++- lazy-lock.json | 1 + lua/custom/plugins/oil.lua | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 355df6bb..d91ab303 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,21 @@ +vim.o.autoread = true + +vim.api.nvim_create_autocmd({ 'FocusGained', 'BufEnter', 'CursorHold', 'CursorHoldI' }, { + pattern = { '*' }, + callback = function() + if vim.fn.mode() ~= 'c' then + vim.cmd 'checktime' + end + end, +}) + +vim.api.nvim_create_autocmd('FileChangedShellPost', { + pattern = { '*' }, + callback = function() + vim.cmd [[echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None]] + end, +}) + -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) @@ -5,7 +23,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` diff --git a/lazy-lock.json b/lazy-lock.json index faa15846..cad50032 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -16,6 +16,7 @@ "mini.nvim": { "branch": "main", "commit": "c8d4b45745b9c05217d33c7841230af4d03a5f1b" }, "nvim-lspconfig": { "branch": "master", "commit": "8c5efd1269160fc2fdf61e3d7176be5015860a8f" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "0422a19d9aa3aad2c7e5cca167e5407b13407a9d" }, "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index 79d2be2d..9a9bd45e 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -7,6 +7,7 @@ return { view_options = { show_hidden = true, }, + watch_for_changes = true, }, dependencies = { { 'echasnovski/mini.icons', opts = {} } }, lazy = false,