From 41d1a0e7939d93f394f710f993f12163f4546a14 Mon Sep 17 00:00:00 2001 From: Rosen Stoyanov Date: Tue, 23 Aug 2022 22:08:28 +0300 Subject: [PATCH 1/2] feat: Make current file more prominent --- lua/harpoon/ui.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/harpoon/ui.lua b/lua/harpoon/ui.lua index 8c8b223..ab4c44d 100644 --- a/lua/harpoon/ui.lua +++ b/lua/harpoon/ui.lua @@ -77,6 +77,19 @@ function M.toggle_quick_menu() return end + local curr_file = utils.normalize_path(vim.api.nvim_buf_get_name(0)) + vim.cmd( + string.format( + "autocmd Filetype harpoon " .. + "let path = '%s' | call clearmatches() | " .. + -- move the cursor to the line containing the current filename + "call search('\\V'.path.'\\$') | " .. + -- add a hl group to that line + "call matchadd('HarpoonCurrentFile', '\\V'.path.'\\$')", + curr_file:gsub("\\", "\\\\") + ) + ) + local win_info = create_window() local contents = {} local global_config = harpoon.get_global_settings() From 3f11043be4593886b147d381a779d88117642e49 Mon Sep 17 00:00:00 2001 From: Rosen Stoyanov Date: Wed, 7 Sep 2022 16:14:27 +0300 Subject: [PATCH 2/2] style: Fix formatting --- lua/harpoon/ui.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/harpoon/ui.lua b/lua/harpoon/ui.lua index ab4c44d..7c47fe7 100644 --- a/lua/harpoon/ui.lua +++ b/lua/harpoon/ui.lua @@ -80,12 +80,12 @@ function M.toggle_quick_menu() local curr_file = utils.normalize_path(vim.api.nvim_buf_get_name(0)) vim.cmd( string.format( - "autocmd Filetype harpoon " .. - "let path = '%s' | call clearmatches() | " .. + "autocmd Filetype harpoon " + .. "let path = '%s' | call clearmatches() | " -- move the cursor to the line containing the current filename - "call search('\\V'.path.'\\$') | " .. + .. "call search('\\V'.path.'\\$') | " -- add a hl group to that line - "call matchadd('HarpoonCurrentFile', '\\V'.path.'\\$')", + .. "call matchadd('HarpoonCurrentFile', '\\V'.path.'\\$')", curr_file:gsub("\\", "\\\\") ) )