Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ There is quite a bit of behavior you can configure via `harpoon:setup()`
* `create_list_item`: called when `list:add()` or `list:prepend()` is called. called with an item, which will be a string, when adding through the ui menu
* `BufLeave`: this function is called for every list on BufLeave. if you need custom behavior, this is the place
* `VimLeavePre`: this function is called for every list on VimLeavePre.
* `get_root_dir`: used for creating relative paths. defaults to `vim.loop.cwd()`
* `get_root_dir`: used for creating relative paths. defaults to `vim.uv.cwd()`

### Settings
Settings can alter the experience of harpoon
Expand All @@ -232,7 +232,7 @@ settings = {
save_on_toggle = false,
sync_on_ui_close = false,
key = function()
return vim.loop.cwd()
return vim.uv.cwd()
end,
},
```
Expand Down
4 changes: 2 additions & 2 deletions lua/harpoon/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function M.get_default_config()
sync_on_ui_close = false,

key = function()
return vim.loop.cwd()
return vim.uv.cwd()
end,
},

Expand Down Expand Up @@ -182,7 +182,7 @@ function M.get_default_config()
end,

get_root_dir = function()
return vim.loop.cwd()
return vim.uv.cwd()
end,

---@param config HarpoonPartialConfigItem
Expand Down
9 changes: 5 additions & 4 deletions lua/harpoon/extensions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ function Builtins.highlight_current_file()
for line_number, file in pairs(cx.contents) do
if string.find(cx.current_file, file, 1, true) then
-- highlight the harpoon menu line that corresponds to the current buffer
vim.api.nvim_buf_add_highlight(
vim.api.nvim_buf_set_extmark(
cx.bufnr,
-1,
"CursorLineNr",
vim.api.nvim_create_namespace(
"HarpoonHighlightCurrentFile"
),
line_number - 1,
0,
-1
{ hl_group = "CursorLineNr", end_col = #file }
)
-- set the position of the cursor in the harpoon menu to the start of the current buffer line
vim.api.nvim_win_set_cursor(cx.win_id, { line_number, 0 })
Expand Down