22 lines
		
	
	
		
			459 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			459 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| 
 | |
| # Check recovery directory from vim
 | |
| if [ $# -lt 1 ]; then
 | |
|     echo -e >&2 "\033[31;1merror:\033[0m vim-recover expects an argument"
 | |
|     exit 1
 | |
| fi
 | |
| 
 | |
| if [ -f $1 ]; then
 | |
|     echo -e >&2 "\033[31;1merror:\033[0m cannot recover an existing file"
 | |
|     exit 1
 | |
| fi
 | |
| 
 | |
| backup_path=~/.nvim/backups/`echo $PWD/$1 | tr '/' '%'`
 | |
| 
 | |
| if [ ! -f "$backup_path" ]; then
 | |
|     echo -e >&2 "\033[31;1merror:\033[0m backup not found"
 | |
|     exit 2
 | |
| fi
 | |
| 
 | |
| cp $backup_path $1
 |