Remove fish configs
This commit is contained in:
		
							parent
							
								
									2f17a9f730
								
							
						
					
					
						commit
						8dfcbf9d74
					
				| @ -1,2 +0,0 @@ | |||||||
| clientId: 967920607022 |  | ||||||
| optOut: true |  | ||||||
| @ -1,2 +0,0 @@ | |||||||
| optOut: false |  | ||||||
| lastUpdateCheck: 1395917897186 |  | ||||||
| @ -1 +0,0 @@ | |||||||
| complete -x -c c -a "(ls $PROJECTS)" |  | ||||||
| @ -1 +0,0 @@ | |||||||
| complete -x -c h -a "(ls $HOME)" |  | ||||||
| @ -1,17 +0,0 @@ | |||||||
| function __cache_or_get_rake_completion -d "Create rake completions" |  | ||||||
|   mkdir -p "/tmp/rake_completion_cache_for_$USER" |  | ||||||
|   set -l hashed_pwd (pwd | md5) |  | ||||||
|   set -l rake_cache_file "/tmp/rake_completion_cache_for_$USER/$hashed_pwd" |  | ||||||
| 
 |  | ||||||
|   if not test -f "$rake_cache_file" |  | ||||||
|     rake -T 2>&1 | sed -e "s/^rake \([a-z:_0-9!\-]*\).*#\(.*\)/\1	\2/" > "$rake_cache_file" |  | ||||||
|   end |  | ||||||
|   cat "$rake_cache_file" |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __run_rake_completion |  | ||||||
|   test -f rakefile; or test -f Rakefile; or test -f rakefile.rb; or test -f Rakefile.rb |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| complete -x -c rake -a "(__cache_or_get_rake_completion)" -n __run_rake_completion |  | ||||||
| 
 |  | ||||||
| @ -1,27 +0,0 @@ | |||||||
| set -x EDITOR vim |  | ||||||
| 
 |  | ||||||
| set -x FISH $HOME/.config/fish |  | ||||||
| set -x DF $HOME/.dotfiles |  | ||||||
| set -x PROJECTS $HOME/Code |  | ||||||
| 
 |  | ||||||
| set -x GOPATH $HOME/go |  | ||||||
| 
 |  | ||||||
| set -x PYTHONSTARTUP $HOME/.pythonrc.py |  | ||||||
| set -x PIP_REQUIRE_VIRTUALENV false |  | ||||||
| set -x PIP_DOWNLOAD_CACHE ~/.pip/cache |  | ||||||
| set -x WORKON_HOME ~/.virtualenvs |  | ||||||
| set -g VIRTUALFISH_COMPAT_ALIASES |  | ||||||
| 
 |  | ||||||
| set -x fish_greeting '' |  | ||||||
| 
 |  | ||||||
| set -x DOCKER_HOST tcp://localhost:4243 |  | ||||||
| 
 |  | ||||||
| # status --is-interactive; and . (rbenv init -|psub) |  | ||||||
| 
 |  | ||||||
| . $FISH/includes/alias.fish |  | ||||||
| . $FISH/includes/ruby.fish |  | ||||||
| . $FISH/includes/path.fish |  | ||||||
| . $FISH/includes/virtualenv.fish |  | ||||||
| . $FISH/includes/antlr.fish |  | ||||||
| 
 |  | ||||||
