diff --git a/lua/core/util.lua b/lua/core/util.lua index d3035fc..125921d 100644 --- a/lua/core/util.lua +++ b/lua/core/util.lua @@ -97,8 +97,8 @@ function M.smart_bd() local buf_no = vim.api.nvim_get_current_buf() local buf_name = vim.api.nvim_buf_get_name(buf_no) - local buf_ft = vim.api.nvim_buf_get_option(buf_no, "filetype") - local buf_bt = vim.api.nvim_buf_get_option(buf_no, "buftype") + local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = buf_no }) + local buf_bt = vim.api.nvim_get_option_value("buftype", { buf = buf_no }) if debug then print(string.format("filetype: [%s] | buftype: [%s]", buf_ft, buf_bt)) end diff --git a/lua/neovide/init.lua b/lua/neovide/init.lua index 976f371..4425fc5 100644 --- a/lua/neovide/init.lua +++ b/lua/neovide/init.lua @@ -20,8 +20,11 @@ util.map_keys(keymaps.scale, { noremap = true, silent = true }) vim.cmd("set guifont=JetBrainsMono\\ Nerd\\ Font:h16") ------------------------------------------------------------------------------ --- Set the current working directory to home directory +-- Set current working directory to home directory if we are in '/' or 'C:\' +local current_dir = vim.fn.getcwd() local home_dir = os.getenv("HOME") or os.getenv("USERPROFILE") -if home_dir then - vim.cmd("cd " .. home_dir) +if current_dir == "/" or current_dir == "C:\\Program Files\\Neovide" then + if home_dir then + vim.cmd("cd " .. home_dir) + end end