mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
commit
af79d1bcda
21
README.md
21
README.md
@ -192,6 +192,27 @@ settings = {
|
||||
},
|
||||
```
|
||||
|
||||
### Extend
|
||||
The 'extend' functionality can be used to add keymaps for opening files in splits & tabs.
|
||||
|
||||
```lua
|
||||
harpoon:extend({
|
||||
UI_CREATE = function(cx)
|
||||
vim.keymap.set("n", "<C-v>", function()
|
||||
harpoon.ui:select_menu_item({ vsplit = true })
|
||||
end, { buffer = cx.bufnr })
|
||||
|
||||
vim.keymap.set("n", "<C-x>", function()
|
||||
harpoon.ui:select_menu_item({ split = true })
|
||||
end, { buffer = cx.bufnr })
|
||||
|
||||
vim.keymap.set("n", "<C-t>", function()
|
||||
harpoon.ui:select_menu_item({ tabedit = true })
|
||||
end, { buffer = cx.bufnr })
|
||||
end,
|
||||
})
|
||||
```
|
||||
|
||||
### Highlight Groups
|
||||
TODO: Fill in the idea that we will emit out window information
|
||||
|
||||
|
@ -10,7 +10,7 @@ M.DEFAULT_LIST = DEFAULT_LIST
|
||||
|
||||
---@alias HarpoonListItem {value: any, context: any}
|
||||
---@alias HarpoonListFileItem {value: string, context: {row: number, col: number}}
|
||||
---@alias HarpoonListFileOptions {split: boolean, vsplit: boolean}
|
||||
---@alias HarpoonListFileOptions {split: boolean, vsplit: boolean, tabedit: boolean}
|
||||
|
||||
---@class HarpoonPartialConfigItem
|
||||
---@field select_with_nil? boolean defaults to false
|
||||
@ -115,14 +115,14 @@ function M.get_default_config()
|
||||
|
||||
if options.vsplit then
|
||||
vim.cmd("vsplit")
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
elseif options.split then
|
||||
vim.cmd("split")
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
else
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
elseif options.tabedit then
|
||||
vim.cmd("tabedit")
|
||||
end
|
||||
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
|
||||
if set_position then
|
||||
vim.api.nvim_win_set_cursor(0, {
|
||||
list_item.context.row or 1,
|
||||
|
@ -168,8 +168,9 @@ function HarpoonUI:select_menu_item(options)
|
||||
options
|
||||
)
|
||||
|
||||
self.active_list:select(idx, options)
|
||||
list = self.active_list
|
||||
self:close_menu()
|
||||
list:select(idx, options)
|
||||
end
|
||||
|
||||
function HarpoonUI:save()
|
||||
|
Loading…
x
Reference in New Issue
Block a user