+8
-1
lua/javelin/data.lua
+8
-1
lua/javelin/data.lua
···
70
---@param path string
71
local function add_path(root_path, path)
72
local list = Data.get_list(root_path)
73
+
path = normalize_path(root_path, vim.fn.fnamemodify(path, ":~"))
74
+
75
+
if vim.tbl_contains(list, path) then
76
+
log.warn("File already in list: " .. path)
77
+
return
78
+
end
79
+
80
+
table.insert(list, path)
81
write(root_path)
82
end
83
+12
-1
lua/javelin/ui.lua
+12
-1
lua/javelin/ui.lua
···
11
local function open_buf(file)
12
-- nvim 0.11 only command
13
if vim.fn.exists("*isabsolutepath") == 1 then
14
-
if not vim.fn.isabsolutepath(file) then
15
file = data.get_root() .. "/" .. file
16
end
17
else
···
64
open_buf(file)
65
end,
66
},
67
on_close = function(self)
68
if self.buf then
69
local lines = self:lines()
···
11
local function open_buf(file)
12
-- nvim 0.11 only command
13
if vim.fn.exists("*isabsolutepath") == 1 then
14
+
if vim.fn.isabsolutepath(file) == 0 then
15
file = data.get_root() .. "/" .. file
16
end
17
else
···
64
open_buf(file)
65
end,
66
},
67
+
on_buf = function(self)
68
+
vim.api.nvim_create_autocmd("BufLeave", {
69
+
buffer = self.buf,
70
+
callback = function()
71
+
if not self.closed then
72
+
self:close()
73
+
end
74
+
return true
75
+
end,
76
+
})
77
+
end,
78
on_close = function(self)
79
if self.buf then
80
local lines = self:lines()