diff --git a/init.lua b/init.lua index 3ed4ea3..817ae07 100644 --- a/init.lua +++ b/init.lua @@ -6,6 +6,9 @@ vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed vim.g.have_nerd_font = true +-- Save start directory as base +vim.g.base_dir = vim.fn.getcwd() + -- [[ Setting options ]] require 'options' diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 206211c..d326f0f 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -39,6 +39,8 @@ vim.keymap.set('v', 'pny', '"_dP', { desc = '[P]aste [N]o [Y]ank' }) -- Populate CMD to prepare for change directory vim.keymap.set('n', 'cd ', ':cd ', { desc = 'Prepare CMD for [C]hange [D]irectory' }) +-- Navigate to 'base' directory, the initial dir that nvim was run in +vim.keymap.set('n', 'cdh', 'cd ' .. vim.g.base_dir .. '', { desc = '[C]hange [D]irectory to [H]ome' }) -- Delete current buffer without closing window vim.keymap.set('n', 'bd', 'bpspbnbd', { desc = '[B]uffer [D]elete' })