mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-11-04 09:02:08 +00:00 
			
		
		
		
	Update shell alias for Fish Shell
@@ -16,27 +16,7 @@ eval "$(thefuck --alias)"
 | 
			
		||||
 | 
			
		||||
Add this function to `config.fish`:
 | 
			
		||||
```fish
 | 
			
		||||
function fuck -d 'Correct your previous console command'
 | 
			
		||||
    set -l exit_code $status
 | 
			
		||||
    set -l eval_script (mktemp 2>/dev/null ; or mktemp -t 'thefuck')
 | 
			
		||||
    set -l fucked_up_commandd $history[1]
 | 
			
		||||
    thefuck $fucked_up_commandd > $eval_script
 | 
			
		||||
    . $eval_script
 | 
			
		||||
    rm $eval_script
 | 
			
		||||
    if test $exit_code -ne 0
 | 
			
		||||
        history --delete $fucked_up_commandd
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Alternatively, you can redirect the output of `thefuck-alias`:
 | 
			
		||||
```bash
 | 
			
		||||
 ~> thefuck --alias >> ~/.config/fish/config.fish
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Or, yet, you can create a function:
 | 
			
		||||
```bash
 | 
			
		||||
 ~> thefuck --alias > ~/.config/fish/functions/fuck.fish
 | 
			
		||||
eval (thefuck --alias | tr '\n' ';')
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# Powershell
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user