ConEmu with %CD% in bash

ConEmu is cool and if you haven't used it or any tool built on it (like cmder) then you've really been missing out on the best in Windows console development. I can't see myself ever going back to conhost.exe with its lack of color, unicode-support, buffered-scrolling, tabs, configuration, sane hotkeys...

ConEmu does suck sometimes at being easy to use out of the box though, including it's failure to keep track of the current directory in non-Windows shells. Most notably this is apparent when you try to clone a tab (defaults to Win + s) in a shell like bash and the directory doesn't stay.

This can actually be fixed by notifying ConEmuC whenever the current directory changes. The way to do this differes between shells but there is documentation for how to do it for the most popular ones. The following snippet is taken and modified from the link above, and it works for WSL bash and Git bash for the same .bashrc:

#ConEmu Integration
if [[ -n "${ConEmuPID}" ]]; then
  #For WSL, Sends an operating system command (OSC) to cygwin/msys connector to
  #update the cwd on PS1 print (the \w).
if [[ ( -n "${ConEmuPID}" ) && ( -x "$(command -v ConEmuC)" ) ]]; then
  #For non-wsl, calls ConEmuC if it exists and will store cwd

After adding this, cloning tabs will now keep the same directory! It should also allow the auto save/load tab feature to open back up to the proper directory.

Note though that opening a new tab still uses the directory ConEmu was started in. If you want this, add /dir %CD% to your "Task Parameters" so that when ConEmu starts that task, all commands will have %CD% as their current working directory.

Con Emu Task Parameters GUI with extra parameter

Vue.js render() and $slots; Corrupt DOM

Just ran into an issue today when making a component with a custom render() function and messing around with…