Skip to content

Commit e605051

Browse files
authored
Register aliases for cd
1 parent f81012e commit e605051

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

xontrib/rc_awesome.xsh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,8 @@ if $XONSH_INTERACTIVE:
105105

106106
# Easy way to go back cd-ing.
107107
# Example: `,,` the same as `cd ../../`
108-
@aliases.register(",")
109-
@aliases.register(",,")
110-
@aliases.register(",,,")
111-
@aliases.register(",,,,")
112-
def _alias_supercomma():
113-
"""Easy way to go back cd-ing."""
114-
cd @("../" * len($__ALIAS_NAME))
108+
for i in range(1, 6):
109+
aliases[','*i] = lambda: $[cd @("../" * len($__ALIAS_NAME))]
115110

116111

117112
# Example of utilizing `xonsh.tools.chdir` to do git commit, git config, git pull and push at once.
@@ -317,3 +312,4 @@ if ON_LINUX or ON_DARWIN:
317312

318313

319314

315+

0 commit comments

Comments
 (0)