Cmder: ~ alias home directory

Created on 27 Nov 2013  路  15Comments  路  Source: cmderdev/cmder

It would be nice to have ~ to complete to home directory, in a similar fashion as in (most) Linux terminals. For example cd ~, mv foo ~/bar/, etc.

wontfix Enhancement

Most helpful comment

I'm using an AutoHotKey script for that:

#IfWinActive ahk_class VirtualConsoleClass
::~::D:/nicolas
#IfWinActive

It replaces automatically ~ with D:/nicolas in ConEmu console (and only ConEmu console)

All 15 comments

I think something like that can be done by _extending clink_. I am sure there is a way to hook into that.

Relevant issue from clink (marked as wontfix)
Relavant docs

I'm going to sound like a broken record but powershell will do that.

@Jackbennett Yes, it will. but powershell is horribly slow for me for no fucking reason.
(and also that is not really valid answer to problem like that, you could you say "just use linux" )

In the alias file, just enter:
cd~=cd %HOMEPATH%

typing cd~ will take you to your user directory.

but what about cd ~\Documents

I'm using an AutoHotKey script for that:

#IfWinActive ahk_class VirtualConsoleClass
::~::D:/nicolas
#IfWinActive

It replaces automatically ~ with D:/nicolas in ConEmu console (and only ConEmu console)

I also would love to have ~ working in paths! Perhaps narnaud's and expositor's fixes could be included by default in the next version of cmder?

use this is work cd %home%

The best way right now (without the possibility of breaking stuff) is to use this alias:

cd~=cd %homepath%

You could also use %USERPROFILE% instead to get your own directory in case of multiple users.

PyCmd can do this.
image

As per the initial request, this will never happen, unless cmd is open sourced (good luck) and the expansion rules changed. The recommended workaround is to stop using cmd and use powershell.

Bit old now..but I added cd~=cd %HOME%$*
At least so I can go cd~ \Documents

The best way right now (without the possibility of breaking stuff) is to use this alias:

cd~=cd %homepath%

You could also use %USERPROFILE% instead to get your own directory in case of multiple users.

@babhishek21 ,where are you entering this?

Update: Looks like it goes in cmder\config\user-aliases.cmd

I was thrilled to find a sensible terminal emulator for WSL use. However, the ~ issue is still present. Interestingly, WSL's bash seems to use ~ just fine; e.g., pushd ~. On the other hand, gvim (I have a script in /usr/local/bin that launches the Windows-installed gvim executable) seems to think that %CMDER_HOME%\vonemu-maximus5\ConEmu\home\ is my home directory. As a result, it ignores my .gvimrc, can't see my spelling directory, and so on.

I was able to resolve my issue by adding

set HOME=C:\Users\
set CMDER_START=C:\Users\

to my startup environment. It's a little brittle but should work fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

emesx picture emesx  路  3Comments

giuliannosbrugnera picture giuliannosbrugnera  路  3Comments

justinmchase picture justinmchase  路  3Comments

hyrious picture hyrious  路  3Comments

edgariscoding picture edgariscoding  路  3Comments