| set -x SSL_CERT_FILE /usr/local/opt/curl-ca-bundle/share/ca-bundle.crt |  | ||||||
| @ -1,3 +0,0 @@ | |||||||
| function c |  | ||||||
|   cd $PROJECTS/$argv[1] |  | ||||||
| end |  | ||||||
| @ -1,20 +0,0 @@ | |||||||
| function fish_prompt --description 'Write out the prompt' |  | ||||||
|   set_color blue |  | ||||||
|   printf (__fish_basedir) |  | ||||||
|   if test -d .git |  | ||||||
|     set_color magenta |  | ||||||
|     __fish_git_need_commit |  | ||||||
|   end |  | ||||||
|   set_color normal |  | ||||||
|   printf ' › ' |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __fish_basedir |  | ||||||
|   echo (pwd | rev | cut -d/ -f1 | rev) |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __fish_git_need_commit |  | ||||||
|   /usr/local/bin/git diff --stat 2>/dev/null | awk -F',' '/files? changed/ { lc += $2 + $3 } END { |  | ||||||
|     if (lc > 100) printf " -- Y U NO COMMIT!? --" |  | ||||||
|   }' |  | ||||||
| end |  | ||||||
| @ -1,37 +0,0 @@ | |||||||
| function fish_right_prompt --description 'Write out the right prompt' |  | ||||||
|   if test -d .git |  | ||||||
|     __fish_git_unpushed |  | ||||||
|     __fish_git_dirty |  | ||||||
|     printf " " |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __fish_git_branch |  | ||||||
|   echo (/usr/local/bin/git symbolic-ref HEAD 2>/dev/null | rev | cut -d/ -f1 | rev) |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __fish_git_is_dirty |  | ||||||
|   echo (/usr/local/bin/git status --porcelain) |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __fish_git_dirty |  | ||||||
|   if [ (__fish_git_is_dirty) ] |  | ||||||
|     set_color red |  | ||||||
|   else |  | ||||||
|     set_color green |  | ||||||
|   end |  | ||||||
|   printf "%s" (__fish_git_branch) |  | ||||||
|   set_color normal |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __fish_git_is_unpushed |  | ||||||
|   echo (/usr/local/bin/git cherry -v "@{upstream}" 2>/dev/null) |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __fish_git_unpushed |  | ||||||
|   if [ (__fish_git_is_unpushed) ] |  | ||||||
|     set_color cyan |  | ||||||
|     printf "✖ " |  | ||||||
|     set_color normal |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| @ -1,3 +0,0 @@ | |||||||
| function h |  | ||||||
|   cd $HOME/$argv[1] |  | ||||||
| end |  | ||||||
| @ -1,3 +0,0 @@ | |||||||
| function iq |  | ||||||
|   curl -s -G "http://localhost:8086/db/$argv[1]/series?u=root&p=root" --data-urlencode $argv[2] | jq . |  | ||||||
| end |  | ||||||
| @ -1,6 +0,0 @@ | |||||||
| function pg_oldies |  | ||||||
|   watch -n1 "psql -c \"\ |  | ||||||
|     select substring(query from 0 for 120) q,\ |  | ||||||
|     now() - query_start from pg_stat_activity\ |  | ||||||
|     where state='active' order by query_start limit 20\"" |  | ||||||
| end |  | ||||||
| @ -1,11 +0,0 @@ | |||||||
| function rbenv |  | ||||||
|   set -l command $argv[1] |  | ||||||
|   [ (count $argv) -gt 1 ]; and set -l args $argv[2..-1] |  | ||||||
| 
 |  | ||||||
|   switch $command |  | ||||||
|     case shell |  | ||||||
|       rbenv_shell $args |  | ||||||
|     case '*' |  | ||||||
|       command rbenv $command $args |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| @ -1,25 +0,0 @@ | |||||||
| function rbenv_shell |  | ||||||
|   set -l vers $argv[1] |  | ||||||
| 
 |  | ||||||
|   switch "$vers" |  | ||||||
|     case '--complete' |  | ||||||
|       echo '--unset' |  | ||||||
|       echo 'system' |  | ||||||
|       exec rbenv-versions --bare |  | ||||||
|       return |  | ||||||
|     case '--unset' |  | ||||||
|       set -e RBENV_VERSION |  | ||||||
|       return 1 |  | ||||||
|     case '' |  | ||||||
|       if [ -z "$RBENV_VERSION" ] |  | ||||||
|         echo "rbenv: no shell-specific version configured" >&2 |  | ||||||
|         return 1 |  | ||||||
|       else |  | ||||||
|         echo "$RBENV_VERSION" |  | ||||||
|         return |  | ||||||
|       end |  | ||||||
|     case '*' |  | ||||||
|       rbenv prefix "$vers" > /dev/null |  | ||||||
|       set -g -x RBENV_VERSION "$vers" |  | ||||||
|   end |  | ||||||
| end |  | ||||||
| @ -1,66 +0,0 @@ | |||||||
| alias v "vim" |  | ||||||
| alias subl "/Applications/Sublime\ Text\ 3.app/Contents/SharedSupport/bin/subl" |  | ||||||
| 
 |  | ||||||
