clink.get_cwd() is returning a string which is differently encoded than what
clink.prompt.value expects. This results in garbled path names if the path
condains non-ASCII chars. The (arguable hacky) solution is to parse the old
prompt for the current directory (which breaks if the user sets a PROMPT env var
which is incompatible to the regex used here...).
Also parse out a environment name set by systems like virtualenv or conda: this
could be done more specifically by targeting each such system and using the
usually set environment variable but this would mean that we would have to do
that for each and every such system out there and that is probably not a sane
idea...
This keeps the PROMPT variable as is and changes the prompt to the cmder style
in the clink code.
This has two advantages:
* opening a cmd in a cmder session will now show the old prompt code instead of
a ugly raw prompt without the replacements. This led to ugly output when a
batch file echoed their content (e.g `conda build recipe/`).
* when a command rewrites the prompt (e.g. an activate in a virtualenv), these
command sometimes simply overwrites the PROMPT so that the cmder enhancements
were not anymore in place. Now we simply don't care and overwrite it with our
stuff in the clink part. This might mean that a user has to install a lua
script so that e.g. conda environments are visible on the prompt.
4bfdf04d59 moved all clink config files
to vendor/ and therefore the files in config/ were not used and .history
was also moved to vendor/.
The new arrangement uses `--script` to load our own clink.lua file which in
turn as the first thing loads the original clink.lua file. The user defined
files are again in config/. As clink regenerates these files, if they are not
present, this also means that we don't need to include the settings file
in the git repo and therefore don't overwrite it on updates.