mirror of https://github.com/mitchell/dotfiles.git
Simplify prompt and cleanup sync script tmp space handling
This commit is contained in:
parent
2b7261fb62
commit
a544dd57d1
|
@ -27,31 +27,29 @@ function fish_prompt --description 'Write out the prompt'
|
||||||
set color_cwd $fish_color_cwd
|
set color_cwd $fish_color_cwd
|
||||||
end
|
end
|
||||||
|
|
||||||
set suffix '#~>'
|
set suffix '#'
|
||||||
|
|
||||||
if test $fish_key_bindings = 'fish_vi_key_bindings'
|
if test $fish_key_bindings = 'fish_vi_key_bindings'
|
||||||
switch "$fish_bind_mode"
|
switch "$fish_bind_mode"
|
||||||
case 'insert'
|
case 'insert'
|
||||||
set suffix (set_color brblue) $suffix (set_color normal)
|
set suffix (set_color brblue) $suffix (set_color normal)
|
||||||
case 'default'
|
|
||||||
set suffix '###'
|
|
||||||
case 'visual'
|
case 'visual'
|
||||||
set suffix (set_color bryellow) '<~#' (set_color normal)
|
set suffix (set_color bryellow) $suffix (set_color normal)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
case '*'
|
case '*'
|
||||||
set color_cwd $fish_color_cwd
|
set color_cwd $fish_color_cwd
|
||||||
|
|
||||||
set suffix '$~>'
|
set suffix '>'
|
||||||
|
|
||||||
if test $fish_key_bindings = 'fish_vi_key_bindings'
|
if test $fish_key_bindings = 'fish_vi_key_bindings'
|
||||||
switch "$fish_bind_mode"
|
switch "$fish_bind_mode"
|
||||||
case 'insert'
|
case 'insert'
|
||||||
set suffix (set_color brblue) $suffix (set_color normal)
|
set suffix (set_color brblue) $suffix (set_color normal)
|
||||||
case 'default'
|
case 'default'
|
||||||
set suffix '<$>'
|
set suffix '^'
|
||||||
case 'visual'
|
case 'visual'
|
||||||
set suffix (set_color bryellow) '<~$' (set_color normal)
|
set suffix (set_color bryellow) 'v' (set_color normal)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -96,6 +94,11 @@ function fish_prompt --description 'Write out the prompt'
|
||||||
set git_branch ' on ' (set_color $branch_color) $cur_branch (set_color normal)
|
set git_branch ' on ' (set_color $branch_color) $cur_branch (set_color normal)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Set user prefix, based on docker machine name
|
||||||
|
if test -n "$DOCKER_MACHINE_NAME"
|
||||||
|
set user_prefix (set_color blue) $DOCKER_MACHINE_NAME (set_color normal) ' '
|
||||||
|
end
|
||||||
|
|
||||||
# Set go version, by existence of go mod or dep files
|
# Set go version, by existence of go mod or dep files
|
||||||
if test -e ./go.mod; or test -e ./Gopkg.toml; and command -sq go
|
if test -e ./go.mod; or test -e ./Gopkg.toml; and command -sq go
|
||||||
if test -z "$go_version"
|
if test -z "$go_version"
|
||||||
|
@ -116,11 +119,6 @@ function fish_prompt --description 'Write out the prompt'
|
||||||
set -g docker_version
|
set -g docker_version
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set user prefix, based on docker machine name
|
|
||||||
if test -n "$DOCKER_MACHINE_NAME"
|
|
||||||
set user_prefix (set_color blue) $DOCKER_MACHINE_NAME (set_color normal) ' '
|
|
||||||
end
|
|
||||||
|
|
||||||
# Set node (and ts) version, based on existance of package.json (and tsconfig.json)
|
# Set node (and ts) version, based on existance of package.json (and tsconfig.json)
|
||||||
if test -e ./package.json; and command -sq node
|
if test -e ./package.json; and command -sq node
|
||||||
if test -z "$node_version"
|
if test -z "$node_version"
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# Borrowed from bobthefish theme (https://github.com/oh-my-fish/theme-bobthefish).
|
# Some functions borrowed from bobthefish theme (https://github.com/oh-my-fish/theme-bobthefish).
|
||||||
# Copyright (c) 2013-2014 Justin Hileman.
|
# Copyright (c) 2013-2014 Justin Hileman.
|
||||||
#
|
#
|
||||||
# Modifications:
|
|
||||||
# - Remove lines 75, 76, 78 of original file. Setting '<' as the default left arrow glyph.
|
|
||||||
#
|
|
||||||
# You can override some default right prompt options in your config.fish:
|
# You can override some default right prompt options in your config.fish:
|
||||||
# set -g theme_date_format "+%a %H:%M"
|
# set -g theme_date_format "+%a %H:%M"
|
||||||
|
|
||||||
|
|
14
sync
14
sync
|
@ -36,17 +36,16 @@ function main
|
||||||
set_color grey
|
set_color grey
|
||||||
end
|
end
|
||||||
|
|
||||||
clean_up_tmp_space $cwd $start_dir
|
clean_up_tmp_space $cwd $start_dir $tmp_dir
|
||||||
|
|
||||||
set_color normal
|
set_color normal
|
||||||
echo -s \n 'Done syncing.'
|
echo -s \n 'Done syncing.'
|
||||||
end
|
end
|
||||||
|
|
||||||
function setup_tmp_space -a cwd
|
function setup_tmp_space -a cwd tmp_dir
|
||||||
if test ! "$cwd" = 'dotfiles'
|
if test ! "$cwd" = 'dotfiles'
|
||||||
cd /var/tmp
|
git clone --recurse-submodules https://github.com/mitchell/dotfiles.git $tmp_dir
|
||||||
git clone --recurse-submodules https://github.com/mitchell/dotfiles.git
|
cd $tmp_dir
|
||||||
cd ./dotfiles
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -104,11 +103,10 @@ function set_fish_universal_vars
|
||||||
source ./fish_universal_vars.fish
|
source ./fish_universal_vars.fish
|
||||||
end
|
end
|
||||||
|
|
||||||
function clean_up_tmp_space -a cwd start_dir
|
function clean_up_tmp_space -a cwd start_dir tmp_dir
|
||||||
if test ! "$cwd" = 'dotfiles'
|
if test ! "$cwd" = 'dotfiles'
|
||||||
cd ..
|
|
||||||
rm -rf ./dotfiles
|
|
||||||
cd $start_dir
|
cd $start_dir
|
||||||
|
rm -r $tmp_dir
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue