Set nvim CWD to opened directory

This commit is contained in:
Daniel McKnight 2026-04-23 13:03:16 -07:00
parent 5d8ffd9e03
commit 483c103f96

View file

@ -4,9 +4,6 @@ vim.cmd("set tabstop=2")
vim.cmd("set softtabstop=2")
vim.cmd("set shiftwidth=2")
-- Configure Navigation Keys
-- This is all handled by the vim-tmux-navigator plugin now
-- Configure Editor Settings
vim.cmd("set number")
vim.cmd("set scrolloff=8")
@ -33,6 +30,14 @@ vim.g.mapleader = " "
-- Init Lazy Plugin Manager
require("config.lazy")
-- Set CWD to opened directory
vim.api.nvim_create_autocmd("VimEnter", {
desc = "cd to passed $PWD when vim starts",
callback = function()
vim.api.nvim_set_current_dir(vim.fn.getcwd())
end,
})
-- Configure nvim Keymaps
vim.keymap.set("n", "<leader>r", ":source %<CR>", { desc = "Reload Config" })
vim.keymap.set("n", "<leader>bs", ":vsplit<CR>", { desc = "Vertical Split" })