Browse Source

Update fish update cmd and misc syntax fixes #fishshell

Colin Powell 6 years ago
parent
commit
759c476f35

+ 4 - 4
fish/.config/fish/functions/fish_greeting.fish

@@ -1,6 +1,6 @@
 function fish_greeting -d "What's up, fish?"
 function fish_greeting -d "What's up, fish?"
-  set_color $fish_color_autosuggestion
-  uname -nmsr
-  uptime
-  set_color normal
+    set_color $fish_color_autosuggestion
+    uname -nmsr
+    uptime
+    set_color normal
 end
 end

+ 2 - 1
fish/.config/fish/functions/fish_mode_prompt.fish

@@ -5,4 +5,5 @@
 #
 #
 #     set -g theme_display_vi no
 #     set -g theme_display_vi no
 
 
-function fish_mode_prompt; end
+function fish_mode_prompt
+end

File diff suppressed because it is too large
+ 540 - 473
fish/.config/fish/functions/fish_prompt.fish


+ 51 - 46
fish/.config/fish/functions/fish_right_prompt.fish

@@ -2,69 +2,74 @@
 #     set -g theme_date_format "+%a %H:%M"
 #     set -g theme_date_format "+%a %H:%M"
 
 
 function __bobthefish_cmd_duration -S -d 'Show command duration'
 function __bobthefish_cmd_duration -S -d 'Show command duration'
-  [ "$theme_display_cmd_duration" = "no" ]; and return
-  [ -z "$CMD_DURATION" -o "$CMD_DURATION" -lt 100 ]; and return
+    [ "$theme_display_cmd_duration" = "no" ]
+    and return
 
 
-  if [ "$CMD_DURATION" -lt 5000 ]
-    echo -ns $CMD_DURATION 'ms'
-  else if [ "$CMD_DURATION" -lt 60000 ]
-    __bobthefish_pretty_ms $CMD_DURATION s
-  else if [ "$CMD_DURATION" -lt 3600000 ]
-    set_color $fish_color_error
-    __bobthefish_pretty_ms $CMD_DURATION m
-  else
-    set_color $fish_color_error
-    __bobthefish_pretty_ms $CMD_DURATION h
-  end
+    [ -z "$CMD_DURATION" -o "$CMD_DURATION" -lt 100 ]
+    and return
 
 
-  set_color $fish_color_normal
-  set_color $fish_color_autosuggestion
+    if [ "$CMD_DURATION" -lt 5000 ]
+        echo -ns $CMD_DURATION 'ms'
+    else if [ "$CMD_DURATION" -lt 60000 ]
+        __bobthefish_pretty_ms $CMD_DURATION s
+    else if [ "$CMD_DURATION" -lt 3600000 ]
+        set_color $fish_color_error
+        __bobthefish_pretty_ms $CMD_DURATION m
+    else
+        set_color $fish_color_error
+        __bobthefish_pretty_ms $CMD_DURATION h
+    end
 
 
-  [ "$theme_display_date" = "no" ]
+    set_color $fish_color_normal
+    set_color $fish_color_autosuggestion
+
+    [ "$theme_display_date" = "no" ]
     or echo -ns ' ' $__bobthefish_left_arrow_glyph
     or echo -ns ' ' $__bobthefish_left_arrow_glyph
 end
 end
 
 
 function __bobthefish_pretty_ms -S -a ms interval -d 'Millisecond formatting for humans'
 function __bobthefish_pretty_ms -S -a ms interval -d 'Millisecond formatting for humans'
-  set -l interval_ms
-  set -l scale 1
+    set -l interval_ms
+    set -l scale 1
 
 
-  switch $interval
-    case s
-      set interval_ms 1000
-    case m
-      set interval_ms 60000
-    case h
-      set interval_ms 3600000
-      set scale 2
-  end
+    switch $interval
+        case s
+            set interval_ms 1000
+        case m
+            set interval_ms 60000
+        case h
+            set interval_ms 3600000
+            set scale 2
+    end
 
 
-  switch $FISH_VERSION
-    # Fish 2.3 and lower doesn't know about the -s argument to math.
-    case 2.0.\* 2.1.\* 2.2.\* 2.3.\*
-      math "scale=$scale;$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
-    case \*
-      math -s$scale "$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
-  end
+    switch $FISH_VERSION
+        # Fish 2.3 and lower doesn't know about the -s argument to math.
+        case 2.0.\* 2.1.\* 2.2.\* 2.3.\*
+            math "scale=$scale;$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
+        case \*
+            math -s$scale "$ms/$interval_ms" | string replace -r '\\.?0*$' $interval
+    end
 end
 end
 
 
 function __bobthefish_timestamp -S -d 'Show the current timestamp'
 function __bobthefish_timestamp -S -d 'Show the current timestamp'
