mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-19 04:21:14 +00:00
commit
a1437db40a
@ -118,6 +118,11 @@ Or in your `.zshrc`:
|
||||
alias fuck='eval $(thefuck $(fc -ln -1 | tail -n 1)); fc -R'
|
||||
```
|
||||
|
||||
If you are using `tcsh`:
|
||||
```tcsh
|
||||
alias fuck 'set fucked_cmd=`history -h 2 | head -n 1` && eval `thefuck ${fucked_cmd}`'
|
||||
```
|
||||
|
||||
Alternatively, you can redirect the output of `thefuck-alias`:
|
||||
|
||||
```bash
|
||||
|
@ -92,9 +92,34 @@ class Zsh(Generic):
|
||||
return u': {}:0;{}\n'.format(int(time()), command_script)
|
||||
|
||||
|
||||
class Tcsh(Generic):
|
||||
def app_alias(self):
|
||||
return "\nalias fuck 'set fucked_cmd=`history -h 2 | head -n 1` && eval `thefuck ${fucked_cmd}`'\n"
|
||||
|
||||
def _parse_alias(self, alias):
|
||||
name, value = alias.split("\t", 1)
|
||||
return name, value
|
||||
|
||||
def _get_aliases(self):
|
||||
proc = Popen('tcsh -ic alias', stdout=PIPE, stderr=DEVNULL, shell=True)
|
||||
return dict(
|
||||
self._parse_alias(alias)
|
||||
for alias in proc.stdout.read().decode('utf-8').split('\n')
|
||||
if alias and '\t' in alias)
|
||||
|
||||
def _get_history_file_name(self):
|
||||
return os.environ.get("HISTFILE",
|
||||
os.path.expanduser('~/.history'))
|
||||
|
||||
def _get_history_line(self, command_script):
|
||||
return u'#+{}\n{}\n'.format(int(time()), command_script)
|
||||
|
||||
|
||||
shells = defaultdict(lambda: Generic(), {
|
||||
'bash': Bash(),
|
||||
'zsh': Zsh()})
|
||||
'zsh': Zsh(),
|
||||
'-csh': Tcsh(),
|
||||
'tcsh': Tcsh()})
|
||||
|
||||
|
||||
def _get_shell():
|
||||
|
Loading…
x
Reference in New Issue
Block a user