| alias reload! ". $HOME/.config/fish/config.fish" |  | ||||||
| alias b "bundle exec" |  | ||||||
| 
 |  | ||||||
| alias ll "ls -lAFh" |  | ||||||
| alias please "sudo" |  | ||||||
| alias down "rsync -chavzP --stats" |  | ||||||
| 
 |  | ||||||
| # GCC |  | ||||||
| alias gcc48 "gcc-4.8" |  | ||||||
| 
 |  | ||||||
| # Ruby & Rails |  | ||||||
| alias b "bundle exec" |  | ||||||
| 
 |  | ||||||
| # alias http "ruby -run -e httpd . -p5000" |  | ||||||
| 
 |  | ||||||
| alias rails "bundle exec rails" |  | ||||||
| alias sidekiq "bundle exec sidekiq" |  | ||||||
| alias rspec "bundle exec rspec" |  | ||||||
| alias cucumber "bundle exec cucumber" |  | ||||||
| alias cap "bundle exec cap" |  | ||||||
| alias foreman "bundle exec foreman" |  | ||||||
| 
 |  | ||||||
| alias bd "bundle install --path=vendor/gems --jobs=8 --verbose" |  | ||||||
| alias rc "rails c" |  | ||||||
| alias rs "rails s" |  | ||||||
| alias rs1 "rails s -p3001" |  | ||||||
| alias rs2 "rails s -p3002" |  | ||||||
| 
 |  | ||||||
| # Git |  | ||||||
| alias git "git-achievements" |  | ||||||
| alias gl "git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) %C(bold |  | ||||||
| green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all" |  | ||||||
| alias gc "git ci -S --allow-empty -m" |  | ||||||
| alias ga "git add -u; git add .; git st" |  | ||||||
| alias gf "ga; gc 'Fixup me'; git rh" |  | ||||||
| alias gs "git st" |  | ||||||
| alias gd "git diff" |  | ||||||
| alias gdc "git diff --cached" |  | ||||||
| alias gp "git push" |  | ||||||
| alias gu "git up" |  | ||||||
| 
 |  | ||||||
| # OSX |  | ||||||
| alias hide-desktop "defaults write com.apple.finder CreateDesktop -bool false; killall Finder" |  | ||||||
| alias show-desktop "defaults write com.apple.finder CreateDesktop -bool true; killall Finder" |  | ||||||
| alias prefs "/Applications/System\ Preferences.app/Contents/MacOS/System\ Preferences" |  | ||||||
| alias admin-prefs "sudo /Applications/System\ Preferences.app/Contents/MacOS/System\ Preferences" |  | ||||||
| 
 |  | ||||||
| # Services start-ups and shut-downs |  | ||||||
| alias mysql-start="mysql.server start" |  | ||||||
| alias mysql-stop="mysql.server stop" |  | ||||||
| alias mysql-restart="mysql.server restart" |  | ||||||
| 
 |  | ||||||
| alias postgres-start="pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start" |  | ||||||
| alias postgres-stop="pg_ctl -D /usr/local/var/postgres stop -s -m fast" |  | ||||||
| alias postgres-restart="postgres-stop; postgres-start" |  | ||||||
| 
 |  | ||||||
| alias redis-start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist" |  | ||||||
| alias redis-stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist" |  | ||||||
| alias redis-restart="redis-stop; redis-start" |  | ||||||
| 
 |  | ||||||
| alias elastic-start "launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist" |  | ||||||
| alias elastic-stop "launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist" |  | ||||||
| alias elastic-restart "elastic-stop; elastic-start" |  | ||||||
| @ -1,12 +0,0 @@ | |||||||
| set -g CLASSPATH "." |  | ||||||
| 
 |  | ||||||
| set -x CLASSPATH /usr/local/lib/antlr-3.5.2-complete-no-st3.jar:$CLASSPATH |  | ||||||
| alias antlr3 "java -jar /usr/local/lib/antlr-3.5.2-complete-no-st3.jar" |  | ||||||
| alias grun3 "java org.antlr.Tool" |  | ||||||
| 
 |  | ||||||
