Open spencerwooo opened 5 years ago
Disclaimer: I'm not commenting on the feature idea, just what possibilities there are that might help you now.
WSL - Windows Subsystem on Linux, it's known that the two systems doesn't share the same home folder, but I usually setup my code in my Windows partition (and I can't get access to the Linux partition for file system compatibility issues, obviously), so I hope that powerlevel9k can support custom user home directories (or just show
/mnt/c/Users/WINDOWS_USER_NAME
as "~
plus a different icon" would be nice).
I'm not quite sure if you imply by "incompatibility issues" that your files are inaccessible/unreachable in your "Linux/WSL home" from your Windows system or if you have other worries like permissions, file corruptions, etc.
If it is just the former, you can access it, e.g. for Ubuntu %LocalAppData%\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home
. I guess it's something similar for Arch. I am not sure if it is a good idea sure it is a bad idea to work with these directories directly from Windows, reading should be fine, but please read up on it. (More on WSL fs)
Some more (bad) ideas, that you should not quote me on and might want to try (or to avoid):
export HOME="/mnt/c/Users/WINDOWS_USER_NAME"
@Syphdias Thank you for your suggestions. ♥
I am not sure if it is a good idea to work with these directories directly from Windows. (More on WSL fs)
Yes, it's definitely not recommended to access Linux files from Windows' side.
- changing home in passwd file
- export HOME="/mnt/c/Users/WINDOWS_USER_NAME"
I'm trying not to mess up my Windows environments with my Linux ones. And Linux can't chmod
Windows' files, so for programs like ssh
, I can't just use the keys on both sides. Thus I think simply changing the $HOME is not an option.
An update:
I configured p9k to truncate path to 2 words, so when I'm in Windows' home folder, it looks like this:
As a matter of fact, I am kind of satisfied. Do wish there's a better way implement this.
Yes, it's definitely not recommended to access Linux files from Windows' side.
I corrected that statement shortly before your answer ;)
I configured p9k to truncate path to 2 words, so when I'm in Windows' home folder, it looks like this:
As a matter of fact, I am kind of satisfied. Do wish there's a better way implement this.
You might want to play around with some dir shorten strategies, especially truncate_with_folder_marker
:
touch "/mnt/c/Users/WINDOWS_USER_NAME/.shorten_folder_marker"
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"
cd "/mnt/c/Users/WINDOWS_USER_NAME/Documents"
Another interesting one might be truncate_with_package_name
, though currently, this needs a git repository which is a(nother) bad idea to have in your home directory. (This changes with ab6c1b779c3869d5792edbfbfa2e4f6576d219e4 which is currently only on the next
branch)
@spencerwooo This is a perfect use case for named directories. First, put this in your ~/.zshrc
.
hash -d w=/mnt/c/Users/spenc
(You can use any name instead of w
. I went with w
as a shorthand for Windows.)
Now ZSH will automatically perform bidirectional mapping between ~w
and /mnt/c/Users/spenc
the same way and in the same context where it performs mapping between ~
and /home/spencer
. That is, commands like cd ~w
and ls -d ~w/*
will work. File completion after ~w
will work, too.
Unfortunately, there is a bug in Powerlevel9k that will prevent ~w
being shown in your prompt. You can either switch to Powerlevel10k where this bug is fixed (it'll work with your existing config without any changes; you'll get the same prompt as before but it'll be much faster and with many bugs being fixed) or as a workaround you can set POWERLEVEL9K_SHORTEN_STRATEGY=default
and POWERLEVEL9K_SHORTEN_DIR_LENGTH=9999
.
@romkatv Thank you so much, I've switched to Powerlevel10k for now and it's really faster. ❤️
Describe Your Issue
This is not an issue, but more of a feature request.
WSL - Windows Subsystem on Linux, it's known that the two systems doesn't share the same home folder, but I usually setup my code in my Windows partition (and I can't get access to the Linux partition for file system compatibility issues, obviously), so I hope that powerlevel9k can support custom user home directories (or just show
/mnt/c/Users/WINDOWS_USER_NAME
as "~
plus a different icon" would be nice).Screenshot below:
Have you tried to debug or fix it?
I'm not that familiar with
zsh
orbash
grammar, but I'm willing to give it a shot. I will need some time (a lot of time) to figure out how to implement this by myself ... Also it came to me that not all WSL users' home path are/mnt/c
, so I really have no idea how to implement this ⊙﹏⊙∥Environment Information
This information will help us understand your configuration.
zsh --version
to see this. _zsh 5.6.2 (x8664-pc-linux-gnu)