-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NodeJs Support, Project path support, Git Conflict support #33
Conversation
powerline_prompt.lua
Outdated
local function get_folder_name(path) | ||
local reversePath = string.reverse(path) | ||
local slashIndex = string.find(reversePath, "\\") | ||
return string.sub(path, string.len(path) - slashIndex + 2) | ||
end | ||
|
||
local npmIcon = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this didn't get saved correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe encoding was messed somewhere along the way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encoding issue?
I should mention that I've been working over the past few days (since this PR came in) on a refactor that makes it much easier to add 'addons' like this. |
Sounds great- I could then write in an add-on for #30 |
The Git segment is pulled into its own addon. Only few changes are needed to make #30 happen. It should be good. |
I've published the refactored version. I've added an explanation in the core and addon files, but README and a proper docs file are still to be edited. Maybe this weekend, along with merging this npm addon. |
cool, want me to resolve the conflicts with base branch? |
@AmrEldib going through new structure and I like it. Was thinking to write one myself like that but was too lazy ;] Will port changes to that new format, also will extract variables to the config, update the sample file and delete from repo the actual config |
Signed-off-by: Bartlomiej Specjalny <bspecjalny@gmail.com>
Signed-off-by: Bartlomiej Specjalny <bspecjalny@gmail.com>
Signed-off-by: Bartlomiej Specjalny <bspecjalny@gmail.com>
Think thats it, @AmrEldib @mattdkerr review again please |
-- Sets the properties of the Segment object, and prepares for a segment to be added | ||
--- | ||
local function init() | ||
segment.isNeeded = get_package_json_dir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be preferable for get_package_json_dir() to be named something starting with "has"/"is" that indicates it returns a boolean result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as it actually returns something from io.open
it should not be prefixed has
, I think
@@ -5,6 +5,9 @@ | |||
local promptTypeFull = "full" | |||
-- "folder" for folder name only like System32 | |||
local promptTypeFolder = "folder" | |||
-- "smart" for treating git top level folder as homeSymbol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
end | ||
|
||
segment.textColor = colorWhite | ||
segment.fillColor = colorCyan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do we customize this more easily? I can execute clink and this lua under Hyper or Cmder and they each have their own color theme systems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ve actually tried moving that to config, but it has to be processed after the core and throws errors. Not proficient enough in lua to work around it ;p (and to tell the truth I didnt really look hard)
That said, you can change your color directly in cmder settings can you. And I would actually say this should be probably preferable way to change color themes anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what kind of customizations are you thinking of?
The order of files does affect results. The only ways to force order I can find (but not 100% sure) are:
- file names: this is why the config file starts with an underscore, to be loaded before all other files
- The number passed to the register_filter function. The higher the number, the later the function is called. This way the folder name can always be first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about actually putting colors into the config. As cmder can handle those extra color codes, but then we could put it in core as well. So i dont know if it is even worth it to extract that.
clink.prompt.register_filter(addAddonSegment, delayGit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sp3c1 what is delayGit? and delayNpm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variable in config - forgot to update the sample one, will send the update
👍
end | ||
end | ||
else | ||
local git_dir = get_git_dir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an unobvious issue here. get_git_dir is a function is a lua file shipped with Cmder. This function gets overwritten in the powerline_git file. However, I think here we're calling the original function shipped with Cmder which could cause issues later if it changes, or if the powerline_git function diverges from Cmder's
This highlights that powerline_prompt depends on powerline_git, but powerline_git executes after powerline_prompt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is a piccle, as the git component is quite crucial.
maybe we move it to very beginning to override it so that no addon gonna have same issue. No its not as clean at it could be, but would resolve it and ensure it wont randomly break?
@sp3c1 @mattdkerr I appreciate all your work on this.
|
|
Regarding fonts, maybe we should link the https://github.com/ryanoasis/nerd-fonts? I mean anyone should pick whatever he really likes |
Or actually set this to some normal font in repo with screenshot instructions how to set it to something different? |
Signed-off-by: Bartlomiej Specjalny <bspecjalny@gmail.com>
Signed-off-by: Bartlomiej Specjalny <bspecjalny@gmail.com>
Signed-off-by: Bartlomiej Specjalny <bspecjalny@gmail.com>
Signed-off-by: Bartlomiej Specjalny <bspecjalny@gmail.com>
Signed-off-by: Bartlomiej Specjalny <bspecjalny@gmail.com>
Signed-off-by: Bartlomiej Specjalny <bspecjalny@gmail.com>
@AmrEldib think that covers it |
@sp3c1 I'm working on this, but been a little busy lately. Thanks again for all your help |
np ^^ |
Signed-off-by: Bartlomiej Specjalny <bspecjalny@gmail.com>
Sorry for the unplanned delay. I merged all the addon after making some changes to make sure the code adhere to the same style and is all documented. |
Do not know if you want to megre it or use it to make broad support. Some small features.
icomoon
stuff, fill free to customize (this will require you to set the icomon as the symbols font, and/or as extra font in your IDE if you want to see nice symbols)