| set -x CLASSPATH /usr/local/lib/antlr-4.2.1-complete.jar:$CLASSPATH |  | ||||||
| alias antlr4 "java -jar /usr/local/lib/antlr-4.2.1-complete.jar" |  | ||||||
| alias grun4 "java org.antlr.v4.runtime.misc.TestRig" |  | ||||||
| 
 |  | ||||||
| set -x CLASSPATH /usr/local/lib/fdb-sql-parser-1.1.0.jar:$CLASSPATH |  | ||||||
| set -x CLASSPATH /Users/chez/Downloads/zql/classes:$CLASSPATH |  | ||||||
| @ -1,16 +0,0 @@ | |||||||
| set -x PATH /usr/local/bin $PATH |  | ||||||
| set -x PATH /usr/local/sbin $PATH |  | ||||||
| set -x PATH /usr/local/share/npm/bin $PATH |  | ||||||
| 
 |  | ||||||
| set -x PATH $HOME/.dotfiles/bin $PATH |  | ||||||
| 
 |  | ||||||
| set -x PATH $HOME/.rbenv/plugins/ruby-build/bin $PATH |  | ||||||
| set -x PATH $HOME/.rbenv/bin $PATH |  | ||||||
| set -x PATH $HOME/.rbenv/shims $PATH |  | ||||||
| 
 |  | ||||||
| set -x PATH $HOME/.misc/git-achievements $PATH |  | ||||||
| 
 |  | ||||||
| set -x PATH $HOME/go/bin $PATH |  | ||||||
| # set -x PATH $HOME/Code/go/bin $PATH |  | ||||||
| 
 |  | ||||||
| set -x PKG_CONFIG_PATH /usr/local/opt/python3/Frameworks/Python.framework/Versions/3.4/lib/pkgconfig |  | ||||||
| @ -1,24 +0,0 @@ | |||||||
| set -x RUBY_GC_HEAP_INIT_SLOTS 800000 |  | ||||||
| set -x RUBY_HEAP_MIN_SLOTS 800000 # Deprecated since 2.1.0 |  | ||||||
| set -x RUBY_HEAP_FREE_MIN 100000 |  | ||||||
| set -x RUBY_GC_HEAP_FREE_SLOTS 200000 |  | ||||||
| set -x RUBY_FREE_MIN 200000 # Deprecated since 2.1.0 |  | ||||||
| set -x RUBY_HEAP_SLOTS_INCREMENT 300000 |  | ||||||
| set -x RUBY_HEAP_SLOTS_GROWTH_FACTOR 1 |  | ||||||
| set -x RUBY_GC_MALLOC_LIMIT 79000000 |  | ||||||
| 
 |  | ||||||
| function mina |  | ||||||
|     if test -e Gemfile |  | ||||||
|         bundle exec mina $argv |  | ||||||
|     else |  | ||||||
|         /Users/chez/.rbenv/shims/mina $argv |  | ||||||
|     end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function rake |  | ||||||
|     if test -e Gemfile |  | ||||||
|         bundle exec rake $argv |  | ||||||
|     else |  | ||||||
|         /Users/chez/.rbenv/shims/rake $argv |  | ||||||
|     end |  | ||||||
| end |  | ||||||
| @ -1,286 +0,0 @@ | |||||||
| # VirtualFish |  | ||||||
| # A Virtualenv wrapper for the Fish Shell based on Doug Hellman's virtualenvwrapper |  | ||||||
| 
 |  | ||||||
| if not set -q VIRTUALFISH_HOME |  | ||||||
| 	set -g VIRTUALFISH_HOME $HOME/.virtualenvs |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| if set -q VIRTUALFISH_COMPAT_ALIASES |  | ||||||
|         function workon |  | ||||||
|                 if not set -q argv[1] |  | ||||||
|                     vf ls |  | ||||||
|                 else |  | ||||||
|                     vf activate $argv[1] |  | ||||||
|                 end |  | ||||||
|         end |  | ||||||
|         function deactivate |  | ||||||
|                 vf deactivate |  | ||||||
|         end |  | ||||||
|         function mktmpenv |  | ||||||
|                 vf tmp $argv |  | ||||||
|         end |  | ||||||
|         function mkvirtualenv |  | ||||||
|                 # Check if the first argument is an option to virtualenv |  | ||||||
|                 # if it is then the the last argument must be the DEST_DIR. |  | ||||||
|                 set -l idx 1 |  | ||||||
|                 switch $argv[1] |  | ||||||
|                         case '-*' |  | ||||||
|                                 set idx -1 |  | ||||||
|                 end |  | ||||||
| 
 |  | ||||||
