diff --git a/.config/nvim/lua/my/functions.lua b/.config/nvim/lua/my/functions.lua index 8b888ae..90f1c49 100644 --- a/.config/nvim/lua/my/functions.lua +++ b/.config/nvim/lua/my/functions.lua @@ -1,10 +1,8 @@ --- remove trailing whitespace function MY_remove_trailing_whitespace() local curpos = vim.api.nvim_win_get_cursor(0) vim.cmd([[keeppatterns %s/\s\+$//e]]) vim.api.nvim_win_set_cursor(0, curpos) end - vim.api.nvim_create_augroup('config_functions', { clear = true }) vim.api.nvim_create_autocmd( { 'BufWritePre' }, @@ -91,7 +89,7 @@ function MY_get_project_root() local sep = '/' repeat - path = path:gsub('/[^/]*$', '') + path = path:gsub(string.format('%s[^%s]*$', sep, sep), '') for _, marker in ipairs(root_markers) do if io.open(path .. sep .. marker) then return path