-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do you create an alias? #421
Comments
You can create your aliases in the AliasesYou can define simple aliases with command alias name=command. |
To add some to answer above, current cmder (I don't know since when though) , once you have 'config/aliases' file created, on new console window launch automatically converts 'config/aliases' file to 'user-aliases.cmd', that works now in cmder. |
If I use the |
@adam-arold, aliases need to be stored in config file to be persisted. |
I have my aliases in the
What could be the problem? |
@adam-arold Do you have a %cmder_root%\config\user-aliases.and file? Never versions of cmder 1.3.2+, I think, store aliases in this file. |
@adam-arold The alias command run in 'cmder' shell based on cmd.exe should write the alias to the file I mentioned in my last post preserving it for future sessions. If using a 'bash' shell aliases created using the alias command are not saved unless you manually add them to '%cmder_root%/config/user-aliases.sh' Since your aliases contain / and you say aliases are not preserved across sessions I assume you are using a bash shell. |
I have the |
@adam-arold. File content? Should look something like:
|
is this possible?
|
For some reason the |
@adam-arold All is working as expected. The alias command in bash sets an alias for the running session only. To make it permanent and cmder portable you add it manually to the file I told you about. If you are not worked about it being portable the bash way would be to manually add it to the ~/.bashrc file. |
I have the |
@xelra what version of cmder? If not latest, download the latest and follow the upgrade procedure in the readme.md. |
@daxgames Thanks that fixed it. For some reason I was under the impression that Cmder was updating automatically. |
@justinlazaro-ubidy did you find solution ? |
Most examples/snippets I read included quotes when setting aliases. Don't alias gcm='git checkout master' Do alias gcm=git checkout master |
How about passing the arguments on to the aliased command? alias gd=git diff Use it like: gd --staged |
@maxpower9000 the "don't" is syntax for linux/Unix The "do" is syntax for 'cmder' command alias.bat |
@jakoandersen is that a question? If so, Cmder aliases in cmd based shells are based on doskey. See the doskey macro docs details on how to do advanced aliases. |
I'm using Cmder Version 180528 In
I duplicated this file and rename the duplicated file to That is, I now have a I add But in Cmder, I still cannot use the command |
The *.example it's supposed to be copied to the config folder and named what you named it on first launch if it doesn't already exist. If that didn't happen there's probably a bug in the init.bat. if you copy it there manually you should start having some default aliases |
@daxgames Thanks for the tips. Instead of Now I have |
Does that look wrong? https://github.com/cmderdev/cmder/blob/master/vendor/init.bat#L253 |
I have %cmder_root%\config\user-aliases.cmd. It came pre-installed with Laragaon but none of the aliases in it work. vendor\init.bat does seem to be trying to load it. When I do alias vi=vim on the command line, vi continues to not work. |
The solution that seemed to have worked (cmder ^v1.3.6) Open up the following in your text editor: Extend the file by appending aliases you need: ;= @echo off
;= rem Call DOSKEY and use this file as the macrofile
;= %SystemRoot%\system32\doskey /listsize=1000 /macrofile=%0%
;= rem In batch mode, jump to the end of the file
;= goto:eof
;= Add aliases below here
e.=explorer .
gl=git log --oneline --all --graph --decorate $*
ls=ls --show-control-chars -F --color $*
pwd=cd
clear=cls
history=cat "%CMDER_ROOT%\config\.history"
unalias=alias /d $1
vi=vim $*
cmderr=cd /d "%CMDER_ROOT%"
ll=ls -la Hope this helps you guys! |
#421 (comment) Totally possible just use $* |
Not sure if I am being thick (most likely cause its late) but im trying to add 🆘 Help 🆘 --Edit |
This didn't work out for me. |
I think there is a misunderstanding with what to put it in the aliases file. |
Cmder cmd session aliases are based on doskey. Look there for syntax. Also no need to restart cmder, just execute |
In case anyone still strugling with creating aliases for |
Hi @daxgames and everyone! Having issues - I'm using Bash / Ubuntu distribution {WSL::bash}. Running cmder out of my downloads folder at the moment It seems to be referencing a different user-aliases file tahtn what i'm changing. Thoughts? I'm modding: Thanks in advance. |
@bholmquist11 WSL Bash is technically an external *nix env according to cmder. You have two choices:
|
Thanks @daxgames! |
hey guys I just installed cmder on windows 7 and i am trying to make this command work, could you help me out!?
it says that << can not be used here. I am in a cmd.exe tab |
Found it in the "Creating a macro" section in doskey
@jakoandersen @Zontir this worked from me alias g=git $*
# or
alias gd=git diff $* |
After quite a bit of searching this is the one that did it for me in cmder bash. Thank you! Duplicating the user-aliases file as Note for others - you still need to restart the active console to have your changes apply. |
Didn't see anyone commenting about this option so here it is... If you're using bash, from git for windows for exemple, you can add your alias to the alias.sh file in "cmder\vendor\git-for-windows\etc\profile.d" with this sintax: |
Is there any way to pass default arguments? I have the alias P.S. I could make a separate alias but just wanted to know. |
@abhijit-hota you sould set an environment variable in |
These are Doskey aliases don't have default values for arguments. A .cmd script could be written to check for a missing argument and provide a default value. A doskey alias can't do that on its own, though. |
@chrisant996 Thanks for clarifying! |
How about:
If you are in a cmder shell we write this to the |
Hi
I want to create aliases to work a litle faster.
Tried creating a .bashrc folder in my home dir but it's not working
Thanks
The text was updated successfully, but these errors were encountered: