From f2096f7925da1e0317a56d763beafc16108c0b8f Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 17 Jul 2026 17:41:41 +0800 Subject: [PATCH] cd current directory --- lua/custom/plugins/01-opts.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lua/custom/plugins/01-opts.lua b/lua/custom/plugins/01-opts.lua index 25456179..1ab4fca3 100644 --- a/lua/custom/plugins/01-opts.lua +++ b/lua/custom/plugins/01-opts.lua @@ -1,6 +1,6 @@ -- noswap vim.o.swapfile = false -vim.o.guifont = 'JetBrainsMono Nerd Font Mono:h14:sb' +vim.o.guifont = 'JetBrainsMono NFM:h14:sb' vim.o.list = false -- disable spell for pandoc @@ -59,6 +59,15 @@ else }) end +-- auto cd to current directory +vim.api.nvim_create_autocmd("VimEnter", { + callback = function() + if vim.fn.isdirectory(vim.fn.expand("%:p")) == 0 then + vim.cmd("cd %:p:h") + end + end, +}) + if isWindows then vim.g.python3_host_prog = 'C:\\Users\\yokow\\miniforge3\\envs\\labs\\python.exe' end -- independent clipboard @@ -164,4 +173,4 @@ vim.api.nvim_create_autocmd('BufWinEnter', { end, }) -return {} \ No newline at end of file +return {}