forked from pure-fish/pure
-
Notifications
You must be signed in to change notification settings - Fork 1
/
_pure_init.fish
40 lines (33 loc) · 1.46 KB
/
_pure_init.fish
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Deactivate the default virtualenv prompt so that we can add our own
set --global --export VIRTUAL_ENV_DISABLE_PROMPT 1
# Whether or not is a fresh session
set --global _pure_fresh_session true
# Register `_pure_prompt_new_line` as an event handler fot `fish_prompt`
functions --query _pure_prompt_new_line
function _pure_uninstall --on-event pure_uninstall
rm -f $__fish_config_dir/conf.d/pure.fish
# backup fish_prompt and fish_title to default
cp $__fish_config_dir/functions/fish_prompt{,.pure-backup}.fish
cp $__fish_config_dir/functions/fish_title{,.pure-backup}.fish
# erase existing fish_prompt and fish_title to default
functions --erase fish_prompt
functions --erase fish_title
# restore fish_prompt and fish_title to default
cp {$__fish_data_dir,$__fish_config_dir}/functions/fish_prompt.fish
cp {$__fish_data_dir,$__fish_config_dir}/functions/fish_title.fish
# refresh fish_prompt and fish_title definitions
source $__fish_data_dir/functions/fish_prompt.fish
source $__fish_data_dir/functions/fish_title.fish
# erase _pure* variables
set --names \
| string replace --filter --regex '(^_?pure)' 'set --erase $1' \
| source
# erase _pure* functions
functions --names --all \
| string replace --filter --regex '(^_?pure)' 'functions --erase $1' \
| source
# delete _pure* files
for file in $__fish_config_dir/{functions,conf.d}/_pure_*
rm -f $file
end
end