Coder Social home page Coder Social logo

Comments (6)

hug33k avatar hug33k commented on June 3, 2024

Do you use an other FLINE_PROMPT var?

Can you dynamicaly convert a "left" item into a "right" item?
I mean, is it possible to say to fishline that, if our segment is on the right, it must print first the triangle and then the content of the segment?

from fishline.

0rax avatar 0rax commented on June 3, 2024

Making a left item available as a right one is pretty easy, it's just a tweak to the FLINT_CLOSE function.

The only real hassle is that fish_right_prompt is handled in a way that it's printed after fish_prompt, and so if you have a multi-line left prompt, the right prompt will begin to print a the last line of the prompt. I, personally, dont think that's a big problem considering the example: A big top line with a little second and then the right prompt.

The only thing is making the fishline function availlable as a right and left prompt.

I though of three solutions.

  • source $FLINE_PATH/fishline.fish will create and set the fish_prompt and fish_right_prompt function based on two variable FLINE_PROMPT and FLINE_RIGHT_PROMPT. I dont really like this option if you want to have a special prompt when you are in a particular context (ie: a tty)
  • fishline will take an optionnal argument -r telling it to use the prompt passed as argument as right prompt and will be used like that
function fish_prompt
    fishline -s $status PWD GIT N ROOT
end
function fish_right_prompt
   fishline -r -s $status CLOCK
end
  • Simply have two functions fishline and fishline_right and two variable FLINE_PROMPT and FLINE_RIGHT_PROMPT working the way it is now,

I really like the last two options, the second one is, I think the more idiomatic way to do it, the second one is the easiest to use.

The second solution will also be good to preview what a prompt will look like by calling the fishline function with the appropriate argument but will break compatibility with older version.

If you have any better idea let me know.

from fishline.

hug33k avatar hug33k commented on June 3, 2024

I think the second option is the best way to implement a right prompt. But what if we only use the right prompt? Does the input cursor will be aligned to the left side?

from fishline.

0rax avatar 0rax commented on June 3, 2024

Late update on this, as I didnt really had time in the past 6 months.

For you question @hug33k: having only a fish_right_prompt will still make your command cursor aligned to the left of the terminal as you might expect.

As for this issue, I have been working on fishline v2.0.0 in the dev branch today: this version will include the possibility to create a fish_right_prompt using the 2nd option detailed above.

I put a great effort making this version pretty backward compatible with the older version of fishline so an update will not force you to make some configuration change.

More information about this new version can be found in commit b8df72a and commit 0fce382.

I will be glad if any of you can test this version before merging to master (especially on MacOSX).

from fishline.

hug33k avatar hug33k commented on June 3, 2024

Hi @0rax,
I will try to reinstall Fish on my Mac and test the new version soon.

from fishline.

0rax avatar 0rax commented on June 3, 2024

This will be part of the v2.0.0 final release of fishline and is already availlable on the dev branch.

Closing the issue

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.