|                 # Extract the DEST_DIR and remove it from $argv |  | ||||||
|                 set -l env_name $argv[$idx] |  | ||||||
|                 set -e argv[$idx] |  | ||||||
| 
 |  | ||||||
|                 vf new $argv $env_name |  | ||||||
|         end |  | ||||||
|         function rmvirtualenv |  | ||||||
|                 vf rm $argv |  | ||||||
|         end |  | ||||||
|         function add2virtualenv |  | ||||||
|         	__vf_addpath $argv |  | ||||||
|         end |  | ||||||
|         function cdvirtualenv |  | ||||||
|         	vf cd $argv |  | ||||||
|         end |  | ||||||
|         function cdsitepackages |  | ||||||
|         	vf cdpackages $argv |  | ||||||
|         end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function vf --description "VirtualFish: fish plugin to manage virtualenvs" |  | ||||||
| 	# copy all but the first argument to $scargs |  | ||||||
| 	set -l sc $argv[1] |  | ||||||
| 	set -l funcname "__vf_$sc" |  | ||||||
| 	set -l scargs |  | ||||||
| 
 |  | ||||||
| 	if test (count $argv) -gt 1 |  | ||||||
| 		set scargs $argv[2..-1] |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	if functions -q $funcname |  | ||||||
| 		eval $funcname $scargs |  | ||||||
| 	else |  | ||||||
| 		echo "The subcommand $sc is not defined" |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __vf_activate --description "Activate a virtualenv" |  | ||||||
| 	# check arguments |  | ||||||
| 	if [ (count $argv) -lt 1 ] |  | ||||||
| 		echo "You need to specify a virtualenv." |  | ||||||
| 		return 1 |  | ||||||
| 	end |  | ||||||
| 	if not [ -d $VIRTUALFISH_HOME/$argv[1] ] |  | ||||||
| 		echo "The virtualenv $argv[1] does not exist." |  | ||||||
| 		echo "You can create it with mkvirtualenv." |  | ||||||
| 		return 2 |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	#Check if a different env is being used |  | ||||||
| 	if set -q VIRTUAL_ENV |  | ||||||
| 		vf deactivate |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	emit virtualenv_will_activate |  | ||||||
| 	emit virtualenv_will_activate:$argv[1] |  | ||||||
| 
 |  | ||||||
| 	set -gx VIRTUAL_ENV $VIRTUALFISH_HOME/$argv[1] |  | ||||||
| 	set -g _VF_EXTRA_PATH $VIRTUAL_ENV/bin |  | ||||||
| 	set -gx PATH $_VF_EXTRA_PATH $PATH |  | ||||||
| 
 |  | ||||||
| 	# hide PYTHONHOME |  | ||||||
| 	if set -q PYTHONHOME |  | ||||||
| 		set -g _VF_OLD_PYTHONHOME $PYTHONHOME |  | ||||||
| 		set -e PYTHONHOME |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	emit virtualenv_did_activate |  | ||||||
| 	emit virtualenv_did_activate:(basename $VIRTUAL_ENV) |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __vf_deactivate --description "Deactivate the currently-activated virtualenv" |  | ||||||
| 
 |  | ||||||
| 	emit virtualenv_will_deactivate |  | ||||||
| 	emit virtualenv_will_deactivate:(basename $VIRTUAL_ENV) |  | ||||||
| 
 |  | ||||||
| 	# find elements to remove from PATH |  | ||||||
| 	set to_remove |  | ||||||
| 	for i in (seq (count $PATH)) |  | ||||||
| 		if contains $PATH[$i] $_VF_EXTRA_PATH |  | ||||||
| 			set to_remove $to_remove $i |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	# remove them |  | ||||||
| 	for i in $to_remove |  | ||||||
| 		set -e PATH[$i] |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	# restore PYTHONHOME |  | ||||||
| 	if set -q _VF_OLD_PYTHONHOME |  | ||||||
| 		set -gx PYTHONHOME $_VF_OLD_PYTHONHOME |  | ||||||
| 		set -e _VF_OLD_PYTHONHOME |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	emit virtualenv_did_deactivate |  | ||||||
| 	emit virtualenv_did_deactivate:(basename $VIRTUAL_ENV) |  | ||||||
| 
 |  | ||||||