-  [ "$theme_display_date" = "no" ]; and return
-  set -q theme_date_format
+    [ "$theme_display_date" = "no" ]
+    and return
+
+    set -q theme_date_format
     or set -l theme_date_format "+%c"
     or set -l theme_date_format "+%c"
 
 
-  echo -n ' '
-  date $theme_date_format
+    echo -n ' '
+    date $theme_date_format
 end
 end
 
 
 function fish_right_prompt -d 'bobthefish is all about the right prompt'
 function fish_right_prompt -d 'bobthefish is all about the right prompt'
-  set -l __bobthefish_left_arrow_glyph \uE0B3
-  if [ "$theme_powerline_fonts" = "no" ]
-    set __bobthefish_left_arrow_glyph '<'
-  end
+    set -l __bobthefish_left_arrow_glyph \uE0B3
+    if [ "$theme_powerline_fonts" = "no" ]
+        set __bobthefish_left_arrow_glyph '<'
+    end
 
 
-  set_color $fish_color_autosuggestion
+    set_color $fish_color_autosuggestion
 
 
-  __bobthefish_cmd_duration
-  __bobthefish_timestamp
-  set_color normal
+    __bobthefish_cmd_duration
+    __bobthefish_timestamp
+    set_color normal
 end
 end

+ 18 - 18
fish/.config/fish/functions/fish_title.fish

@@ -5,30 +5,30 @@
 #     set -g theme_title_use_abbreviated_path no
 #     set -g theme_title_use_abbreviated_path no
 
 
 function __bobthefish_title_user -S -d 'Display actual user if different from $default_user'
 function __bobthefish_title_user -S -d 'Display actual user if different from $default_user'
-  if [ "$theme_title_display_user" = 'yes' ]
-    if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
-      set -l IFS .
-      hostname | read -l hostname __
-      echo -ns (whoami) '@' $hostname ' '
+    if [ "$theme_title_display_user" = 'yes' ]
+        if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
+            set -l IFS .
+            hostname | read -l hostname __
+            echo -ns (whoami) '@' $hostname ' '
+        end
     end
     end
-  end
 end
 end
 
 
 function fish_title
 function fish_title
-  __bobthefish_title_user
+    __bobthefish_title_user
 
 
-  if [ "$theme_title_display_process" = 'yes' ]
-    echo $_
+    if [ "$theme_title_display_process" = 'yes' ]
+        echo $_
 
 
-    [ "$theme_title_display_path" != 'no' ]
-      and echo ' '
-  end
+        [ "$theme_title_display_path" != 'no' ]
+        and echo ' '
+    end
 
 
-  if [ "$theme_title_display_path" != 'no' ]
-    if [ "$theme_title_use_abbreviated_path" = 'no' ]
-      echo $PWD
-    else
-      prompt_pwd
+    if [ "$theme_title_display_path" != 'no' ]
+        if [ "$theme_title_use_abbreviated_path" = 'no' ]
+            echo $PWD
+        else
+            prompt_pwd
+        end
     end
     end
-  end
 end
 end

+ 8 - 0
fish/.config/fish/functions/update.fish

@@ -0,0 +1,8 @@
+function update
+    pushd ~/dotfiles
+    git stash
+    git pull --rebase
+    fisher
+    git stash apply
+    popd
+end

+ 0 - 6
fish/.config/fish/functions/updot.fish

@@ -1,6 +0,0 @@
-function updot
-    pushd ~/devel/dotfiles
-    git pull --rebase
-    fisher
-    popd
-end

Some files were not shown because too many files changed in this diff