cd to startup directory keymap

This commit is contained in:
Baipyrus 2024-04-08 13:18:48 +02:00
parent 7d2974684e
commit 021d2774e7
2 changed files with 5 additions and 0 deletions

View File

@ -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'

View File

@ -39,6 +39,8 @@ vim.keymap.set('v', '<leader>pny', '"_dP', { desc = '[P]aste [N]o [Y]ank' })
-- Populate CMD to prepare for change directory
vim.keymap.set('n', '<leader>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', '<leader>cdh', '<cmd>cd ' .. vim.g.base_dir .. '<cr>', { desc = '[C]hange [D]irectory to [H]ome' })
-- Delete current buffer without closing window
vim.keymap.set('n', '<leader>bd', '<cmd>bp<bar>sp<bar>bn<bar>bd<cr>', { desc = '[B]uffer [D]elete' })