I was having issues with my zsh prompt when using zgen, first I had the zgen example code in ~/.zshrc, it initially worked, and then I was moving the code around into ~/repos/dotfiles/.zshrc and then doing source ~/repos/dotfiles/.zshrc in my ~/.zshrc, but at some point my zsh prompt broke and I was left with:
devin%
without any colourz :(
I'm not sure what to do.
At some point it started working again after zgen re-generated the init script, but then stopped working again for some reason.
By removing the init script, rm ~/.zgen/init.zsh, and opening a new terminal, zgen re-generated the init script, restoring the colored prompt. zgen update should also fix the issue, as it updates everything and removes the init script, which would be freshly generated next time you open a new terminal tab (if you're using the example .zshrc on the readme)
Related
Command Image
I am unable to search on SO hence detailing it here, this can be a duplicate question.Refer the Step 4:'Start the Tailwind CLI build process' TailwindInstallation the question is once I run the MSDOS command for CSS processing: npx tailwindcss -i input.css -o output.css --watch , the rebuilding and done is OK with no errors (refer attached command image) but after that my cursor keeps blinking forever, so I cant issue any more DOS commands so then I need to hit CTRL C (say couple of times) to get a message 'Terminate Batch Job(Y/N)' and I choose Y and then its normal command line prompt.This is an irritant.What am I doing wrong , please advise
That command ends with --watch, so the process will keep running monitoring changes to the files and constantly update the Tailwind css output.
The idea is to leave it running while you are working on the site. If you still need the terminal for something else then open another terminal.
I'm writing a shell history application, and I'm experiencing issues with deleting a command from zsh history. When I was developing bash compatibility, I used readline to manipulate history - I first deleted command from readline's history, then wrote the history to a file. After the program exits, if the history was manipulated, then I do history -r and I get the expected behavior. Since zsh does not use readline and its history command significantly differs from the one that can be found on bash, I'm left with no other choice but to manipulate the history file directly. However, when I do that, the changes are not reflected until the shell is restarted. I have tried to use zsh's equivalent of history -r, which is supposed to be fc -R, but I did not get the expected results. While the command gets deleted from history after running that, pressing the up arrow (in order to go back to the previous command, which should be the one that invoked the program) brings me to a seemingly random command in the history.
I'd appreciate it if someone explained the odd behavior I'm experiencing. Any pointers in the right direction are also welcome.
I have solved this problem in my Zsh history editing plugin zsh-hist by not touching the histfile directly, but instead doing everything through Zsh's own mechanisms:
Set $HISTORY_IGNORE locally to a pattern that matches the contents of the entries you want to delete.
Use fc -W to write the history to file. Because of HISTORY_IGNORE, the unwanted entries will not be written.
Use fc -p to create a new history from file.
Zsh documentation:
$HISTORY_IGNORE parameter
fc builtin command
I try to run an R script at regular intervals to update a webpage. The script runs fine when called from the terminal like this:
/usr/local/bin/Rscript /Users/me/path/myscript.R
However, if I try running it as a cron job, I get an error. I add the job to crontab like this:
46 10 * * * /usr/local/bin/Rscript '/Users/me/path/myscript.R' >> '/Users/me/path/mylog.log' 2>&1
The script does run in R, but aborts due to an error. Specifically, I fit some models using rstan, and get an initialization error. (The error only applies to some models, while others still run fine.) The initialization values are valid by definition, but do not seem to be used properly. It is like rstan is doing math differently (and wrong) when it is run through cron.
The session info from R is identical whether I run the script in the terminal or as a cron job. My question is what else might still differ depending on how the script is run. Could rstan be using a different version of C++ when run as a cron job? Are there other paths I may need to set to get this to work correctly?
Update: The script also works if I run it using R CMD BATCH in terminal, but not if I use R CMD BATCH in a cron job. Using launchd triggers the same issue. I also tried using CmdStan through cmdstanr, and the same same thing happens: Runs fine until added to a cron job.
Edit 2: The models I thought ran fine in cron, were not actually fine. The results were wrong, until I used the fix explained below.
It looks like I finally managed to fix this, and I'm posting my solution here for anyone who encounters the same problem.
I ran env in terminal to see my current user environment. I copy-pasted the full output to the top of my crontab file. (Simply adding the PATH variable was not sufficient. I suppose it was SHELL or perhaps both PATH and SHELL that did the trick, but I haven't explored this further.)
To edit my user's crontab, I ran crontab -e, then pressed i to edit the file, pasted everything from env at the top of the file, stopped editing by pressing ctrl + c, and quit by typing :wq and hitting enter.
I've used Iterm2 with zsh everyday for the past 3 years, but I got a new computer and had to set it up again. The problem is that when I run ~/.zshrc it works fine, but I have to do it on every new terminal window I open. Not a good experience.
I noticed that I don't have any bashrc, bash_profile, or profile (dot)files on my new machine.
Here's the code in ~/.zshrc:
export ZSH=/Users/healy/.oh-my-zsh
plugins=(
git
)
ZSH_THEME="agnoster"
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
DEFAULT_USER=healy
Again, it works perfectly (and as expected), but only after I run the source command, and that shouldn't be the case.
Make sure your export/source are added after the plugins in your zshrc, as stated in this post:
oh-my-zsh config file not loading
On starting a new shell just run the command source ~/.zshrc by configuring in the
Preferences -> Profiles -> Select Default Profile(default profile will be starred) -> General -> Command -> Select Login Shell -> Send text at start:
Enter the value source ~/.zshrc.
You may add source ~/.zshrc; clear in case you need to clear the screen contents after executing the command.
I had the same issue and changing the Shells Open with option fixed this for me.
To get here:
Open Preferences for Terminal
Select the General Tab
Change Sells open with from Default login shell to Command (complete path) with the /bin/zsh in the input box.
Screeshot:
On 11.2.1 with Terminal 2.11, assuming you have already created .zshrc in your home directory, launch Terminal and select Terminal >> Preferences >> Profiles >> Shell
Under "Startup" check "Run command:" and input source ~/.zshrc
In my case, oh-my-zsh is not loaded because the line was comment out.
# IT'S WRONG! NEED TO UNCOMMENT
# export ZSH=/Users/$(whoami)/.oh-my-zsh
Though this question is not due to the same "comment out" obviously, I came to a conclusion that, if you need to source ~/.zshrc every time opening a shell instance, there should be some issue with your .zshrc,
and check oh-my-zsh and antigen(maybe) work fine.
for me,It works like this.
Profiles 》Open Profiles 》Select “Edit Profiles” 》Profiles 》General
and put "source ~/.zsh" into Send text at start textfield.
The simplified version of my question is how can I achieve a command such as the following.
gvim --remote-tab-silent -c mak
When I run this command I am hoping for a new tab to be opened, and to have the make command run. What actually happens however is there are two new tabs "-c" and "mak"
Is there a way to do this? My end goal is to be able to within vim run a command such as this to give me asynchonous make output.
!gvim --remote-tab-silent -c mak
Thanks in advance.
--EDIT--
I found the documentation for --remote, which explains how to do a remote command with opening a file. The syntax applies to remote-tab apparently.
To do what I want I am now using
gvim --remote-tab-silent +mak MakeOutput
Similarly inside vim I can use
!gvim --remote-tab-silent +mak
MakeOutput
It automatically opens the first error in a file for me, which is convenient I would think :)
It seems like what you're asking is how to execute commands asynchronously with updates when they complete.
Have a look at my AsyncCommand plugin. It's just wraps the vim syntax required to execute something and load it with --remote. I've uploaded AsyncCommand 2.0 that includes an AsyncMake command.
Add the script to your .vim/plugin and you can build with :AsyncMake or :AsyncMake target. Errors will be opened in your quickfix once the make completes.