File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 1
1
local Extensions = require (" harpoon.extensions" )
2
2
local Logger = require (" harpoon.logger" )
3
- local Path = require (" plenary.path" )
4
- local function normalize_path (buf_name , root )
5
- return Path :new (buf_name ):make_relative (root )
6
- end
3
+ local Utils = require (" harpoon.utils" )
4
+
7
5
local function to_exact_name (value )
8
6
return " ^" .. value .. " $"
9
7
end
@@ -190,7 +188,7 @@ function M.get_default_config()
190
188
--- @return HarpoonListItem
191
189
create_list_item = function (config , name )
192
190
name = name
193
- or normalize_path (
191
+ or Utils . normalize_path (
194
192
vim .api .nvim_buf_get_name (
195
193
vim .api .nvim_get_current_buf ()
196
194
),
@@ -219,7 +217,7 @@ function M.get_default_config()
219
217
--- @param list HarpoonList
220
218
BufLeave = function (arg , list )
221
219
local bufnr = arg .buf
222
- local bufname = normalize_path (
220
+ local bufname = Utils . normalize_path (
223
221
vim .api .nvim_buf_get_name (bufnr ),
224
222
list .config .get_root_dir ()
225
223
)
Original file line number Diff line number Diff line change 1
1
local Logger = require (" harpoon.logger" )
2
- local utils = require (" harpoon.utils" )
3
2
local Extensions = require (" harpoon.extensions" )
4
3
5
4
local function guess_length (arr )
@@ -259,7 +258,7 @@ function HarpoonList:resolve_displayed(displayed, length)
259
258
for i = 1 , length do
260
259
local v = displayed [i ]
261
260
local index = index_of (list_displayed , self ._length , v )
262
- if utils .is_white_space (v ) then
261
+ if Utils .is_white_space (v ) then
263
262
new_list [i ] = nil
264
263
elseif index == - 1 then
265
264
new_list [i ] = self .config .create_list_item (self .config , v )
Original file line number Diff line number Diff line change
1
+ local Path = require (" plenary.path" )
2
+
1
3
local M = {}
2
4
3
5
function M .trim (str )
@@ -22,4 +24,8 @@ function M.is_white_space(str)
22
24
return str :gsub (" %s" , " " ) == " "
23
25
end
24
26
27
+ function M .normalize_path (buf_name , root )
28
+ return Path :new (buf_name ):make_relative (root )
29
+ end
30
+
25
31
return M
You can’t perform that action at this time.
0 commit comments