Skip to content

Commit

Permalink
Added a compact mode
Browse files Browse the repository at this point in the history
  • Loading branch information
noaccOS committed Apr 22, 2020
1 parent d66aa7f commit 773b332
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ set -U pure_symbol_prompt ">"
| **`pure_separate_prompt_on_error`** | `false` | Show last command [exit code as a separate character][exit-code]. |
| **`pure_begin_prompt_with_current_directory`** | `true` | `true`: _`pwd` `git`, `SSH`, duration_.<br/>`false`: _`SSH` `pwd` `git`, duration_. |
| **`pure_reverse_prompt_symbol_in_vimode`** | `true` | `true`: `` indicate a non-insert mode.<br/>`false`: indicate vi mode with `[I]`, `[N]`, `[V]`. |
| **`pure_compact_mode`** | `false` | `true`: Don't show direcory line when in home |

#### Colors

Expand Down
5 changes: 4 additions & 1 deletion conf.d/pure.fish
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ _pure_set_default pure_color_dark black

# Prompt
_pure_set_default pure_symbol_prompt ""
_pure_set_default pure_symbol_reverse_prompt "" # used for VI mode
_pure_set_default pure_symbol_reverse_prompt "" # used for VI mode
_pure_set_default pure_color_prompt_on_error pure_color_danger
_pure_set_default pure_color_prompt_on_success pure_color_success

Expand Down Expand Up @@ -64,3 +64,6 @@ _pure_set_default pure_reverse_prompt_symbol_in_vimode true

# Title
_pure_set_default pure_symbol_title_bar_separator ""

# Compact mode
_pure_set_default pure_compact_mode false
8 changes: 7 additions & 1 deletion functions/_pure_prompt_new_line.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ function _pure_prompt_new_line \
--on-event fish_prompt

set --local new_line
if test $_pure_fresh_session = false

if begin
test $pure_compact_mode = false; or test "$PWD" != "$HOME"
end; and test $_pure_fresh_session = false
# don't show new line if it's a fresh session
# or if compact mode is enabled and pwd = ~

set new_line "\n"
end

Expand Down
14 changes: 9 additions & 5 deletions functions/fish_prompt.fish
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
function fish_prompt
set --local exit_code $status # save previous exit code
set --local exit_code $status # save previous exit code

echo -e -n (_pure_prompt_beginning) # init prompt context (clear current line, etc.)

if test $pure_compact_mode = false; or test "$PWD" != "$HOME" #if compact mode is enabled and pwd = ~, don't show the first line
echo -e (_pure_prompt_first_line) # print current path, git branch/status, command duration
end

echo -e -n (_pure_prompt_beginning) # init prompt context (clear current line, etc.)
echo -e (_pure_prompt_first_line) # print current path, git branch/status, command duration
_pure_place_iterm2_prompt_mark # place iTerm shell integration mark
echo -e -n (_pure_prompt $exit_code) # print prompt
echo -e (_pure_prompt_ending) # reset colors and end prompt
echo -e -n (_pure_prompt $exit_code) # print prompt
echo -e (_pure_prompt_ending) # reset colors and end prompt

set _pure_fresh_session false
end

0 comments on commit 773b332

Please sign in to comment.