Skip to content

Commit

Permalink
Add file name only mode (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
will-lynas authored Jul 21, 2024
2 parents 5e057f0 + 614e8aa commit b70904e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lua/grapple-line.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ M.settings = {
active = "lualine_a_normal",
inactive = "lualine_a_inactive",
},
-- Accepted values:
-- "unique_filename" shows the filename and parent directories if needed
-- "filename" shows the filename only
mode = "unique_filename",
}

function M.setup(user_settings)
Expand Down Expand Up @@ -74,8 +78,7 @@ local function generate_initial_names(files)
end
end

local function make_names(files)
generate_initial_names(files)
local function resolve_duplicates(files)
local duplicates = true
local depth = 2
while duplicates do
Expand All @@ -91,6 +94,13 @@ local function make_names(files)
end
end

local function make_names(files)
generate_initial_names(files)
if M.settings.mode == "unique_filename" then
resolve_duplicates(files)
end
end

function M.status()
local files = get_grapple_files()
make_names(files)
Expand Down

0 comments on commit b70904e

Please sign in to comment.