| 	set -e VIRTUAL_ENV |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __vf_new --description "Create a new virtualenv" |  | ||||||
|     emit virtualenv_will_create |  | ||||||
| 	set envname $argv[-1] |  | ||||||
| 	set -e argv[-1] |  | ||||||
| 	virtualenv $argv $VIRTUALFISH_HOME/$envname |  | ||||||
| 	set vestatus $status |  | ||||||
| 	if begin; [ $vestatus -eq 0 ]; and [ -d $VIRTUALFISH_HOME/$envname ]; end |  | ||||||
| 		vf activate $envname |  | ||||||
|         emit virtualenv_did_create |  | ||||||
|         emit virtualenv_did_create:(basename $VIRTUAL_ENV) |  | ||||||
| 	else |  | ||||||
| 		echo "Error: The virtualenv wasn't created properly." |  | ||||||
| 		echo "virtualenv returned status $vestatus." |  | ||||||
| 		return 1 |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __vf_rm --description "Delete a virtualenv" |  | ||||||
| 	if not [ (count $argv) -eq 1 ] |  | ||||||
| 		echo "You need to specify exactly one virtualenv." |  | ||||||
| 		return 1 |  | ||||||
| 	end |  | ||||||
| 	if begin; set -q VIRTUAL_ENV; and [ $argv[1] = (basename $VIRTUAL_ENV) ]; end |  | ||||||
| 		echo "You can't delete a virtualenv you're currently using." |  | ||||||
| 		return 1 |  | ||||||
| 	end |  | ||||||
| 	echo "Removing $VIRTUALFISH_HOME/$argv[1]" |  | ||||||
| 	rm -rf $VIRTUALFISH_HOME/$argv[1] |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __vf_ls --description "List all of the available virtualenvs" |  | ||||||
| 	pushd $VIRTUALFISH_HOME |  | ||||||
| 	for i in */bin/python |  | ||||||
| 		echo $i |  | ||||||
| 	end | sed "s|/bin/python||" |  | ||||||
| 	popd |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __vf_cd --description "Change directory to currently-activated virtualenv" |  | ||||||
|     if set -q VIRTUAL_ENV |  | ||||||
|         cd $VIRTUAL_ENV |  | ||||||
|     else |  | ||||||
|         echo "Cannot locate an active virtualenv." |  | ||||||
|     end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __vf_cdpackages --description "Change to the site-packages directory of the active virtualenv" |  | ||||||
| 	vf cd |  | ||||||
| 	cd lib/python*/site-packages |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| function __vf_connect --description "Connect this virtualenv to the current directory" |  | ||||||
| 	if set -q VIRTUAL_ENV |  | ||||||
| 		basename $VIRTUAL_ENV > $VIRTUALFISH_ACTIVATION_FILE |  | ||||||
| 	else |  | ||||||
| 		echo "No virtualenv is active." |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __vf_tmp --description "Create a temporary virtualenv that will be removed when deactivated" |  | ||||||
| 	set -l env_name (printf "%s%.4x" "tempenv-" (random) (random) (random)) |  | ||||||
|     set -g VF_TEMPORARY_ENV |  | ||||||
| 
 |  | ||||||
| 	# Use will_deactivate here so that $VIRTUAL_ENV is available. |  | ||||||
| 	function __vf_tmp_remove --on-event virtualenv_will_deactivate:$env_name |  | ||||||
| 		echo "Removing $VIRTUAL_ENV" |  | ||||||
| 		rm -rf $VIRTUAL_ENV |  | ||||||
|         set -e VF_TEMPORARY_ENV |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
|     # Ensure that the virtualenv gets deleted even if we close the shell w/o |  | ||||||
|     # explicitly deactivating. |  | ||||||
|     function __vfsupport_remove_temp_env_on_exit --on-process %self |  | ||||||
|         if set -q VF_TEMPORARY_ENV |  | ||||||
|             vf deactivate # the deactivate handler will take care of removing it |  | ||||||
|         end |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
| 	vf new $argv $env_name |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| function __vf_addpath --description "Adds a path to sys.path in this virtualenv" |  | ||||||
| 	if set -q VIRTUAL_ENV |  | ||||||
| 		set -l site_packages (eval "$VIRTUAL_ENV/bin/python -c 'import distutils; print(distutils.sysconfig.get_python_lib())'") |  | ||||||
| 		set -l path_file $site_packages/_virtualenv_path_extensions.pth |  | ||||||
| 
 |  | ||||||
