Page 1 of 1

config.fish

Posted: Sun Mar 12, 2017 3:53 pm
by GekkoP
I've been using/testing the Fish shell in the last couple of days.

My setup is here: https://github.com/manuel-uberti/dotfil ... onfig/fish

And for the Emacs lovers out there:

Code: Select all

(use-package fish-mode                  ; Handle Fish shell scripts
  :ensure t
  :mode ("\\.fish\\'" . fish-mode)
  :config
  ;; Run fish_indent before save
  (add-hook 'fish-mode-hook
            (lambda ()
              (add-hook 'before-save-hook 'fish_indent-before-save))))
Let's see if Fish can move me away from Zsh for a while.

Re: config.fish

Posted: Wed Mar 15, 2017 9:50 pm
by GekkoP
So far so good. I particularly like the clean syntax for custom functions.

For instance:

Code: Select all

function get -d 'Download from a remote URL'
    if command --search 'curl' >/dev/null
        curl --continue-at - --location --progress-bar --remote-name --remote-time $argv
    else if command --search 'wget' >/dev/null
        wget --continue --progress=bar --timestamping $argv
    else
        echo 'Don\'t know how to download'
        return 1
    end
end

Re: config.fish

Posted: Sun Mar 19, 2017 1:42 pm
by akts
Fish ootb experience is pretty snazzy. It's almost like zsh + oh-my-zsh in a single package.

Thanks for the sauce GekkoP :)

Re: config.fish

Posted: Sun Mar 19, 2017 2:45 pm
by GekkoP
^ Yes, it feels like a bloated zsh at first (which in turn feels like a bloated bash, which it's a bloated...). But it won me over with its completion and its syntax. :)

Re: config.fish

Posted: Fri Nov 24, 2017 4:47 pm
by GekkoP
New release of Fish added SSH hosts completion among other things. I also added z (instead of autojump) and docker-completion via fisherman.

Rock solid experience.

Re: config.fish

Posted: Mon Nov 27, 2017 9:35 am
by wuxmedia
"hosts completion" how can it know...? does it check your .ssh/config or the known hosts?
That's the only thing I would like, with having potentially a metric fuckton of hosts to attach to.

Re: config.fish

Posted: Mon Nov 27, 2017 1:10 pm
by GekkoP
It checks .ssh/config.

Re: config.fish

Posted: Fri Dec 01, 2017 10:12 am
by wuxmedia
uh missed this. right, turns out bash can do the same thing which is quite handy.
Hmm, or the shell can read the entries in know_hosts, which is a slightly more sensible approach.

Re: config.fish

Posted: Fri Dec 01, 2017 11:14 am
by GekkoP
Oh yes, bash and zsh can do that too. But you know me, I fancy hip shells.

Re: config.fish

Posted: Sat Dec 02, 2017 6:00 am
by Baconator
Why not just bash?

It's all you need.

Re: config.fish

Posted: Sat Dec 02, 2017 11:36 am
by GekkoP
^ Because, as stated above, I fancy hip shells indeed.

Re: config.fish

Posted: Sat Dec 02, 2017 2:46 pm
by wuxmedia
Honestly I only use bash because ALL the machines I SSH into only ever have bash.
For me using anything would be utterly pointless, I don't even have any clever aliases (although I have started realising I can sneak them into root's .bashrc.
But if you are devving on ones own machine and pushing code to servers - who cares?
Again for me learning/using emacs is a waste of time for 98% of my shell time (although there is someone who keeps trying to use emacs on machines sometimes, when I'm poking about in the bash history)

Re: config.fish

Posted: Sat Dec 02, 2017 3:19 pm
by GekkoP
Well, as always YMMV.

I couldn't live without Emacs, it's always there for coding and writing. Thus, Eshell and shell-mode are there too, and Dired for file management is pretty much the only file manager I use these days when not on a terminal. Even SSH for just file editing happens inside Emacs, in my case.

When I am on a terminal, I use ssh only for my home server (which runs fish) and work servers (which run zsh).

Re: config.fish

Posted: Sat Dec 02, 2017 5:02 pm
by wuxmedia
shell hipster wrote:work servers (which run zsh)
Interesting - we (at work) are all too old school here to run anything like that.

Re: config.fish

Posted: Sat Dec 02, 2017 5:25 pm
by GekkoP
^ The man in charge of those machines is a huge oh-my-zsh fanboy. Most of the times, I do an ssh tunnel to a specific port to access the database instance easily.

Re: config.fish

Posted: Sun Dec 03, 2017 2:43 pm
by pidsley
^ I can't count the number of support threads on the Arch forum that have been tracked to problems with oh-my-zsh.

Re: config.fish

Posted: Sun Dec 03, 2017 3:00 pm
by wuxmedia
^^ yeah - architect's choice I suppose, I doubt I'd even notice if it was fish or zsh - unless there is a special PS1 or I had a script which wouldn't work.
now Mosh, that is awesomely useful.

Re: config.fish

Posted: Mon Dec 18, 2017 1:30 pm
by franksinistra
Wux wrote: Mosh, that is awesomely useful.
I can't remember how many times have this specific tool saved my life (and my job). Not counting how many times it also saved me from spotty network connection, and other third world problems. 8)

Re: config.fish

Posted: Mon Dec 18, 2017 9:43 pm
by wuxmedia
damn Mod wandering off topic :D

Re: config.fish

Posted: Fri Jul 20, 2018 2:54 pm
by GekkoP

Code: Select all

function tarc -d 'Create archive using pigz'
    set PV (which pv)
    if test -n "$PV"
        echo $argv | read -l archive paths
        echo $paths | read -a paths
        set size (math (du -sb $paths | awk '{print $1}' | paste -sd "+" -))
        tar cfP - $paths | pv -s $size | pigz >$archive
    else
        echo "Please install pv!"
    end
end
Courtesy of Bodil Stokke.

This uses pigz to parallelize the compression process. Useful for huge archives.
Pigz compresses using threads to make use of multiple
processors and cores. The input is broken up into 128 KB
chunks with each compressed in parallel. The individual
check value for each chunk is also calculated in parallel.
The compressed data is written in order to the output, and a
combined check value is calculated from the individual check
values.