diff --git a/README.md b/README.md index fe9949a..d8518f5 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ This theme is based loosely on [agnoster][agnoster]. * Previous command failed (**`!`**) * Background jobs (**`%`**) * You currently have superpowers (**`$`**) + * Cursor on newline * Current vi mode * `User@Host` (unless you're the default user) * Current RVM, rbenv or chruby (Ruby) version @@ -92,6 +93,7 @@ set -g default_user your_normal_user set -g theme_color_scheme dark set -g fish_prompt_pwd_dir_length 0 set -g theme_project_dir_length 1 +set -g theme_newline_cursor yes ``` **Title options** @@ -109,6 +111,7 @@ set -g theme_project_dir_length 1 - `theme_git_worktree_support`. If you do any git worktree shenanigans, setting this to `yes` will fix incorrect project-relative path display. If you don't do any git worktree shenanigans, leave it disabled. It's faster this way :) - `fish_prompt_pwd_dir_length`. bobthefish respects the Fish `$fish_prompt_pwd_dir_length` setting to abbreviate the prompt path. Set to `0` to show the full path, `1` (default) to show only the first character of each parent directory name, or any other number to show up to that many characters. - `theme_project_dir_length`. The same as `$fish_prompt_pwd_dir_length`, but for the path relative to the current project root. Defaults to `0`; set to any other number to show an abbreviated path. +- `theme_newline_cursor`. Use `yes` to have cursor start on a new line. By default the prompt is only one line. When working with long directories it may be preferrend to have cursor on the next line. **Color scheme options** diff --git a/fish_prompt.fish b/fish_prompt.fish index 5ac1af7..5044968 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -36,6 +36,7 @@ # set -g theme_color_scheme dark # set -g fish_prompt_pwd_dir_length 0 # set -g theme_project_dir_length 1 +# set -g theme_newline_cursor yes # =========================== # Helper methods @@ -279,6 +280,16 @@ function __bobthefish_finish_segments -S -d 'Close open prompt segments' echo -ns $__bobthefish_right_black_arrow_glyph ' ' end + if [ "$theme_newline_cursor" = 'yes' ] + echo -ens "\n" + set_color $fish_color_autosuggestion + if [ "$theme_powerline_fonts" = "no" ] + echo -ns '> ' + else + echo -ns "$__bobthefish_right_arrow_glyph " + end + end + set_color normal set __bobthefish_current_bg end @@ -396,9 +407,9 @@ function __bobthefish_prompt_status -S -a last_status -d 'Display symbols for a set_color normal set_color -b $__color_initial_segment_exit if [ "$theme_show_exit_status" = 'yes' ] - echo -ns $last_status ' ' + echo -ns $last_status ' ' else - echo -n $__bobthefish_nonzero_exit_glyph + echo -n $__bobthefish_nonzero_exit_glyph end end @@ -466,15 +477,15 @@ function __bobthefish_prompt_hg -S -a current_dir -d 'Display the actual hg stat end function __bobthefish_prompt_git -S -a current_dir -d 'Display the actual git state' - set -l dirty (command git diff --no-ext-diff --quiet --exit-code; or echo -n "$__bobthefish_git_dirty_glyph") - set -l staged (command git diff --cached --no-ext-diff --quiet --exit-code; or echo -n "$__bobthefish_git_staged_glyph") + set -l dirty (command git diff --no-ext-diff --quiet --exit-code ^/dev/null; or echo -n "$__bobthefish_git_dirty_glyph") + set -l staged (command git diff --cached --no-ext-diff --quiet --exit-code ^/dev/null; or echo -n "$__bobthefish_git_staged_glyph") set -l stashed (command git rev-parse --verify --quiet refs/stash >/dev/null; and echo -n "$__bobthefish_git_stashed_glyph") set -l ahead (__bobthefish_git_ahead) set -l new '' - set -l show_untracked (command git config --bool bash.showUntrackedFiles) + set -l show_untracked (command git config --bool bash.showUntrackedFiles ^/dev/null) if [ "$theme_display_git_untracked" != 'no' -a "$show_untracked" != 'false' ] - set new (command git ls-files --other --exclude-standard --directory --no-empty-directory) + set new (command git ls-files --other --exclude-standard --directory --no-empty-directory ^/dev/null) if [ "$new" ] set new "$__bobthefish_git_untracked_glyph" end