Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 10:36
    h-b commented #8071
  • 03:51
    Ay-355 starred fish-shell/fish-shell
  • 00:23
    torqueyy opened #8079
  • Jun 20 20:13

    faho on master

    docs: Document fallback colors … (compare)

  • Jun 20 19:39
    krobelus commented #7905
  • Jun 20 18:58

    krobelus on master

    __fish_print_help: remove spuri… (compare)

  • Jun 20 18:16
    krobelus commented #8073
  • Jun 20 18:01
    github-actions[bot] locked #7567
  • Jun 20 18:01
    github-actions[bot] locked #7569
  • Jun 20 18:01
    github-actions[bot] locked #7542
  • Jun 20 18:01
    github-actions[bot] locked #7562
  • Jun 20 18:01
    github-actions[bot] locked #7572
  • Jun 20 15:08
    zanchey commented #7905
  • Jun 20 15:08
    zanchey milestoned #7905
  • Jun 20 15:08
    zanchey review_requested #7905
  • Jun 20 15:05
    zanchey milestoned #8072
  • Jun 20 15:05
    zanchey milestoned #8076
  • Jun 20 15:05
    zanchey review_requested #8076
  • Jun 20 15:04
    zanchey commented #8072
  • Jun 20 15:04
    zanchey commented #8059
