File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,11 @@ M._active = false
7
7
8
8
local e = vim .fn .fnameescape
9
9
10
- function M .current ()
10
+ --- @param opts ? { branch ?: boolean }
11
+ function M .current (opts )
12
+ opts = opts or {}
11
13
local name = vim .fn .getcwd ():gsub (" [\\ /:]+" , " %%" )
12
- if Config .options .branch then
14
+ if Config .options .branch and opts . branch ~= false then
13
15
local branch = M .branch ()
14
16
if branch and branch ~= " main" and branch ~= " master" then
15
17
name = name .. " %%" .. branch :gsub (" [\\ /:]+" , " %%" )
71
73
--- @param opts ? { last ?: boolean }
72
74
function M .load (opts )
73
75
opts = opts or {}
74
- local file = opts .last and M .last () or M .current ()
76
+ --- @type string
77
+ local file
78
+ if opts .last then
79
+ file = M .last ()
80
+ else
81
+ file = M .current ()
82
+ if vim .fn .filereadable (file ) == 0 then
83
+ file = M .current ({ branch = false })
84
+ end
85
+ end
75
86
if file and vim .fn .filereadable (file ) ~= 0 then
76
87
M .fire (" LoadPre" )
77
88
vim .cmd (" silent! source " .. e (file ))
You can’t perform that action at this time.
0 commit comments