-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d1ab05
commit d9ea424
Showing
3 changed files
with
59 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,27 @@ | ||
return { | ||
{ | ||
provider = function(self) | ||
local is_project_root = require("dko.project").root() == self.cwd | ||
return is_project_root and " ʀᴏᴏᴛ " or " " | ||
end, | ||
hl = "StatusLineNC", | ||
}, | ||
{ | ||
provider = function(self) | ||
local uis = vim.api.nvim_list_uis() | ||
local ui = uis[1] or { width = 80 } | ||
provider = function(self) | ||
local uis = vim.api.nvim_list_uis() | ||
local ui = uis[1] or { width = 80 } | ||
|
||
local extraparts = { | ||
--2 + 1, -- search symbol | ||
--2 + self.search_contents:len(), -- term padding | ||
2 + 5, -- counts | ||
8, -- icon and root text | ||
2 + 1, -- branch indicator | ||
self.branch:len(), -- branch | ||
2 + 7, -- clipboard indicator | ||
2 + 1, -- remote indicator | ||
} | ||
local extrachars = 0 | ||
for _, len in pairs(extraparts) do | ||
extrachars = extrachars + len | ||
end | ||
local extraparts = { | ||
--2 + 1, -- search symbol | ||
--2 + self.search_contents:len(), -- term padding | ||
2 + 5, -- counts | ||
8, -- icon and root text | ||
2 + 1, -- branch indicator | ||
self.branch:len(), -- branch | ||
2 + 7, -- clipboard indicator | ||
2 + 1, -- remote indicator | ||
} | ||
local extrachars = 0 | ||
for _, len in pairs(extraparts) do | ||
extrachars = extrachars + len | ||
end | ||
|
||
local remaining = ui.width - extrachars | ||
local cwd = vim.fn.fnamemodify(self.cwd, ":~") | ||
local output = cwd:len() < remaining and cwd or vim.fn.pathshorten(cwd) | ||
return (" %s "):format(output) | ||
end, | ||
hl = "StatusLineNC", | ||
}, | ||
local remaining = ui.width - extrachars | ||
local cwd = vim.fn.fnamemodify(self.cwd, ":~") | ||
local output = cwd:len() < remaining and cwd or vim.fn.pathshorten(cwd) | ||
return (" %s "):format(output) | ||
end, | ||
hl = "StatusLineNC", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters