Last active
January 9, 2018 22:04
-
-
Save squarism/fabc74604e108a8397aeb4056995e62a to your computer and use it in GitHub Desktop.
Fish Shell Awesomeness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Early days of fish shell impressions. | |
This is like honeymoon time but I really like it so far. | |
1. iTerm | |
alt+command goes back in history. Weird. Thought this was tab-navigation in iTerm. | |
2. Editing past commmands! | |
up & down to go through history (as usual) but then left-right take you into edit mode! | |
But how would you add a newline? Fish doesn't like `;` as much as zsh for newlines. | |
Well ... you can hit alt+enter and it will do a soft return! | |
3. Regex matching and lightweight data science | |
Let's say we have a command we want to run over and over again and capture STDERR text with `time` and append it to a log. | |
Let's say we want to run it 25 times and then stop. | |
touch ~/Desktop/sleep_times.txt | |
while [ (wc -l ~/Desktop/sleep_times.txt | string match -r '\d+') -lt 25 ] | |
echo "Doing another run ..." | |
time 2>> ~/Desktop/sleep_times.txt sleep 1 | |
end | |
Fish comes with very nice functions for string manipulation which can be found here: | |
https://github.com/fish-shell/fish-shell/blob/master/doc_src/string.txt | |
For example, we could sum up the results real quick with `string join`. | |
cat ~/Desktop/sleep_times.txt | string match -r '(\d+\.\d+) real' | grep -v real | string join ' + ' | bc | |
25.00 | |
If the above command doesn't save into your history, it's because it has leading spaces. (WTF) | |
4. Bob The Fish, packages, fzf. It's all really really nice. I think coupled with Mosh shell a lot of legacy goes away. | |
There is bash support with a plugin called `bass`. `fisher ls` shows plugins if you are using fisherman (do it). | |
5. Customizing the bobthefish theme is a tad weird. Maybe there's another way to do it. I don't think so because the theme file is commented with instructions. | |
``` | |
# ~/.config/fish/functions/fish_prompt.fish | |
# line 909 or so | |
# These changes darken the git prompt colors a bit. | |
# But I believe you need to define the existing colors for it to work. | |
switch "$theme_color_scheme" | |
case 'user' | |
set -g theme_color_scheme user | |
set -g __color_initial_segment_exit ffffff ce000f --bold | |
set -g __color_initial_segment_su ffffff 189303 --bold | |
set -g __color_initial_segment_jobs ffffff 255e87 --bold | |
set -g __color_path 333333 999999 | |
set -g __color_path_basename 333333 ffffff --bold | |
set -g __color_path_nowrite 660000 cc9999 | |
set -g __color_path_nowrite_basename 660000 cc9999 --bold | |
set -g __color_repo 325433 white | |
set -g __color_repo_work_tree 333333 ffffff --bold | |
set -g __color_repo_dirty 870b00 ffffff | |
set -g __color_repo_staged f6b117 3a2a03 | |
set -g __color_vi_mode_default 999999 333333 --bold | |
set -g __color_vi_mode_insert 189303 333333 --bold | |
set -g __color_vi_mode_visual f6b117 3a2a03 --bold | |
set -g __color_vagrant 48b4fb ffffff --bold | |
set -g __color_username cccccc 255e87 | |
set -g __color_rvm af0000 cccccc --bold | |
set -g __color_virtualfish 005faf cccccc --bold | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment