Issue 49: Don't use readlink, options differ between systems
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
This commit is contained in:
		
							parent
							
								
									bc788f3f19
								
							
						
					
					
						commit
						19f16752bb
					
				|  | @ -30,7 +30,7 @@ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
| # Core highligting update system | # Core highlighting update system | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
| 
 | 
 | ||||||
| # Array used by highlighters to declare overridable styles. | # Array used by highlighters to declare overridable styles. | ||||||
|  | @ -239,11 +239,11 @@ _zsh_main-highlight() { | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
| # Setup | # Setup functions | ||||||
| # ------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------- | ||||||
| 
 | 
 | ||||||
| # Setup highlighting. | # Intercept specified ZLE events to have highlighting triggered. | ||||||
| _zsh_highlight_install() { | _zsh_highlight_bind-events() { | ||||||
| 
 | 
 | ||||||
|   # Resolve event names what have to be bound to. |   # Resolve event names what have to be bound to. | ||||||
|   zmodload zsh/zleparameter 2>/dev/null || { |   zmodload zsh/zleparameter 2>/dev/null || { | ||||||
|  | @ -277,15 +277,23 @@ _zsh_highlight_install() { | ||||||
|       esac |       esac | ||||||
|     fi |     fi | ||||||
|   done |   done | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | # Load highlighters from specified directory if it exists. | ||||||
|  | _zsh_highlight_load-highlighters() { | ||||||
|  |   [[ -d $1 ]] && for highlighter_def ($1/*.zsh) . $highlighter_def | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # ------------------------------------------------------------------------------------------------- | ||||||
|  | # Setup | ||||||
|  | # ------------------------------------------------------------------------------------------------- | ||||||
|  | 
 | ||||||
|  | # Bind highlighting to all known events. | ||||||
|  | _zsh_highlight_bind-events "${(@f)"$(zle -la)"}" | ||||||
| 
 | 
 | ||||||
| # Register the main highlighter. | # Register the main highlighter. | ||||||
| _zsh_highlight_add-highlighter _zsh_main-highlight _zsh_highlight_buffer-modified-p | _zsh_highlight_add-highlighter _zsh_main-highlight _zsh_highlight_buffer-modified-p | ||||||
| 
 | 
 | ||||||
| # Load additional highlighters if available. | # Load additional highlighters if available. | ||||||
|   local highlighters_dir=${$(command readlink -f ${(%):-%N}):h}/highlighters | _zsh_highlight_load-highlighters "${${(%):-%N}:h}/highlighters" | ||||||
|   if [[ -d $highlighters_dir ]]; then |  | ||||||
|     for highlighter_def ($highlighters_dir/*.zsh) . $highlighter_def |  | ||||||
|   fi |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| _zsh_highlight_install "${(@f)"$(zle -la)"}" |  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue