diff options
| author | raiguard <caleb.heuer@gmail.com> | 2021-12-12 20:30:02 -0700 |
|---|---|---|
| committer | raiguard <caleb.heuer@gmail.com> | 2021-12-12 20:30:02 -0700 |
| commit | 1c3ff2f2006bb87249a14eda9703861fe759f577 (patch) | |
| tree | 801a9a1afeb36662d215bedbba516f3b6ca5f09a /harpoon.kak | |
| parent | 9eef47fa0ec8b44884ad93660f5a1d60f3c11991 (diff) | |
Fix harpoon-remove logic
Diffstat (limited to 'harpoon.kak')
| -rw-r--r-- | harpoon.kak | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/harpoon.kak b/harpoon.kak index b2e1d29..85deac6 100644 --- a/harpoon.kak +++ b/harpoon.kak @@ -25,8 +25,9 @@ define-command -params 1 -docstring "Navigate to the file at the specified index define-command -params ..1 -docstring "Add the current file to the list at the index or at the end" harpoon-add %{ lua %arg{1} %val{bufname} %opt{harpoon_buffers} %{ local index, bufname = args() + index = tonumber(index) or nil -- Index is optional - if not index or (type(index) == "string" and #index == 0) then + if not index then -- Find the lowest available index local buffers = {} for i = 3, #arg do @@ -46,10 +47,11 @@ define-command -params ..1 -docstring "Add the current file to the list at the i define-command -params ..1 -docstring "Remove the file at the specified index" harpoon-remove %{ lua %arg{1} %{ local index = args() - if not index or #index == 0 then - kak.set_option("global", "harpoon_buffers") + index = tonumber(index) or nil + if index then + kak.set_option("-remove", "global", "harpoon_buffers", index.."=") else - kak.set_option("-remove", "global", "harpoon_buffers", index.."=foo") + kak.set_option("global", "harpoon_buffers") end } } |
