mirror of
				https://github.com/ohmyzsh/ohmyzsh.git
				synced 2024-05-11 05:55:17 +00:00 
			
		
		
		
	Plugin won't load automatically if added to variable $plugins, if name schema different than $name/$name.plugin.zsh is used (see is_plugin() in oh-my-zsh.sh).
		
			
				
	
	
		
			23 lines
		
	
	
		
			601 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			601 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
| # ------------------------------------------------------------------------------
 | |
| # Description
 | |
| # -----------
 | |
| #
 | |
| # sudo will be inserted before the command
 | |
| #
 | |
| # ------------------------------------------------------------------------------
 | |
| # Authors
 | |
| # -------
 | |
| #
 | |
| # * Dongweiming <ciici123@gmail.com>
 | |
| #
 | |
| # ------------------------------------------------------------------------------
 | |
| 
 | |
| sudo-command-line() {
 | |
| [[ -z $BUFFER ]] && zle up-history
 | |
| [[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
 | |
| zle end-of-line 
 | |
| }
 | |
| zle -N sudo-command-line
 | |
| # Defined shortcut keys: [Esc] [Esc]
 | |
| bindkey "\e\e" sudo-command-line
 |