Coder Social home page Coder Social logo

What about a port to Oh-My-Fish? about fishline HOT 15 CLOSED

0rax avatar 0rax commented on June 3, 2024
What about a port to Oh-My-Fish?

from fishline.

Comments (15)

0rax avatar 0rax commented on June 3, 2024

Hi, thanks for your interest.

I am part of those guy who loves to have everything separated, oh-my-fish is a great project but contains way too much things for me.

But, if you are ok with this, I can make a pull request with fishline as a theme using git submodule (basicaly a link to the repository) and a readme on how to configure fishline ?

from fishline.

 avatar commented on June 3, 2024

I know what you mean.
Well, if it would work like any other oh-my-fish theme, that is, users can add it to their $fish_theme variable and voilà it works, then absolutely, please do and we will review it over there.

from fishline.

0rax avatar 0rax commented on June 3, 2024

I've got one proble, the way import functions works make a circular dependency if it put the source folder in my theme folder...

fish: Could not autoload item 'tty', it is already being autoloaded. This is a
circular dependency in the autoloading scripts, please remove it.

Is their a way to prevent the whole folder to be imported ?

from fishline.

 avatar commented on June 3, 2024

Even if you find a way to prevent the folder to be imported, that would make import useless. Is there a way you can rely on import instead?

For example:

source $FLINE_PATH/themes/default.fish

for seg in (find $FLINE_PATH/segments -name '*.fish')
    source $seg
end

for ev in (find $FLINE_PATH/events -name '*.fish')
    source $ev
end

You don't need this, as import will take care of sourcing *.fish files within your project's tree hierarchy.

from fishline.

0rax avatar 0rax commented on June 3, 2024

Well yeah I can do something like that

if not test -f $HOME/.fishline/fishline.fish
    git clone https://github.com/0rax/fishline $HOME/.fishline
end
set -g FLINE_PATH $HOME/.fishline
source $FLINE_PATH/fishline.fish

function fish_prompt

    fishline $status

end

For the import question, it was more of, is there a way to tell import not to load a specific folder, like a file inside the folder telling dont touch it.

from fishline.

 avatar commented on June 3, 2024

There is a way via _prepend_tree, but import simply loads all .fish files, except for spec.fish files which have plugin/theme tests.

What files you don't want to import? And why?

oh-my-fish will automatically load the user selected theme on startup, e.g., if $fish_theme is my_theme, oh-my-fish will look into themes/ for a my_theme directories and source all .fish files inside recursively.

from fishline.

0rax avatar 0rax commented on June 3, 2024

I dont really know what's the problem, because if I tell fishline not to import its own segment and events I still have this circular dependencies (might be because I have two file called the same).

And there is also a second problem, the way it imports everything dont match how fishline currently uses its own variables. at this moment fishline set them in its current scope (global when standalone but a specific one when imported).

Thirdly, themes, I also have custom themes, and all of them will be loaded when imported this way.

But I might have a solution for problem 1 & 3, is there a way I can rely on a VARIABLE that tells me the user is currently using oh-my-fish ? For problem 2 I just have to change every set to set -g

from fishline.

 avatar commented on June 3, 2024

Since fishline is a standalone project, sort of like a small framework itself, I would suggest writing either a fishline theme for oh-my-fish that uses some or all of the features your current fishline project has. This may require more than rewriting a couple of things here and there to make it work though.

There is no variable that indicates whether oh-my-fish is currently in use or not, but maybe you could check if $fish_path/oh-my-fish.fish exists like:

if set -q fish_path
  if test -e $fish_path/oh-my-fish.fish
  # ...
  end
end

from fishline.

0rax avatar 0rax commented on June 3, 2024

Well I made it work, but I dont really know why, but if I comment out my own source, the functions for segment are all undefinied. I just had to change the name of tty.fish and set all default glyph to set -g and everything is now compatible.

I dont really know why tty.fish made an error and why my segment are undefinied. But it works using exactly the same source and changing all my set to set -g

from fishline.

 avatar commented on June 3, 2024

Thanks! There is no rush. I will take a look at your OhMyFish branch later and see if I can give you any other suggestions.

from fishline.

0rax avatar 0rax commented on June 3, 2024

Well everything seems to work well, but I just saw that you install script grab the .zip file and submodule are not included in the tarball.

I really dont want to split up codebase to make it avallaible to oh-my-fish users (double updates and so on), the best option IMO is to make the prompt clone/grab the git repository if not present.

It will only slow the process the first time, so no real hassle.

from fishline.

 avatar commented on June 3, 2024

I have to look into fishline more closely to see how expensive would a rewrite be. I hope you don't mind! 😄

from fishline.

0rax avatar 0rax commented on June 3, 2024

No problem, I could make a small version of Fishline and rewrite it for oh-my-fish, but I dont really see why. The idea behind fishline is that everybody can submit colorscheme/glyphscheme and segment for it. Making it 'only' a theme is not a good thing IMO. It will loose a lot of its interest. But I do understand that a cool powerline looking theme could be a good thing for oh-my-fish and would not be that hard (just import the segments, coloscheme and FLCOSE function and everything work).

I also just saw that Oh-my-fish uses the zip file only if it could not find git installed so I have a solution for a common code base + the ease of installation.

Firstly in the install script just use the option --recursive during git clone it will checkout submodule automaticaly. Then the function when sourced will check if the submodule has been checked out, else it grabs the fishline zip file and install it in place of where the submodule would normaly be.

Oh-my-fish user still have the expansion of fishline and the ones using the zip file have the current version installed.

from fishline.

 avatar commented on June 3, 2024

Mmm I agree.

If you think that would work, give it a go.

Anyhow, not a theme, but a plugin to switch fishline themes would be the best way to go it seems.

from fishline.

0rax avatar 0rax commented on June 3, 2024

Well I made everything works for the install, I will write the README today, and for the fishline theme switcher I will see how it could be done because I will have to write the config somewhere.

By the way, submodules need to be updated on change on te original repository. If you dont mind I can make a pull request to update it each time I think a milestone is met (like a lot of optimization or new segment...)

from fishline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.