oh-my-fish / oh-my-fish-legacy

Oh My Fish!
MIT License
13 stars 2 forks source link

Theme and General Utilities #430

Closed ghost closed 9 years ago

ghost commented 9 years ago

It would be useful to have a util plugin that other themes as well as plugins could use to reuse more code. Lately I see a lot of themes that are basically just change a few colors, copy a feature from another theme and the result is a file with 80 or more lines of code when it should be like 3 lines.

bpinto commented 9 years ago

I've thought about this but I could never find a good way to reduce the scope to something feasible.

ghost commented 9 years ago

Wouldn't this basically be adding some git and color related functions to the /functions directory? I am considering doing something like this in Wahoo.

bpinto commented 9 years ago

Not sure... I don't think it's that easy... but it could be.

ghost commented 9 years ago

I think we just need to make sure these functions are autoloaded first and then they would be available to any omf users.

bpinto commented 9 years ago

Right, loading the function is okay. The difficult I see lies on the function definition. Let me know when you have a draft and I can have a look! :)

ghost commented 9 years ago

You mean coming up with a good function? The problem I see is this will result in themes / plugins that are solely dependent on the current platform, OMF, Wahoo, etc. If only...

bpinto commented 9 years ago

Maybe not, for instance, fish has builtin git functions.

ghost commented 9 years ago

Right, but still a bit obscure and not helpful without learning how to use them.

__fish_git_prompt                                                                                (Prompt function for Git)
__fish_git_prompt_dirty    (__fish_git_prompt helper, tells whether or not the current branch has tracked, modified files)
__fish_git_prompt_informative_status  (set -l changedFiles (command git diff --name-status | cut -c 1-2) set -l stagedFi…)
__fish_git_prompt_operation_branch_bare           (__fish_git_prompt helper, returns the current Git operation and branch)
__fish_git_prompt_repaint                                      (Event handler, repaints prompt when functionality changes)
__fish_git_prompt_repaint_char                                      (Event handler, repaints prompt when any char changes)
__fish_git_prompt_repaint_color                                    (Event handler, repaints prompt when any color changes)
__fish_git_prompt_set_char  (set -l user_variable_name "$argv[1]" set -l char $argv[2] set -l user_variable $$user_varia…)
__fish_git_prompt_set_color  (set -l user_variable_name "$argv[1]" set -l user_variable $$user_variable_name set -l user…)
__fish_git_prompt_show_upstream                                                    (Helper function for __fish_git_prompt)
__fish_git_prompt_staged              (__fish_git_prompt helper, tells whether or not the current branch has staged files)
__fish_git_prompt_validate_chars                                         (__fish_git_prompt helper, checks char variables)
__fish_git_prompt_validate_colors   
bpinto commented 9 years ago

Somewhat fixed with #512