I have set guifont=Fira\ Code:h14 on my .vimrc and it works perfectly on Macvim. However, if it is launched from within Tmux, it won't load the font and throw an error saying invalid font(s).
I installed the font using brew-cask but I doubt this is the problem as it works when launching outside Tmux, maybe some config is missing. How can I solve this?
Run :set guifont=*, which should bring up a GUI font selector on Mac. Notice which fonts are present and missing when you launch it inside and outside of Tmux. Check where the found vs not-found fonts are located on the filesystem. Is there a pattern?
This sounds like a different PATH or environment is being set inside and outside of Tmux that makes a difference. You could also capture the output of env inside and outside of tmux to compare differences in environment variables.
Related
I am trying to use Run/Debug Configurations on WebStorm, however it doesn't seem to source .zshrc and produces errors about not finding commands and environment variables. (An example of this would be yarn tauri dev when using Tauri)
I have installed Ubuntu 20.04 in WSL and the project I opened in WebStorm resides under the $HOME directory. WebStorm is installed in Windows.
For the interactive shell, I have made zsh the default by chsh -s $(which zsh), but when using Run/Debug Configurations it uses the default non-interactive shell, which is dash as far as I know. And my environment variables and PATH are all set in .zshrc, which is not sourced by dash.
It seems in CLion, it is possible to execute commands in the login shell according to this YouTrack issue, but such an option is not available on WebStorm.
Is it possible to use zsh instead of dash as the default non-interactive shell? If not, it would help me a lot to know what is the best practice in such situations.
There are several questions and points you make:
First, from the question title (and the summary at the end):
Can I use zsh as the default non-interactive shell for WSL2 Ubuntu?
Well, maybe (using symlinks), but it would be a really bad idea. So many built-in scripts rely on /bin/sh pointing to Dash, or at least Bash. While Zsh might be compatible with 99.9% of them, eventually there's a strong likelihood that some difference in Zsh would cause a system-level script to fail (or at least produce results inconsistent with those from Dash).
It is possible in Ubuntu to change the default non-interactive ("system" shell) from Dash to Bash with sudo dpkg-reconfigure dash. If you select "No" in the resulting dialog, then the system will be updated to point /bin/sh to bash instead of dash.
But not to Zsh, no.
when using Run/Debug Configurations it uses the default non-interactive shell, which is dash as far as I know
I don't run WebStorm myself, so I'm not sure on this exactly. Maybe #lena's answer (or another) will cover it for you, but if it doesn't, I'm noticing this doc page. It might be worth trying to specify Zsh in those settings, but again, I can't be sure.
And my environment variables and PATH are all set in .zshrc, which is not sourced by dash.
Hmm. I'm guessing you would need these set in a .profile/.zprofile equivalent regardless. I would assume that WebStorm is executing the shell as a non-interactive one, which means that it wouldn't even parse ~/.bashrc if Bash was your default shell.
... it would help me a lot to know what is the best practice in such situations.
Best practice is probably to make sure that your ~/.profile has any environment changes needed. Yes, this violates DRY (don't repeat yourself), but it's probably the best route.
Thanks to the answer here and the discussion below, I was able to figure it out. (Thank you, #NotTheDr01ds and #lena.)
The main problem is that WebStorm is installed on Windows and therefore knows only the environment variables in Windows. There are two ways to solve the problem as follows.
Sharing WSL's environment variable to Windows through WSLENV
Add the line below to .zshrc so that it sets $WSLENV when zsh starts.
export WSLENV=VAR_I_WANT_TO_SHARE:$WSLENV
# Don't forget to insert the colon
# And for some reason, appending the variable after $WSLENV didn't work well
In Windows, run
wsl -e zsh -lic powershell.exe
This runs WSL using zsh (logged-in and interactive), then runs powershell which brings you back to Windows. Although this doesn't seem to achieve anything, by going through zsh in WSL, .zshrc was sourced and therefore $WSLENV set as well. You can check if it worked well by running the below command after you've run the above.
$env:VAR_I_WANT_TO_SHARE
Run WebStorm from the PowerShell that was just created.
& 'C:\Program Files (x86)\JetBrains\WebStorm 2022.1.3\bin\webstorm64.exe'
When you run or debug any of the Run/Debug Configurations, you will see that the environment variable is shared successfully.
Setting the PATH in Windows
For most environment variables, the previous method works well. However, PATH is an exception. The Windows PATH is shared to WSL by default. The opposite doesn't work, probably because the PATH in WSL should not interfere with Windows.I've tried adding the $PATH of WSL into $WSLENV but it didn't seem to work.
In the end, what I did was manually adding each needed $PATH of WSL into the Windows PATH.
For example, if there was export PATH=$PATH:home/(username)/.cargo/bin in .zshrc, you can then add \\wsl$\Ubuntu\home\(username)\.cargo\bin to the Windows $env:Path using the Environment Variable window.
I might have made some mistakes, so feel free to leave an edit or comments.
You can try using npm config set script-shell command to set the shell for your scripts. Like npm config set script-shell "/usr/bin/zsh".
When npm run <script name> spawns a child process, the SHELL being used depends on NPM environment. Cм https://docs.npmjs.com/cli/run-script:
The actual shell your script is run within is platform dependent. By
default, on Unix-like systems it is the /bin/sh command, on Windows it
is the cmd.exe. The actual shell referred to by /bin/sh also depends
on the system. As of npm#5.1.0 you can customize the shell with the
script-shell configuration
See also https://github.com/npm/npm-lifecycle/blob/10c0c08fc25fea3c18c7c030d4618a401963355a/index.js#L293-L304
I recently had to reinstall my system and ever since I've been having a weird issue with tmux where it prompts me for my sudo password every time it creates a new pane or window (including when I first start it). It appears to make absolutely no difference whether I actually enter it or not; because the prompt happens after the pane/window was already created, I can just Ctrl-C out of the prompt if I want. I’m not sure if more functions are also affected which I just don't use but at least some of those I do use are definitely not (e.g. source-file).
On a sidenote, I also noted that since I changed my login shell to zsh after the reinstall, alias definitions in .zprofile do not carry over to interactive shells anymore, which they definitely did do under my previous system (although the file is definitely sourced as environment variables are set correctly even in the interactive shell). Maybe my shell environment got messed somehow and the tmux problem is just a side-effect of that?
Never mind, I found the issue: I was using a sudo call to start a daemon in my .zprofile, so when the interactive shell sourced that it caused a sudo prompt. I found a workaround which doesn't require sudo which solved the problem.
I was trying to set a new home directory for Cygwin, but the thing is I've managed to do so only partially.
I changed the 'db_home:' parameter (cygwin64/etc/nsswitch.conf) to '/windows' so it now matches the win10 default home folder, but the trick works only if mintty.exe was run through cmd.
Running mintty manually with a desktop shortcut results with the very same default directory as if the file was never changed.
Having all that said, I'm a total newbie when it comes to both Cygwin and Unix in general, so it's very likely I missed something obvious.
I appreciate any help provided, thanks in advance.
I've been trying to automate some basic stuff with Robotframework. Here is my configuration.
Python - 2.7.10
MAC High Sierra 10.13.2
Eclipse Oxygen with RED Editor
I've downloaded Geckodriver executable and put in under several places including usr/local/bin, folder on desktop
Here is what i've tried
Setup FFDriver Set Environment Variable webdriver.gecko.driver Users/[my username]/Desktop/geckodriver
Setup FFDriver Set Environment Variable webdriver.gecko.driver usr/local/bin/geckodriver
and my test
open browser http://www.google.com firefox
I've added usr/local/bin in PATH as well and still getting "geckodriver executable needs to be in PATH" error. The same happens with Chromedriver too. I am sure I must be missing something trivial here, can someone help me out please?
Launching the eclipse from command prompt, has fixed this issue. Yes, the PATH is not being inherited when launched from desktop icon.
when you use Python. the best shortcut you can do is, put you 'geckodriver.exe' file in pythons script folder. and set the Script folder path in you system path. this will resolve your problem.
Console Window Host, or conhost.exe allows you to drag a file or folder into a cmd.exe window, instead of typing the path.
If the path contains any spaces then it is wrapped in double quotes, eg
"C:\Program Files"
Problems
Ampersand
If you happen to have a path with & dragging it will fail
cd C:\foo&bar
The system cannot find the path specified.
'bar' is not recognized as an internal or external command, operable program
or batch file.
Bash
If you happen to be using Bash on Windows then any path without a space will
fail.
$ cd C:\Windows\System32
sh: cd: C:WindowsSystem32: No such file or directory
Is there a way to make conhost always apply the quotes to dragged files?
One alternative is to use Tab to complete the path.
I had to edit my ~/.inputrc to add this.
"\t": complete-filename
source: gnu.org/software/bash/manual/bashref
Use mintty
It is the default terminal in Cygwin.
It is also available for MinGW.
It uses Linux like paths when dragging
Adds quotes when necessary.
Note
mintty will not have colors when running native Windows shell apps.
superuser.com/questions/184186
Use Console
It is available for MinGW
It uses Windows paths, but puts quotes on everything
Colors work even with native Windows shell apps
Notes
I considered mintty, but it does not
support colors with native Windows shell apps, ie Git.
superuser.com/questions/184186
Console is nice but it is very slow