| 		set -l remove 0 |  | ||||||
| 		if test $argv[1] = "-d" |  | ||||||
| 			set remove 1 |  | ||||||
| 			set -e argv[1] |  | ||||||
| 		end |  | ||||||
| 
 |  | ||||||
| 		if not test -f $path_file |  | ||||||
| 	        echo "import sys; sys.__plen = len(sys.path)" > $path_file |  | ||||||
| 	        echo "import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)" >> $path_file |  | ||||||
| 		end |  | ||||||
| 
 |  | ||||||
| 		for pydir in $argv |  | ||||||
| 			set -l absolute_path (eval "$VIRTUAL_ENV/bin/python -c 'import os,sys; sys.stdout.write(os.path.abspath(\"$pydir\")+\"\n\")'") |  | ||||||
| 			if not test $pydir = $absolute_path |  | ||||||
| 				echo "Warning: Converting \"$pydir\" to \"$absolute_path\"" 1>&2 |  | ||||||
| 			end |  | ||||||
| 
 |  | ||||||
| 			if test $remove -eq 1 |  | ||||||
| 				sed -i.tmp "\:^$absolute_path\$: d" "$path_file" |  | ||||||
| 			else |  | ||||||
| 	            sed -i.tmp '1 a\ |  | ||||||
| '"$absolute_path"' |  | ||||||
| ' "$path_file" |  | ||||||
| 			end |  | ||||||
| 	        rm -f "$path_file.tmp" |  | ||||||
| 		end |  | ||||||
| 		return 0 |  | ||||||
| 	else |  | ||||||
| 		echo "No virtualenv is active." |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| ################ |  | ||||||
| # Autocomplete |  | ||||||
| # Based on https://github.com/zmalltalker/fish-nuggets/blob/master/completions/git.fish |  | ||||||
| begin |  | ||||||
| 	function __vfcompletion_needs_command |  | ||||||
| 		set cmd (commandline -opc) |  | ||||||
| 			if test (count $cmd) -eq 1 -a $cmd[1] = 'vf' |  | ||||||
| 			return 0 |  | ||||||
| 		end |  | ||||||
| 		return 1 |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	function __vfcompletion_using_command |  | ||||||
| 		set cmd (commandline -opc) |  | ||||||
| 		if test (count $cmd) -gt 1 |  | ||||||
| 			if test $argv[1] = $cmd[2] |  | ||||||
| 				return 0 |  | ||||||
| 			end |  | ||||||
| 		end |  | ||||||
| 		return 1 |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	# add completion for subcommands |  | ||||||
| 	for sc in (functions -a | sed -n '/__vf_/{s///g;p;}') |  | ||||||
| 		set -l helptext (functions "__vf_$sc" | head -n 1 | sed -E "s|.*'(.*)'.*|\1|") |  | ||||||
| 		complete -x -c vf -n '__vfcompletion_needs_command' -a $sc -d $helptext |  | ||||||
| 	end |  | ||||||
| 
 |  | ||||||
| 	complete -x -c vf -n '__vfcompletion_using_command activate' -a "(vf ls)" |  | ||||||
| 	complete -x -c vf -n '__vfcompletion_using_command rm' -a "(vf ls)" |  | ||||||
|     if set -q VIRTUALFISH_COMPAT_ALIASES |  | ||||||
|         complete -x -c workon -a "(vf ls)" |  | ||||||
|         complete -x -c rmvirtualenv -a "(vf ls)" |  | ||||||
|     end |  | ||||||
| end |  | ||||||
| 
 |  | ||||||
| @ -1,4 +0,0 @@ | |||||||
| #!/bin/bash |  | ||||||
| 
 |  | ||||||
| mysql.server start |  | ||||||
| ssh-add ~/.ssh/id_rsa |  | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user