From b6acf5ccb1d62a2311f9e95a5081d7492318a0b1 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Tue, 9 Jul 2024 16:42:01 +0200 Subject: [PATCH] manual file path fix for relative paths --- lua/keymaps.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 630599f..4078acb 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -112,6 +112,15 @@ end vim.keymap.set({ 'n', 'v' }, 'gy', global_cmd_yank, { desc = '[G]lobal command [Y]ank' }) +-- Fix filename keymap +vim.keymap.set({ 'n', 'v' }, 'fp', function() + -- lua print(string.gsub(vim.api.nvim_buf_get_name(0), vim.fn.getcwd(), '')) + local cwd = vim.fn.getcwd() + local path = vim.api.nvim_buf_get_name(0) + local file, _ = string.gsub(path, cwd .. '\\', '') + vim.cmd('0f | file ' .. file) +end, { desc = '[F]ile Fix Relative [P]ath' }) + if vim.g.neovide then -- System clipboard keybinds in normal and visual mode vim.keymap.set({ 'n', 'v' }, '', '"+y', { desc = 'Yank to System clipboard' })