marcusatiliusregulus
@marcusatiliusregulus:matrix.org
[m]
yeah, characterwidth is a massive pain in the a with emojis. i stopped using them in prompts
Fabian Homborg
@faho
@defolos:matrix.org So the issue there is that bash does word-splitting - you set EDITOR="emacsclient -c", and when you later use $EDITOR without quotes, bash forgets that you originally used quotes and splits it up again. This is the reason why you almost always need to quote variables in bash.
Fish doesn't do that, so you've now set your editor to emacsclient -c as one argument, so it tries to execute e.g. /usr/bin/"emacsclient -c".
defolos
@defolos:matrix.org
[m]
ah!
Fabian Homborg
@faho
Essentially you set the variable how you want it split, and then fish remembers that
defolos
@defolos:matrix.org
[m]
Thanks for the explanation faho
marcusatiliusregulus
@marcusatiliusregulus:matrix.org
[m]
yeah, this feature rocks
David Adam
@zanchey
@syropian the first matching file in the path is executed. try putting /opt before $PATH. or use fish_add_path in fish 3.2+ to just do it one
David Adam
@zanchey
googling 'fish cd' did not give me the results I was after
Adrien
@why-not-try-calmer
Hello, I sometimes (1 out of 3 boots, I'd say) find myself not able to run executables from a bash or fish shell even though they are clearly on PATH. Is there a command to clear Fish's cache, or ideally, to clear all shell's cache?
tonyfinn
@tonyfinn:matrix.org
[m]
Not able to run or just missing from tab complete?
Adrien
@why-not-try-calmer

Not able to run or just missing from tab complete?

Not able to run. I get the ame symptoms as if the executable didn't exist at all.

It shows up at its expected location, but the fish shell renders its name in red fonts.
And neither is it able to run, nor is there any autocomplete for it.
David Adam
@zanchey
is the directory it is in listed in echo $PATH?
Adrien
@why-not-try-calmer

is the directory it is in listed in echo $PATH?

It is listed in echo $PATH

It happens 1/3 boots.
executable rendered in red fonts in fish shell
Fabian Homborg
@faho
@why-not-try-calmer That looks like your filesystem is broken, check the disk.
Or you have a race condition in your mounts
ridiculousfish
@ridiculousfish
@why-not-try-calmer also try checking the file's permissions, e.g. ls -lh /path/to/command. It may be mounted with a different user, or permissions may be wrong.
David Adam
@zanchey
fish will always set a basic path if none exists, so perhaps start looking in your config for anything that touches it
cecep
@the_cecep:matrix.org
[m]
Hi all! I'm trying to use string match -r to extract a directory from $PWD, but I can't make it work 100% correctly. What I want is this: I might be in '/Users/cecep/projects/project-dir' or maybe in a subdirectory like '/Users/cecep/projects/project-dir/data'. In both cases, I want string match -r to print '/Users/cecep/projects/project-dir'. What I came up with so far is: string match -r "$PROJECT_HOME\/.*?\/" "$PWD" (where $PROJECT_HOME is set to '/Users/cecep/projects'). This works fine when I'm in a subdirectory of 'project-dir', but doesn't find anything when I'm in 'project-dir' itself. I don't get what's wrong with the regex I'm using. Any hints? Would it be easier to use something other than string match -r?
marcusatiliusregulus
@marcusatiliusregulus:matrix.org
[m]
maybe make the last slash optional
Fabian Homborg
@faho
@the_cecep:matrix.org Check $PWD if you're in the directory itself - it won't have a trailing "/". So the solution is indeed to have the trailing slash optional - /?.
(also you need to escape $PROJECT_HOME since it can contain special regex characters - string escape --style=regex -- $PROJECT_HOME)
3 replies
cecep
@the_cecep:matrix.org
[m]
Thanks for the quick response! Hm when I use string match -r "$PROJECT_HOME\/.*?\/?" "$PWD", it always just prints $PROJECT_HOME (i.e. '/Users/cecep/projects')
Fabian Homborg
@faho
Ah, okay. string match by default only prints the matching part. So either end it in .* or use --entire/-e.
1 reply
faho
@faho:matrix.org
[m]
You still have a mandatory slash after PROJECT_HOME
(also no need to escape the slashes - they aren't special in regexes)
Fabian Homborg
@faho
(you're probably used to sed - in which case the slash is usually the delimiter between the arguments. In sed 's/foo/bar/ the "/" is the character after the operation, so it separates the "foo" and "bar" regex. It's also not really special inside those - try sed 's_foo_bar_'. It's just the first character after s)
So the full command is something like
string match -re (string escape --style=regex -- $PROJECT_HOME)"/?.*" $PWD
40 replies
stellarpower
@stellarpower
I have only just seen the web UI for the first time, it's awesome! Good job!
Johan Zietsman
@johan.zietsman_gitlab
I am using fish 3.1.0
Is it possible to get access to the --description option value passed to the function command inside the created function? I would like to print it as part of the help text.
function my_function --description "My function description"
    echo $function_description
end
marcusatiliusregulus
@marcusatiliusregulus:matrix.org
[m]
no, but you can instead set the description value from inside the function
Johan Zietsman
@johan.zietsman_gitlab
How would I do that?
marcusatiliusregulus
@marcusatiliusregulus:matrix.org
[m]
~ > function f
        set docstring "this is f
        it has a docstring
        and can print it"
        functions -d $docstring (status function)
        echo this is f with the docstring:
        echo $docstring
    end
~ > f
this is f with the docstring:
this is f
it has a docstring
and can print it
~> functions f
# Defined interactively
function f --description this\ is\ f\nit\ has\ a\ docstring\nand\ can\ print\ it
set docstring "this is f
it has a docstring
and can print it"
functions -d $docstring (status function)
echo this is f with the docstring:
echo $docstring
end
Johan Zietsman
@johan.zietsman_gitlab
Thanks for the help, @marcusatiliusregulus:matrix.org. I only started using fish today, so I will figure out what you did in the example.
I noticed two new things for me: functions -d, and status function.
Johan Zietsman
@johan.zietsman_gitlab
I have it working. Thanks @marcusatiliusregulus:matrix.org .
Anselm Schüler
@schuelermine
How the hell does $status_generation work? I don’t get what it’s supposed to represent…
Fabian Homborg
@faho
@schuelermine It's a variable that changes whenever $status is updated. So if you run false it'll be updated, if you run set it won't be. It's basically only useful to mark in your prompt when $status was carried over
Anselm Schüler
@schuelermine
Does it ever get reset?
Fabian Homborg
@faho
It's not guaranteed to be increasing, it's guaranteed to be changing. I think it wraps around?
Yeah, it's backed by a uint64, so it wraps around after 64 bits worth have been used. So in practice not
but it's still a good idea to only ever check if it's !=, not >
Johannes Altmanninger
@krobelus
hmm do we want __fish_commandline_prepend or fish_commandline_prepend?
ortensiple
@ortensiple:matrix.org
[m]
what about one underscore?
muttsuri
@muttsuri:matrix.org
[m]
Hello I have a question, I'm trying to write a function to convert a windows style path to a unix style path, this is within WSL context, so it doesn't need to be 100% to unix specification.
I was trying to chain string replaces, but I'm having a hard time replacing the drive letter, e.g "C:" with itself but lowercase and without the " : ".
marcusatiliusregulus
@marcusatiliusregulus:matrix.org
[m]
muttsuri try this: use string sub and string lower: get the first character, lowercase it and add it to the rest of the string starting at index 2 (= without the ":")