mirror of
				https://github.com/wting/autojump
				synced 2025-06-13 12:54:07 +00:00 
			
		
		
		
	Merge commit 'simon/master'
This commit is contained in:
		
						commit
						dc4c63c9ea
					
				
							
								
								
									
										11
									
								
								README.rst
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								README.rst
									
									
									
									
									
								
							| @ -62,20 +62,25 @@ run:: | |||||||
| 
 | 
 | ||||||
|  ./install.sh  |  ./install.sh  | ||||||
| 
 | 
 | ||||||
|  | or:: | ||||||
|  |   | ||||||
|  |  ./install.zsh | ||||||
|  | 
 | ||||||
|  | depending on your shell. | ||||||
| Enter your root password if it asks.  | Enter your root password if it asks.  | ||||||
| 
 | 
 | ||||||
| Add the line:: | Add the line:: | ||||||
| 
 | 
 | ||||||
|  source /etc/profile |  source /etc/profile | ||||||
| 
 | 
 | ||||||
| to ``~/.bashrc`` if it isn't already there.  | to ``~/.bashrc`` or ``~/.zshrc`` if it isn't already there.  | ||||||
| 
 | 
 | ||||||
| Troubleshoot | Troubleshoot | ||||||
| ------------ | ------------ | ||||||
| 
 | 
 | ||||||
| If the script fails, you may need to do:: | If the script fails, you may need to do:: | ||||||
| 
 | 
 | ||||||
|  chmod +x install.sh |  chmod +x install.(z)sh | ||||||
| 
 | 
 | ||||||
| before the first step.  | before the first step.  | ||||||
| 
 | 
 | ||||||
| @ -86,7 +91,7 @@ Manual installation of autojump is very simple: copy | |||||||
| - autojump.sh to /etc/profile.d, | - autojump.sh to /etc/profile.d, | ||||||
| - autojump.1 to /usr/share/man/man1. | - autojump.1 to /usr/share/man/man1. | ||||||
| 
 | 
 | ||||||
| Make sure to source ``/etc/profile`` in your ``.bashrc``:: | Make sure to source ``/etc/profile`` in your ``.bashrc`` or ``.zshrc`` :: | ||||||
| 
 | 
 | ||||||
|  source /etc/profile |  source /etc/profile | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										11
									
								
								_j
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								_j
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | |||||||
|  | #compdef j | ||||||
|  | 
 | ||||||
|  | cur=${words[2, -1]} | ||||||
|  | 
 | ||||||
|  | ret=$(autojump --completion "${cur[*]}") | ||||||
|  | 
 | ||||||
|  | if [ "$ret" != "" ]; then  # if at least one answer | ||||||
|  |     for i in $(echo "$ret"); do | ||||||
|  |         compadd -U $i # add all of them as possible completion | ||||||
|  |     done | ||||||
|  | fi | ||||||
							
								
								
									
										1
									
								
								autojump
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								autojump
									
									
									
									
									
								
							| @ -75,6 +75,7 @@ except IOError: | |||||||
|     path_dict={} |     path_dict={} | ||||||
| 
 | 
 | ||||||
| if ('-a','') in optlist: | if ('-a','') in optlist: | ||||||
|  |     if(args[-1] != os.path.expanduser("~")): # home dir can be reached quickly by "cd" and may interfere with other directory | ||||||
|         dicadd(path_dict,args[-1]) |         dicadd(path_dict,args[-1]) | ||||||
|         save(path_dict,dic_file) |         save(path_dict,dic_file) | ||||||
| elif ('--stat','') in optlist: | elif ('--stat','') in optlist: | ||||||
|  | |||||||
| @ -1,5 +1,6 @@ | |||||||
| #Source autojump.bashrc only if we're on bash, as it is | # Source autojump on BASH or ZSH depending on the shell | ||||||
| #not compatible with other shells |  | ||||||
| if [ "$BASH_VERSION" ] && [ -n "$PS1" ] && echo $SHELLOPTS | grep -v posix >>/dev/null; then | if [ "$BASH_VERSION" ] && [ -n "$PS1" ] && echo $SHELLOPTS | grep -v posix >>/dev/null; then | ||||||
| 	. /etc/profile.d/autojump.bash | 	. /etc/profile.d/autojump.bash | ||||||
|  | elif [ "$ZSH_VERSION" ] && [ -n "$PS1" ]; then | ||||||
|  |     . /etc/profile.d/autojump.zsh | ||||||
| fi | fi | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								autojump.zsh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								autojump.zsh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,7 @@ | |||||||
|  | function preexec() { | ||||||
|  |     (autojump -a "$(pwd -P)"&)>/dev/null | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | alias jumpstat="autojump --stat" | ||||||
|  | 
 | ||||||
|  | function j { new_path="$(autojump $@)";if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; cd "$new_path";fi } | ||||||
							
								
								
									
										37
									
								
								install.zsh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										37
									
								
								install.zsh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,37 @@ | |||||||
|  | #! /bin/zsh | ||||||
|  | # applet icon | ||||||
|  | sudo mkdir -p /usr/share/autojump/ | ||||||
|  | sudo cp icon.png /usr/share/autojump/ | ||||||
|  | 
 | ||||||
|  | # scripts | ||||||
|  | sudo cp jumpapplet /usr/bin/ | ||||||
|  | sudo cp autojump /usr/bin/ | ||||||
|  | 
 | ||||||
|  | # man pages | ||||||
|  | sudo cp autojump.1 /usr/share/man/man1/ | ||||||
|  | 
 | ||||||
|  | # autocompletion file in the first directory of the FPATH variable | ||||||
|  | cp _j $(echo $FPATH | cut -d":" -f 1) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | if [ -d "/etc/profile.d" ]; then | ||||||
|  |     sudo cp autojump.zsh /etc/profile.d/ | ||||||
|  |     sudo cp autojump.sh /etc/profile.d/ | ||||||
|  |     echo "Remember to add the line"  | ||||||
|  |     echo "    source /etc/profile" | ||||||
|  |     echo "to your ~/.zshrc if it's not there already" | ||||||
|  | else | ||||||
|  |     echo "Your distribution does not have a /etc/profile.d directory, the default that we install one of the scripts to. Would you like us to copy it into your ~/.zshrc file to make it work? (If you have done this once before, delete the old version before doing it again.) [y/n]" | ||||||
|  |     read ans | ||||||
|  |     if [ ${#ans} -gt 0 ]; then | ||||||
|  | 	if [ $ans = "y" -o $ans = "Y" -o $ans = "yes" -o $ans = "Yes" ]; then | ||||||
|  | 	    echo "" >> ~/.zshrc | ||||||
|  | 	    echo "#autojump" >> ~/.zshrc | ||||||
|  | 	    cat autojump.zsh >> ~/.zshrc | ||||||
|  | 	else | ||||||
|  | 	    echo "Then you need to put autojump.zsh, or the code from it, somewhere where it will get read. Good luck!" | ||||||
|  | 	fi | ||||||
|  |     else | ||||||
|  |     	    echo "Then you need to put autojump.zsh, or the code from it, somewhere where it will get read. Good luck!" | ||||||
|  |     fi | ||||||
|  | fi | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user