aboutsummaryrefslogtreecommitdiffhomepage
path: root/.config/nvim/lua/uniquify.lua
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2022-12-21 21:26:48 +0900
committernsfisis <nsfisis@gmail.com>2022-12-21 21:27:01 +0900
commit041d8e92d17b28ac7e887cd8e334d88ef4e0f569 (patch)
tree94df80549a08e94671af9d65d5ddf51efc66b2b3 /.config/nvim/lua/uniquify.lua
parent665cf512e3084356ba4362e80342828a2c6b2409 (diff)
downloaddotfiles-041d8e92d17b28ac7e887cd8e334d88ef4e0f569.tar.gz
dotfiles-041d8e92d17b28ac7e887cd8e334d88ef4e0f569.tar.zst
dotfiles-041d8e92d17b28ac7e887cd8e334d88ef4e0f569.zip
neovim:uniquify: shorten path if there are other paths that are exactly the same
Diffstat (limited to '.config/nvim/lua/uniquify.lua')
-rw-r--r--.config/nvim/lua/uniquify.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/.config/nvim/lua/uniquify.lua b/.config/nvim/lua/uniquify.lua
index b9b9d32..c7f8482 100644
--- a/.config/nvim/lua/uniquify.lua
+++ b/.config/nvim/lua/uniquify.lua
@@ -8,6 +8,12 @@ local stricmp = vim.stricmp
function M.uniquify(this_path, other_paths)
+ for i = 1, #other_paths do
+ if other_paths[i] == this_path then
+ table.remove(other_paths, i)
+ end
+ end
+
-- Split each path into slash-separated parts.
for i = 1, #other_paths do
other_paths[i] = split(other_paths[i], '[\\/]')