diff options
| -rw-r--r-- | .vim/init.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/.vim/init.lua b/.vim/init.lua index 26e3bab..f6118c0 100644 --- a/.vim/init.lua +++ b/.vim/init.lua @@ -166,13 +166,13 @@ vim.keymap.set('n', 'gB', [[ :bprevious<cr> ]], { silent = true }) vim.keymap.set('n', '<tab>', [[ :normal za<cr> ]], { silent = true }) -- vim.keymap.set('n', '<tab>', [[ :exe 'normal za' | IndentBlanklineRefresh<cr> ]], {silent = true}) --- swap gf and gF --- vim.keymap.set('n', 'gf', [[ :e <cfile><cr> ]]) --- vim.keymap.set('v', 'gf', [[ :e <cfile><cr> ]]) -vim.keymap.set({ 'n', 'v' }, 'gf', function(a) +vim.keymap.set({ 'n', 'v' }, 'gf', function() local Path = require('plenary.path') - local cfile = Path:new(vim.fn.expand('<cfile>')) - if not cfile:is_absolute() then + local cfile = vim.fn.expand('<cfile>') + if string.sub(cfile, 0, 7) == 'file://' then + cfile = string.sub(cfile, 8) + end + if not Path:new(cfile):is_absolute() then cfile = Path:new(vim.fn.expand('%:p:h'), cfile):normalize() end vim.cmd.edit(cfile) |