From 28dfc4f985d1db3ac4709f51635c675905441f29 Mon Sep 17 00:00:00 2001 From: Andrew Choo Date: Sat, 10 Jun 2017 22:51:14 -0400 Subject: [PATCH 1/4] Add ability to have cursor start on a new line In order for the right prompt to work the new line must start with at least one character. A space is used for this purpose. This looks a bit strange so added option to include the default right arrow glyph. Lastly, added option to remove the right arrow glyph on the first (top) line. --- fish_prompt.fish | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index 4505d09..336bdf2 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -36,6 +36,9 @@ # 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 +# set -g theme_newline_cursor_arrow_glyph no +# set -g theme_newline_cursor_top_arrow_glyph no # =========================== # Helper methods @@ -276,7 +279,16 @@ function __bobthefish_finish_segments -S -d 'Close open prompt segments' if [ "$__bobthefish_current_bg" != '' ] set_color normal set_color $__bobthefish_current_bg - echo -ns $__bobthefish_right_black_arrow_glyph ' ' + if not [ "$theme_newline_cursor_top_arrow_glyph" = 'no' ] + echo -ns $__bobthefish_right_black_arrow_glyph + end + if [ "$theme_newline_cursor" = 'yes' ] + echo -ens "\n" + end + if not [ "$theme_newline_cursor_arrow_glyph" = 'no' ] + echo -ns "$__bobthefish_right_black_arrow_glyph" + end + echo -n ' ' end set_color normal From 176c3a7a6927b45f690dd8f69d0ed5f3096c0396 Mon Sep 17 00:00:00 2001 From: Andrew Choo Date: Sat, 10 Jun 2017 22:51:31 -0400 Subject: [PATCH 2/4] Remove tabs --- fish_prompt.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index 336bdf2..d8ef2b3 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -408,9 +408,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 From 8181b4526bbe4d31f8c2c833835fd6dad19c91a0 Mon Sep 17 00:00:00 2001 From: Andrew Choo Date: Sat, 10 Jun 2017 22:51:46 -0400 Subject: [PATCH 3/4] Update README --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index fe9949a..37dc89c 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,9 @@ This theme is based loosely on [agnoster][agnoster]. * Previous command failed (**`!`**) * Background jobs (**`%`**) * You currently have superpowers (**`$`**) + * Cursor on newline + * Prefix newline with right arrow glyph + * Keep right arrow glyph on live above newline * Current vi mode * `User@Host` (unless you're the default user) * Current RVM, rbenv or chruby (Ruby) version @@ -92,6 +95,9 @@ 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 +set -g theme_newline_cursor_arrow_glyph no +set -g theme_newline_cursor_top_arrow_glyph no ``` **Title options** @@ -109,6 +115,9 @@ 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. +- `theme_newline_cursor_arrow_glyph`. Use `no` have the new line start with a blank space. By default, the default right arrow glyph will be used followed by a single space (' '). Note that this space is required to have a correctly functioning right prompt. +- `theme_newline_cursor_top_arrow_glyph`. Use `no` to remove the right arrow glyph on the original (top) command prompt line. By default, the right arrow glyph will be used. **Color scheme options** From 0b3b5221604fc89d1a621a6291a509c0173a7ebe Mon Sep 17 00:00:00 2001 From: Andrew Choo Date: Sat, 17 Jun 2017 11:25:47 -0400 Subject: [PATCH 4/4] Implement newline cursor feature with one option instead of three Per bobthecow: "In keeping with bobthefish's goal to be opinionated but flexible, let's do this with one option, not three. I'm leaning toward: set -g theme_cursor_on_new_line yes Then: Always show the arrow at the end of the first line Always show a minimalist arrow at the start of the next line" --- README.md | 6 ------ fish_prompt.fish | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 37dc89c..d8518f5 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,6 @@ This theme is based loosely on [agnoster][agnoster]. * Background jobs (**`%`**) * You currently have superpowers (**`$`**) * Cursor on newline - * Prefix newline with right arrow glyph - * Keep right arrow glyph on live above newline * Current vi mode * `User@Host` (unless you're the default user) * Current RVM, rbenv or chruby (Ruby) version @@ -96,8 +94,6 @@ 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 -set -g theme_newline_cursor_arrow_glyph no -set -g theme_newline_cursor_top_arrow_glyph no ``` **Title options** @@ -116,8 +112,6 @@ set -g theme_newline_cursor_top_arrow_glyph no - `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. -- `theme_newline_cursor_arrow_glyph`. Use `no` have the new line start with a blank space. By default, the default right arrow glyph will be used followed by a single space (' '). Note that this space is required to have a correctly functioning right prompt. -- `theme_newline_cursor_top_arrow_glyph`. Use `no` to remove the right arrow glyph on the original (top) command prompt line. By default, the right arrow glyph will be used. **Color scheme options** diff --git a/fish_prompt.fish b/fish_prompt.fish index d8ef2b3..c6b1038 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -37,8 +37,6 @@ # set -g fish_prompt_pwd_dir_length 0 # set -g theme_project_dir_length 1 # set -g theme_newline_cursor yes -# set -g theme_newline_cursor_arrow_glyph no -# set -g theme_newline_cursor_top_arrow_glyph no # =========================== # Helper methods @@ -279,16 +277,17 @@ function __bobthefish_finish_segments -S -d 'Close open prompt segments' if [ "$__bobthefish_current_bg" != '' ] set_color normal set_color $__bobthefish_current_bg - if not [ "$theme_newline_cursor_top_arrow_glyph" = 'no' ] - echo -ns $__bobthefish_right_black_arrow_glyph + 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 - if [ "$theme_newline_cursor" = 'yes' ] - echo -ens "\n" - end - if not [ "$theme_newline_cursor_arrow_glyph" = 'no' ] - echo -ns "$__bobthefish_right_black_arrow_glyph" - end - echo -n ' ' end set_color normal