Git Product home page Git Product logo

hydro's People

Contributors

bobsoppe avatar dnadlinger avatar giorgiga avatar jorgebucaran avatar kidonng avatar mattmc3 avatar netmute avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hydro's Issues

Handle replication of git base path within full path

That's maybe too specific but I have a directory structure somewhat like this

~/projects ❱ tree -L 2
.
├── project_a
│   ├── dev_project_a
│   ├── prd_project_a
│   ├── project_a
│   └── stg_project_a
└── project_b
    ├── dev_project_b
    ├── prd_project_b
    ├── project_b
    └── stg_project_b

Where all of these leaves are git repos. The thing is, when I get into ~/projects/project_a/project_a, the prompt is shown like this

~/p/project_a/project_a master ❱

And when I I get into ~/projects/project_a/project_a/src it goes like that

~/p/project_a/p/src master ❱

I've made a small patch to fix it

24c24
<         string replace -- "/$git_base/" /:/ |
---
>         string replace --regex -- "/($git_base)(?!.*\1)/" "/:/" |

Prompt doesn't handle ' in path

Just noticed this, thanks to the "Sid Meier's Civilization VI" folder:

~ ❱ mkdir "a'b"
~ ❱ cd a\'b/
~/ab\x1b[0m \x1b[0m\x1b[0m❱\x1b[0m 

Issues with job control

After latest updates I have funky problems with various apps and job control (when using fg builtin). I have a habit of suspending vim, running something in terminal, and returning back with fg. It took a while to notice that vim was "crashing". Some quick testing suggests it happens with other applications, so it's not vim's fault.

Steps to reproduce

> touch empty_file.txt
> less empty_file.txt CTRL + Z from less
fish: Job 1, 'less empty_file.txt' has stopped
> fg
Send job 1, “less empty_file.txt” to foreground CTRL + Z from less
fish: Job 1, 'less empty_file.txt has stopped

Program is killed by shell after the second suspend...

When I remove hydro plugin the problem doesn't show up anymore.
My plugin list is:

  • jethrokuan/z
  • jorgebucaran/replay.fish
  • franciscolourenco/done
  • jorgebucaran/hydro

Symbol issues

  • Mode prompt lacking symbol for replace mode, which is presented in Fish's default mode prompt, is this intended?
  • Pipestatus separator ǀ doesn't look good with JetBrains Mono on kitty, can this be changed to standard | or made configurable?
    image
    EDIT: looks like this is already reported in #15

When using SSH URI's for git Hydro continuously tries to authenticate against remote

On my Mac I use a tool called Secretive for managing my SSH keys. It notifies me when an application attempts to use the SSH keys it stores and I can choose to either permit the application to use the key or not. When using Hydro in a repository where I have the remote set to an SSH source, Hydro continuously attempts to authenticate against the remote repository and so I continuously get notifications that something is attempting to use my SSH keys whenever I cd into a local repository where the remote is an SSH source. It's super annoying. But also, I would rather that my shell prompt not connect to my private SSH repositories in the background all the time.

I fixed the issue by removing all references to the _hydro_git_info function in conf.d/hydro.fish. So something in the _hydro_git_info function is causing the issue. I don't really care what because I don't really need the extra git tracking.

Exiting a shell while hydro is still fetching throws error instead of exiting

I often find myself exiting a shell while hydro is still fetching something in the background, and I get the following error:

There are still jobs active:

   PID  Command
 91631  fish --private --command "
        ! command git --no-optional-locks rev-parse 2>/dev/null && set $_hydro_git && exit

        set branch (
            command git symbolic-ref --short HEAD 2>/dev/null ||
            command git describe --tags --exact-match HEAD 2>/dev/null ||
            command git rev-parse --short HEAD 2>/dev/null |
                string replace --regex -- '(.+)' '@\$1'
        )

        test -z \"\$$_hydro_git\" && set --universal $_hydro_git \"\$branch \"

        ! command git diff-index --quiet HEAD 2>/dev/null ||
            count (command git ls-files --others --exclude-standard) >/dev/null &&
            set info \"$hydro_symbol_git_dirty\"

        for fetch in $hydro_fetch false
            command git rev-list --count --left-right @{upstream}...@ 2>/dev/null |
                read behind ahead

            switch \"\$behind \$ahead\"
                case \" \" \"0 0\"
                case \"0 *\"
                    set upstream \" $hydro_symbol_git_ahead\$ahead\"
                case \"* 0\"
                    set upstream \" $hydro_symbol_git_behind\$behind\"
                case \*
                    set upstream \" $hydro_symbol_git_ahead\$ahead $hydro_symbol_git_behind\$behind\"
            end

            set --universal $_hydro_git \"\$branch\$info\$upstream \"

            test \$fetch = true && command git fetch --no-tags 2>/dev/null
        end
    " &

A second attempt to exit will terminate them.
Use 'disown PID' to remove jobs from the list without terminating them.

Hydro slowdown Fish's launch

Even though Hydro is much faster than Tide at rendering the prompt, like advertised (measured using time fish_prompt)

Hydro:

Executed in  172,00 micros    fish           external
   usr time  159,00 micros  159,00 micros    0,00 micros
   sys time   15,00 micros   15,00 micros    0,00 micro

Tide:

Executed in    2,06 millis    fish           external
   usr time    2,04 millis    2,04 millis    0,00 micros
   sys time    0,01 millis    0,01 millis    0,00 micros

It comes with the downside that it slowdown the launch (or perhaps the shutdown?) of Fish by roughly 8-10ms (mesured using hyperfine with the command fish -i -c "exit") on my machine:

Hydro:

Benchmark #1: fish -i -c "exit"
  Time (mean ± σ):      24.7 ms ±   1.4 ms    [User: 20.1 ms, System: 6.0 ms]
  Range (min … max):    20.1 ms …  30.3 ms    102 runs

Tide:

Benchmark #1: fish -i -c "exit"
  Time (mean ± σ):      16.7 ms ±   1.1 ms    [User: 14.1 ms, System: 3.5 ms]
  Range (min … max):    11.8 ms …  18.6 ms    146 runs

This is with the default settings on Hydro and the Pure preset on Tide with few icons. I can reproduce those results by uninstalling / reinstalling both prompts. My config.fish file is available here if needed

Background on the keys representing the vi mode

I've recently started to use hydro and I'm really enjoying it! One thing that is bothering me is the fact that there is a background on some vi modes, namely insert and normal:

image

image

image

image

I checked my config, but I couldn't find anything strange.

set -gx PNPM_HOME "$HOME/Library/pnpm"

# hydro
set -g hydro_multiline true
set -g fish_prompt_pwd_dir_length 0

fish_add_path /opt/homebrew/bin
fish_add_path PNPM_HOME 

if status is-interactive
    set fish_greeting "🌸"
    fish_vi_key_bindings
end

Environment details:

  • Shell: fish, version 3.5.1
  • Terminal: kitty, version 0.26.1
  • Hydro: don't know how to check the version, but I ran fisher update few minutes ago

Git branch lingers after `prevd-or-backward-word`

When I'm in a Git repository and I prevd-or-backward-word out of it with Alt+, the branch name still lingers on the prompt.

Reproducible in this container https://github.com/dideler/docker-fish-shell

~ ❱ fish --version
fish, version 3.2.2
~ ❱ fisher --version
fisher, version 4.4.2
~ ❱ fisher list 
jorgebucaran/fisher
jorgebucaran/hydro
~cd /tmp/src/jorgebucaran/hydro/
/t/s/j/hydro main ❱ # Press ALT-<left arrow> to run prevd-or-backward-word
~ main ❱ # This actually replaces the previous line

Also happens with Fish 3.5.1 on my actual system. Hydro version d4c107a.

No completion in just opened terminal

Sometimes (around once in twenty cases) when the terminal is opened, there are no autosuggestion until you press enter at least once. On attached git I'm typing different commands that should trigger autosuggestion:
hydro-bugs

additional variables to customize prompt

It would be nice to have some "blank" variables which can be used to add user-defined functionality.

You can always add your functionality like this:

functions --copy fish_prompt fish_prompt_origin
function fish_prompt
    echo -n \n"$os_icon "
    fish_prompt_origin
end

in your config.fish

But what if you want to add git branch icon?
You can edit fish_prompt.fish or row 95 in hydro.fish, but it would be much better to just use specific variable for it.

I think following variables would be useful:

hydro_prompt_prefix
hydro_prompt_suffix
hydro_pwd_prefix
hydro_pwd_suffix
hydro_git_prefix
hydro_git_suffix
hydro_duration_prefix
hydro_duration_suffix

Or maybe prefixes only are enough.

It can use existing colors for simplification.
E.g. hydro_pwd_prefix could be colored by hydro_color_pwd.

It can be used to add icons or additional user-defined functionality.

Prompt disappears in new session

I'm using fish 3.1.2 and fisher 4.1.0. When I install the prompt using Hydro it works as expected, but when I open a new terminal or tab, the prompt disappears completely. I have to reinstall the prompt for it to appear again.

mono repository

Slightly off-topic 🙂

Since github.com/fishpkg/fish-prompt-mono redirects here: do you happen to have a copy of github.com/fishpkg/fish-prompt-mono repository laying somewhere? Could you send it to me or upload somewhere? Thanks :)

Changing directory to a git repo does not show branch name immediately

The branch name does not appear upon cd into the repo, but on subsequent commands.

~ ❱ git clone https://github.com/jorgebucaran/hydro.git
Cloning into 'hydro'...
remote: Enumerating objects: 403, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 403 (delta 0), reused 1 (delta 0), pack-reused 400
Receiving objects: 100% (403/403), 108.71 KiB | 283.00 KiB/s, done.
Resolving deltas: 100% (199/199), done.
~ 1.5s ❱ cd hydro/
~/hydro ❱ fish -v
fish, version 3.1.0
~/hydro main ❱ fisher list 
jorgebucaran/fisher
jethrokuan/z
jethrokuan/fzf
jorgebucaran/hydro
~/hydro main ❱ 

Pre/Post prompt customization

@jorgebucaran - Are you open to a PR that would introduce two new variables into the prompt: a pre-prompt and a post-prompt like so...

set --query hydro_pre_prompt || set --global hydro_pre_prompt ""
set --query hydro_post_prompt || set --global hydro_post_prompt " "

The intent of the hydro_pre/post_prompt variables would be to allow users some to way to customize their prompt without having Hydro have to directly support all the customizations a user might dream up. For example, I like a more spacious prompt similar to Zsh's Pure, so I could get that by setting the pre-prompt variable to a new line in my config like so: set --global hydro_pre_prompt "\n".

Theoretically, with these variables a user could do whatever they wanted like adding a low battery indicator 🔋, or a python symbol 🐍 when they're in a python venv, or whatever - all without having to modify hydro itself. I'm open to other ideas on an implementation - just thought this would be a real simple change that would give the user more power in customizing their Hydro prompt.

The only change to Hydro in the PR to implement this would be adding those variables and then changing the fish_prompt function:

function fish_prompt
    echo -e "$hydro_pre_prompt...all-the-other-vars...$hydro_post_prompt"
end

Hide full path of last command with exit code != 0

Hydro extends the prompt with the full path of the last command that failed (exit code != 0). This path is for NixOS users very long (a path like /nix/store/p4i6hi976q7csprsb35d4wx797wzpri2-lorri-keep-env-hack-nix-shell) and I personally would like to hide the full path. Instead it would be enough to display the name of last command or hide it completly. Is there any option to configure this, or is a change required to implement this?

"error: process ID out of range" when in git directories

I am getting this error whenever I enter a git directory using the hydro shell:

 error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).

Show rust versions, etc.

Sorry if i am missing something obvious. I really like using Hydro. Would it be possible to display rust package versions like starship does?
image

Coloring of pwd

How did you achieve that only the current folder and the git root are colored? Those two get rendered bold, but everything has color.

Abbreviations can't be used until async paint is done

It seems like if I try to use an abbreviation too soon after a prompt is initially painted, abbreviations aren't available. If I wait a few moments, presumably after the async bit is resolved, abbreviations work as expected again. Does this sound plausible?

CleanShot.2022-01-11.at.09.29.54.mp4

"There are still jobs active" on exit

Sometimes when closing terminal with CTRL-D there is error message

There are still jobs active:

   PID  Command
2235785  fish --private --command "
        ! command git --no-optional-locks rev-parse 2>/dev/null && set $_hydro_git && exit

        set branch (
            command git symbolic-ref --short HEAD 2>/dev/null ||
            command git describe --tags --exact-match HEAD 2>/dev/null ||
            command git rev-parse --short HEAD 2>/dev/null |
                string replace --regex -- '(.+)' '@\$1'
        )

        test -z \"\$$_hydro_git\" && set --universal $_hydro_git \"\$branch \"

        ! command git diff-index --quiet HEAD 2>/dev/null ||
            count (command git ls-files --others --exclude-standard) >/dev/null &&
            set info \"$hydro_symbol_git_dirty\"

        for fetch in $hydro_fetch false
            command git rev-list --count --left-right @{upstream}...@ 2>/dev/null |
                read behind ahead

            switch \"\$behind \$ahead\"
                case \" \" \"0 0\"
                case \"0 *\"
                    set upstream \" $hydro_symbol_git_ahead\$ahead\"
                case \"* 0\"
                    set upstream \" $hydro_symbol_git_behind\$behind\"
                case \*
                    set upstream \" $hydro_symbol_git_ahead\$ahead $hydro_symbol_git_behind\$behind\"
            end

            set --universal $_hydro_git \"\$branch\$info\$upstream \"

            test \$fetch = true && command git fetch --no-tags 2>/dev/null
        end
    " &

A second attempt to exit will terminate them.
Use 'disown PID' to remove jobs from the list without terminating them.

Pressing CTRL-D again allows to close the terminal.

It's quite rare and I can't reproduce it on demand.

`Broken Pipe` Error gets printed when holding enter

Thank you very much for this prompt!

When I hold down enter, it gives the following error:

Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

Setup:

OS: MacOS Big Sur
fish: version 3.1.2

Screen Shot 2021-01-18 at 8 46 27 AM

Add dirty count for repo

What i mean by that, is to have a number following or preceding the symbol for a dirty repo. Kinda like tide does it
image

I really love hydro but this is one of the feature missing for me :(

Support Nixos Specific prompts

It would be nice if this prompt automatically displays Nixos relevant environments like described here in "Show that you are in a nix-shell".

Also great fish prompt!

Feature request: support for fish_prompt_pwd_dir_length

The default fish prompt has a variable fish_prompt_pwd_dir_length which tells if and how much to shorten directory names when printing pwd in the prompt, while hydro seems to always shorten directories to 1 character.

Would you consider implementing this functionality in hydro?

BTW: it may even be possible to just use the default pompt_pwd function from inside hydro (see https://fishshell.com/docs/current/cmds/prompt_pwd.html and/or functions prompt_pwd)

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.