changes to fzf, batcat
This commit is contained in:
		
							parent
							
								
									ad58cbed86
								
							
						
					
					
						commit
						dea76cfaab
					
				
					 3 changed files with 27 additions and 17 deletions
				
			
		
							
								
								
									
										9
									
								
								batcat.zsh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								batcat.zsh
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
alias bathelp='bat --plain --language=help'
 | 
			
		||||
unalias help
 | 
			
		||||
help() {
 | 
			
		||||
    "$@" --help 2>&1 | bathelp
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
batdiff() {
 | 
			
		||||
    git diff --name-only --relative --diff-filter=d | xargs bat --diff
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								fzf.sh
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								fzf.sh
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,17 +0,0 @@
 | 
			
		|||
export FZF_COMPLETION_OPTS='--border --info=inline'
 | 
			
		||||
 | 
			
		||||
# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function
 | 
			
		||||
# - The first argument to the function is the name of the command.
 | 
			
		||||
# - You should make sure to pass the rest of the arguments to fzf.
 | 
			
		||||
_fzf_comprun() {
 | 
			
		||||
  local command=$1
 | 
			
		||||
  shift
 | 
			
		||||
 | 
			
		||||
  case "$command" in
 | 
			
		||||
    vim)          fzf "$@" --preview 'batcat --color=always {}' ;;
 | 
			
		||||
    cd)           fzf "$@" --preview 'tree -C {} | head -200' ;;
 | 
			
		||||
    export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;;
 | 
			
		||||
    ssh)          fzf "$@" --preview 'dig {}' ;;
 | 
			
		||||
    *)            fzf "$@" ;;
 | 
			
		||||
  esac
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								fzf.zsh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								fzf.zsh
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
export FZF_COMPLETION_OPTS='--border --info=inline'
 | 
			
		||||
source /usr/share/doc/fzf/examples/completion.zsh
 | 
			
		||||
source /usr/share/doc/fzf/examples/key-bindings.zsh
 | 
			
		||||
# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function
 | 
			
		||||
# - The first argument to the function is the name of the command.
 | 
			
		||||
# - You should make sure to pass the rest of the arguments to fzf.
 | 
			
		||||
_fzf_comprun() {
 | 
			
		||||
  local command=$1
 | 
			
		||||
  shift
 | 
			
		||||
 | 
			
		||||
  case "$command" in
 | 
			
		||||
    vim|nvim|nano) fzf "$@" --preview 'batcat --color=always {}' ;;
 | 
			
		||||
    cd)            fzf "$@" --preview 'tree -C {} | head -200' ;;
 | 
			
		||||
    export|unset)  fzf "$@" --preview "eval 'echo \$'{}" ;;
 | 
			
		||||
    ssh)           fzf "$@" --preview 'dig {}' ;;
 | 
			
		||||
    *)             fzf "$@" ;;
 | 
			
		||||
  esac
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue