added tests to most of the sourcing to make sure files/commands exist
before we use them.
This commit is contained in:
		
							parent
							
								
									e0247b6ff1
								
							
						
					
					
						commit
						6b59129a6a
					
				
					 1 changed files with 9 additions and 8 deletions
				
			
		
							
								
								
									
										17
									
								
								zsh/.zshrc
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								zsh/.zshrc
									
										
									
									
									
								
							| 
						 | 
					@ -13,9 +13,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#set important shell variables
 | 
					#set important shell variables
 | 
				
			||||||
	export PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"
 | 
						#fancy way of testing if a command exists
 | 
				
			||||||
	export PATH="$PATH:$HOME/.local/bin"
 | 
						(($+command[ruby])) && export PATH="$PATH:$(ruby -e 'puts Gem.user_dir' 2> /dev/null)/bin"
 | 
				
			||||||
	export PATH="$PATH:$HOME/scripts"
 | 
						testPath="$HOME/.local/bin"
 | 
				
			||||||
 | 
						[ -f $testPath ] && export PATH="$PATH:$testPath"
 | 
				
			||||||
 | 
						testPath="$HOME/scripts"
 | 
				
			||||||
 | 
						[ -f $testPath ] && export PATH="$PATH:$testPath"
 | 
				
			||||||
	#set default editor and pager.
 | 
						#set default editor and pager.
 | 
				
			||||||
	export EDITOR=nvim
 | 
						export EDITOR=nvim
 | 
				
			||||||
	export VISUAL=nvim
 | 
						export VISUAL=nvim
 | 
				
			||||||
| 
						 | 
					@ -194,10 +197,8 @@ PROMPT='%F{cyan}[%n@%m]%f%F{red}├────┤%f${vcs_info_msg_0_}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#fzf stuff
 | 
					#fzf stuff
 | 
				
			||||||
	#zsh key bindings (different distros put these in different places.)
 | 
						#zsh key bindings (different distros put these in different places.)
 | 
				
			||||||
	source $(find /usr/share -path '*fzf/*key-bindings.zsh' -print -quit 2> /dev/null)
 | 
						testPath=$(find /usr/share -path '*fzf/*key-bindings.zsh' -print -quit 2> /dev/null)
 | 
				
			||||||
 | 
						[ -f $testPath ] && source $testPath
 | 
				
			||||||
	#zsh completions, if it exists.
 | 
						#zsh completions, if it exists.
 | 
				
			||||||
	testPath=$(find /usr/share -path '*fzf/*completion.zsh' -print -quit 2> /dev/null)
 | 
						testPath=$(find /usr/share -path '*fzf/*completion.zsh' -print -quit 2> /dev/null)
 | 
				
			||||||
	if test $(echo $testPath | wc -c) -ne 0
 | 
						[ -f $testPath ] && source $testPath
 | 
				
			||||||
	then
 | 
					 | 
				
			||||||
		source $testPath
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue