summaryrefslogtreecommitdiff
path: root/harpoon.kak
diff options
context:
space:
mode:
authorraiguard <caleb.heuer@gmail.com>2021-12-12 20:30:02 -0700
committerraiguard <caleb.heuer@gmail.com>2021-12-12 20:30:02 -0700
commit1c3ff2f2006bb87249a14eda9703861fe759f577 (patch)
tree801a9a1afeb36662d215bedbba516f3b6ca5f09a /harpoon.kak
parent9eef47fa0ec8b44884ad93660f5a1d60f3c11991 (diff)
Fix harpoon-remove logic
Diffstat (limited to 'harpoon.kak')
-rw-r--r--harpoon.kak10
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
}
}