Skip to content

Commit

Permalink
Added a compact mode
Browse files Browse the repository at this point in the history
  • Loading branch information
noaccOS authored and edouard-lopez committed Dec 17, 2020
1 parent 4f217d5 commit 095671c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ or changing the defaults in your `config.fish`:
| **`pure_show_subsecond_command_duration`** | `false` | Show subsecond (ex. 1.5s) in command duration. |
| **`pure_show_system_time`** | `false` | `true`: shows system time before the prompt symbol (as `%H:%M:%S`). |
| **`pure_threshold_command_duration`** | `5` | Show command duration when above this value (seconds). |
| **`pure_compact_mode`** | `false` | `true`: Don't show direcory line when in home |

### Colors

Expand Down
3 changes: 3 additions & 0 deletions conf.d/pure.fish
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,6 @@ _pure_set_default pure_symbol_title_bar_separator "-"

# Check for new release on startup
_pure_set_default pure_check_for_new_release false

# 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 095671c

Please sign in to comment.