Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
83503f5f
Commit
83503f5f
authored
Aug 03, 2014
by
Joseph Tannhuber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added command duration segment and username/hostname for ssh connections
parent
3a1c4228
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
43 deletions
+62
-43
themes/budspencer/README.md
themes/budspencer/README.md
+2
-2
themes/budspencer/fish_right_prompt.fish
themes/budspencer/fish_right_prompt.fish
+60
-41
No files found.
themes/budspencer/README.md
View file @
83503f5f
...
...
@@ -16,6 +16,8 @@ Translation of zsh's prezto [budspencer theme][budspencer]
*
⚡: superuser indicator
## Right prompt segments
-
Last command's duration time
-
Git status
*
style can be toggled in NORMAL mode with
`,,`
between
-
`symbols`
(shows git status symbols, see below)
...
...
@@ -44,8 +46,6 @@ Translation of zsh's prezto [budspencer theme][budspencer]
## TODO
-
elapsed time indicator
-
host/username indicator for ssh connections
-
vi REPLACE mode
[
budspencer
]:
https://github.com/tannhuber/prezto
...
...
themes/budspencer/fish_right_prompt.fish
View file @
83503f5f
# TODO: color definitions cleanup
# TODO: elapsed time segment
# TODO: username/host segment for ssh connections
# Init colors
...
...
@@ -66,6 +64,17 @@ function __budspencer_is_git_stashed -d "Check if there are stashed commits"
echo (command git stash list ^/dev/null | wc -l | awk '{print $1}')
end
set git_style "symbols"
function fish_git_toggle_cm --description "Toggles style of git segment, press ,, in NORMAL mode"
if test $git_style = "symbols"
set git_style "counts"
else
set git_style "symbols"
end
commandline -f repaint
end
bind -M default ',,' fish_git_toggle_cm
if set -q -x $PWDSTYLE
set -x PWDSTYLE short long none
end
...
...
@@ -81,44 +90,15 @@ function fish_pwd_toggle_cm --description "Toggles style of pwd segment, press s
end
bind -M default ' ' fish_pwd_toggle_cm
set git_style "symbols"
function fish_git_toggle_cm --description "Toggles style of git segment, press ,, in NORMAL mode"
if test $git_style = "symbols"
set git_style "counts"
else
set git_style "symbols"
end
commandline -f repaint
end
bind -M default ',,' fish_git_toggle_cm
function fish_pwd_prompt_cm --description "Displays the present working directory"
switch $fish_bind_mode
case default
set_color blue
echo -n ""
set_color normal
set_color --background blue 000
case insert
set_color yellow
echo -n ""
set_color normal
set_color --background yellow 000
case visual
set_color magenta
echo -n ""
set_color normal
set_color --background magenta 000
end
switch $pwd_style
case none
echo -n ' '
case short
echo -n ' '(prompt_pwd)' '
case long
echo -n ' '$PWD' ' # | sed "s|$HOME|~|"
function fish_cmd_duration_cm -d "Displays the elapsed time of last command"
if test (count $CMD_DURATION) -gt 0
set -l duration (echo $CMD_DURATION | tr -d '[[:space:]]' | sed 's|\.[[:digit:]]*||')
if test $last_status -ne 0
echo -n $fcol_base02""$bcol_base02$fcol_red" "$duration
else
echo -n $fcol_base02""$bcol_base02$fcol_green" "$duration
end
end
set_color normal
end
function fish_git_prompt_cm --description "Displays the git symbols"
...
...
@@ -205,14 +185,53 @@ function fish_git_prompt_cm --description "Displays the git symbols"
end
end
function fish_pwd_prompt_cm --description "Displays the present working directory"
set -l user_host " "
if test (count $SSH_CLIENT) -gt 0
set user_host " "$USER"@"(hostname)
if test $pwd_style != "none"
set user_host $user_host":"
end
end
switch $fish_bind_mode
case default
set_color blue
echo -n ""
set_color normal
set_color --background blue 000
case insert
set_color yellow
echo -n ""
set_color normal
set_color --background yellow 000
case visual
set_color magenta
echo -n ""
set_color normal
set_color --background magenta 000
end
switch $pwd_style
case none
echo -n $user_host' '
case short
echo -n $user_host(prompt_pwd)' '
case long
echo -n $user_host$PWD' ' # | sed "s|$HOME|~|"
end
set_color normal
end
function fish_right_prompt -d "Write out the right prompt of the budspencer theme"
# Segments
# command duration
set ps_duration (fish_cmd_duration_cm)
# git
set ps_git (fish_git_prompt_cm)
if test -n "$ps_git"
set ps_git $fcol_base0
2""$bcol_base02
""$ps_git
set ps_git $fcol_base0
1""$bcol_base01
""$ps_git
end
# pwd
...
...
@@ -221,6 +240,6 @@ function fish_right_prompt -d "Write out the right prompt of the budspencer them
set ps_pwd (fish_pwd_prompt_cm)
end
echo -n $ps_git $ps_pwd
echo -n $ps_
duration $ps_
git $ps_pwd
set_color normal
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment