cmder icon indicating copy to clipboard operation
cmder copied to clipboard

Latest Windows 10 Update Breaks Aliases

Open thatdoorsajar opened this issue 9 years ago • 39 comments

Everything was working just as normal. All my aliases were being read from \cmder\config\user-aliases.cmd then I ran the most recent Windows 10 update and the aliases stopped working. Everything else works fine including the user-profile.cmd.

I deleted cmder and reinstalled but the exact same problem continues. If this is a problem with the Windows 10 update then sorry for posting here but I imagine it will be a problem the cmder team need to address.

EDIT

Aliases can be stored to the file using alias foo=bar but cannot be read from the file by using foo.

thatdoorsajar avatar May 16 '17 12:05 thatdoorsajar

It also appears on my windows 10. Run alias "ll" will get the following error. 'll' is not recognized as an internal or external command, operable program or batch file.

huihuiguoguo avatar May 18 '17 12:05 huihuiguoguo

Same problem here, aliases stopped working after the latest major W10 update.

The colour highlighting for files/folders (ex: when running ls inside a directory) is also gone, although I'm not sure if this is as a result of the update or something else.

Demers94 avatar May 21 '17 22:05 Demers94

@Demers94 That's because there's this default alias: ls=ls --show-control-chars -F --color $* which of course also stopped working.

alinnert avatar May 25 '17 04:05 alinnert

#1325

lunyx avatar Jun 01 '17 20:06 lunyx

Same here...

illusive-man avatar Jun 15 '17 00:06 illusive-man

I really love Cmder, but these broken aliases have really cut into my productivity. I've switched to Git Bash for now but I'd love to see a fix soon.

PixelTom avatar Jun 17 '17 05:06 PixelTom

Mine started working again this morning. When i opened cmder I got this message

Clink v0.4.8 [git:d565ad] Copyright (c) 2012-2016 Martin Ridgers
http://mridgers.github.io/clink

Now all aliases seem to be working just fine and i can also use bash in cmder

nonsocode avatar Jun 23 '17 09:06 nonsocode

For me this is also a blocker in using cmder - is there a chance this will be fixed? Related issue has been closed: https://github.com/cmderdev/cmder/issues/1257 @nonsocode The Clink update did not help in my case - using same version 0.4.8 without changed behavior...

mattanja avatar Jul 04 '17 06:07 mattanja

As a bash:bash user, I have a .bashrc profile inside my user folder. I put all aliases in there and they work!

Foxandxss avatar Jul 08 '17 12:07 Foxandxss

@Foxandxss the only issue with that approach is that the aliases are not portable. Maybe not an issue for you but cmder best practice would be to put the aliases and any other shell specific config in a *.cmd, *.ps1, *.sh file in $CMDER_ROOT/config/profile.d and then you could zip up the entire cmder folder and take it all with you.

daxgames avatar Jul 09 '17 01:07 daxgames

@daxgames please read issue's description. It clearly states that problem is with *.cmd config (for cmd.exe). There is no problem with bash and PS aliases. And (surprise) you can store your aliases for bash along with cmder, but you do it in user-profile.sh file which is in cmder/config folder. BUT if there is the config file in the User home dir, it will have greater priority over cmder dir config. So aliases are portable and you can take it all with you! The following example works great on latest Windows 10 Pro 1703 15063.413.

alias hd='cd /c/Users/UserNameHere'
alias edit='atom.exe $*'
alias cls=clear

BTW for PowerShell, there's its own alias format. Check the official docs if you need it.

illusive-man avatar Jul 09 '17 11:07 illusive-man

@illusive-man not sure why you pointed this at me. I am fully aware of how it works since I wrote the profile.d code in cmder and what the issue is.

I was just pointing out to @foxandxss the definite lack of portability in using an alias store outside the cmder folder.

Indeed you can store aliases in config/user-profile.sh, I wrote part of that too, but putting all the config in one monolithic file can get a little messy. You can just drop a file in profile.d whose extension matches the shell you are running and it will become a part of that shells initialization.

daxgames avatar Jul 09 '17 12:07 daxgames

@daxgames Don't get me wrong, but I didn't get it at first that you were talking to Foxandxss. Sorry, my bad!

Well, personally I'm using like 10-20 aliases on a daily basis. So for me, config/user-profile.sh is more than enough. But I will try and use your advice on profile.d folder. Thanks for the precious hint!

illusive-man avatar Jul 09 '17 16:07 illusive-man

The problem with config/user-profile.sh for me is that they don't autoload anymore, or at least for me (since creator update)

Foxandxss avatar Jul 09 '17 16:07 Foxandxss

@illusive-man No problem. I have like 500+ aliases makes the file a little large.

daxgames avatar Jul 09 '17 18:07 daxgames

@Foxandxss If they load from ~/.bashrc and not from $CMDER_ROOT/config/user-profile.sh then I am betting the issue is not the creator update. The Creator update issue is specifically an issue with cmd.exe doskey macros and clink a component used by cmder to provide bash like command completion and other things to cmd.exe. I will look and see if I have the same issue and let you know.

daxgames avatar Jul 09 '17 18:07 daxgames

@daxgames They were working fine until the creator update. I remember updating to it and they stopped working.

I had to source $CMDER_ROOT/config/user_profile.sh to load them per tab basis. The .bashrc is just a new workaround.

Foxandxss avatar Jul 09 '17 18:07 Foxandxss

Just confirmed it. I am on Microsoft Windows [Version 10.0.15063].

Running bash->bash in cmder loads aliases from both $CMDER_ROOT/config/user_profile.sh and from $CMDER_ROOT/config/profile.d/*.sh.

Output from brand new bash->bash with no ~/.bashrc

dgames@DTG-WS ~
λ alias upsh
alias upsh='echo I am an alias from the $CMDER_ROOT/config/user-profile.sh'
dgames@DTG-WS ~
λ upsh
I am an alias from the /c/Users/dgames/cmder/config/user-profile.sh
dgames@DTG-WS ~
λ ls ~/.bash*
/c/Users/dgames/.bash_history
dgames@DTG-WS ~
λ

The same does not work for doskey aliases when launching cmder->cmder as expected.

C:\Users\dgames
λ alias cmderr
cmderr=cd /d "%CMDER_ROOT%"

C:\Users\dgames
λ cmderr
'cmderr' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\dgames
λ

daxgames avatar Jul 09 '17 19:07 daxgames

foxan@DESKTOP-G0E7BTC MINGW32 ~/Documents/Programming
$ gst
bash: gst: command not found

foxan@DESKTOP-G0E7BTC MINGW32 ~/Documents/Programming
$ cat ~/Documents/cmder/config/user-profile.sh

# use this file to run your own startup commands for msys2 bash'

# To add a new vendor to the path, do something like:
# export PATH=${CMDER_ROOT}/vendor/whatever:${PATH}

alias gaa='git add --all'
alias gcb='git checkout -b'
alias gst='git status'
alias ggpush='git push origin $(git rev-parse --abbrev-ref HEAD)'
alias updups='git fetch upstream && git rebase upstream/master && ggpush'
foxan@DESKTOP-G0E7BTC MINGW32 ~/Documents/Programming
$ source ~/Documents/cmder/config/user-profile.sh

foxan@DESKTOP-G0E7BTC MINGW32 ~/Documents/Programming
$ gst
fatal: Not a git repository (or any of the parent directories): .git

foxan@DESKTOP-G0E7BTC MINGW32 ~/Documents/Programming
$ cd ~

foxan@DESKTOP-G0E7BTC MINGW32 ~
$ mv foo .bashrc

I restart cmder....

foxan@DESKTOP-G0E7BTC MINGW32 ~/Documents/Programming
$ gst
fatal: Not a git repository (or any of the parent directories): .git

foxan@DESKTOP-G0E7BTC MINGW32 ~/Documents/Programming
$

Doesn't work for me :/

Foxandxss avatar Jul 09 '17 19:07 Foxandxss

Odd. Maybe we are on diff versions of cmder. Also are you using Cmder's bash or windows 10 ubuntu bash?

Just for arguments sake I commented the clink load bits from %CMDER_ROOT%/ventor/init.bat and now launching cmder->cmder aliases now work:

C:\Users\dgames>alias cmderr
cmderr=cd /d "%CMDER_ROOT%"

C:\Users\dgames>cmderr

C:\Users\dgames\cmder>

But we lose all the niceties clink provides.

Have you tried building cmder from source? It is easy:

  1. Download https://github.com/cmderdev/cmder/archive/master.zip
  2. Expand it into a new folder.
  3. Open a Powershell.exe shell outside cmder.
  4. Close all cmder windows.
  5. Change to the '[dir you expanded into]\scripts'
  6. Type './build.ps1 -verbose'

You should see:

C:\Users\dgames\cmder\scripts> .\build.ps1 -verbose
VERBOSE: Backup '..\vendor\conemu-maximus5\ConEmu.xml' to '..\config\ConEmu.xml'
VERBOSE: Getting git-for-windows from URL
https://github.com/git-for-windows/git/releases/download/v2.13.2.windows.1/PortableGit-2.13.2-32-bit.7z.exe
VERBOSE: Remove tmp/git-for-windows.tmp
VERBOSE: Remove git-for-windows
VERBOSE: Downloading from
https://github.com/git-for-windows/git/releases/download/v2.13.2.windows.1/PortableGit-2.13.2-32-bit.7z.exe to
C:\Users\dgames\cmder\vendor\tmp\git-for-windows.tmp
VERBOSE: Extracting Archive 'C:\Users\dgames\cmder\vendor\tmp\git-for-windows.tmp to 'C:\Users\dgames\cmder\vendor\git-for-windows'
VERBOSE: Getting clink from URL https://github.com/mridgers/clink/releases/download/0.4.8/clink_0.4.8.zip
VERBOSE: Remove tmp/clink.tmp
VERBOSE: Remove clink
VERBOSE: Downloading from https://github.com/mridgers/clink/releases/download/0.4.8/clink_0.4.8.zip to C:\Users\dgames\cmder\vendor\tmp\clink.tmp
VERBOSE: Extracting Archive 'C:\Users\dgames\cmder\vendor\tmp\clink.tmp to 'C:\Users\dgames\cmder\vendor\clink'
VERBOSE: Getting conemu-maximus5 from URL https://github.com/Maximus5/ConEmu/releases/download/v17.06.22/ConEmuPack.170622.7z
VERBOSE: Remove tmp/conemu-maximus5.tmp
VERBOSE: Remove conemu-maximus5
VERBOSE: Downloading from https://github.com/Maximus5/ConEmu/releases/download/v17.06.22/ConEmuPack.170622.7z to
C:\Users\dgames\cmder\vendor\tmp\conemu-maximus5.tmp
VERBOSE: Extracting Archive 'C:\Users\dgames\cmder\vendor\tmp\conemu-maximus5.tmp to 'C:\Users\dgames\cmder\vendor\conemu-maximus5'
VERBOSE: Getting clink-completions from URL https://github.com/vladimir-kotikov/clink-completions/archive/0.3.2.zip
VERBOSE: Remove tmp/clink-completions.tmp
VERBOSE: Remove clink-completions
VERBOSE: Downloading from https://github.com/vladimir-kotikov/clink-completions/archive/0.3.2.zip to
C:\Users\dgames\cmder\vendor\tmp\clink-completions.tmp
VERBOSE: Extracting Archive 'C:\Users\dgames\cmder\vendor\tmp\clink-completions.tmp to 'C:\Users\dgames\cmder\vendor\clink-completions'
VERBOSE: Restore '..\config\ConEmu.xml' to '..\vendor\conemu-maximus5\ConEmu.xml'
WARNING: You are not building a launcher, Use -Compile
WARNING: This cannot be a release. Test build only!
VERBOSE: Adding cmder.sh /etc/profile.d
VERBOSE: Replacing /etc/profile.d/git-prompt.sh with our git-prompt.sh
VERBOSE: All good and done!

daxgames avatar Jul 09 '17 19:07 daxgames