Unable to disable a startup message in Zsh - startup

I get the following when I start my Zsh.
Usage: prompt <options>
Options:
-c Show currently selected theme and parameters
-l List currently available prompt themes
-p [<themes>] Preview given themes (defaults to all)
-h [<theme>] Display help (for given theme)
-s <theme> Set and save theme
<theme> Switch to new theme immediately (changes not saved)
It seems to be set by some theme file, since the same text is here.
How can you disable the notification in Zsh?

This isn't a startup message. It's the error/default help message displayed when the prompt command is used without arguments or erroneous arguments. Find out where you're using it, and fix/delete it.

You'll want to search through the files that zsh loads on startup, here is a list from their documentation
Look for a misconfigured prompt command line and try commenting it out or better fixing it.

Related

Authorize UNIX command to control an application

I want to set up an Automator Quick Action that runs the bbdiff command, and passes it the selected files in the Finder.
I created a Quick Action, and set it to receive "files or folders" in "Finder.app".
Then I added the "Run Shell Script" action, and set the shell to "/bin/bash", and to Pass Input "as arguments". The script is:
/usr/local/bin/bbdiff "$1" "$2"
If I run that script manually from Automator or Terminal (replacing the arguments with real filenames) it prompts me to authorize the host program to control BBEdit, and then it works.
But if I run it from the Finder, I get this error:
The action “Run Shell Script” encountered an error: “You must allow bbdiff to send events to the BBEdit application.
Use tccutil reset AppleEvents to reset the system's permissions, and try again.
bbdiff: error: -1743”
I tried running tccutil reset AppleEvents and running the action again, but it showed the same error.
I also tried adding bbdiff, /bin/bash, and Finder to the Accessibility and Full Disk Access tabs of System Preferences > Privacy, but nothing changed. It looks like you need to add something to the Automation tab, which can't be done manually.
How can I get it to allow a UNIX command like bbdiff to control an application?
UPDATE:
I managed to work around this by using a "Run AppleScript" action, instead of "Run Shell Script", with this script:
on run {input, parameters}
tell application "BBEdit" to compare (item 1 of input) against (item 2 of input)
return input
end run
The first time I ran it, I got the prompt to allow Finder to control BBEdit, and then it worked.
But this wouldn't work for other shell scripts, so the question is still open.
In my case, I was able to fix it simply by closing the currently opened BBEdit then opening it again. In my case, I was doing a BBEdit update before the error appears.

Command line won't let me type, in the midst of a Rails Console session

In Rails console I entered an Active Record query, and it took up more than the whole screen, so it was scrolling. I forgot to hit q to get out of it and instead hit Ctrl-C. I got some errors, then I got some of the Rails console output, then I hit ^C again, then my prompt came up...
But I can't type anything. Well, actually I can type, but I can't see anything.
If I type exit it will exit the Rails console and get me back to my prompt, and then if I type rails c I'll get back to my console. Except none of the things I just mentioned typing appear on the screen when I type them.
And once I'm back inside the console I still can't see what I'm typing. I have to open a new terminal.
I've had this happen in a number of different scenarios, probably all where my reflexes exited a process the wrong way (like with ^C instead of q), and this is just the first one where I could pin it down.
Does anyone know how to fix this without having to scrap my work and open a new terminal?
Something you've typed, or something output from your query in console, has disabled or redirected the "echo" setting in your shell - so, you're still able to type commands, but you just can't see them. If the Active Record query returned binary data, it's quite likely that some bytes of the binary data happened to be an escape code that changed your echo setting. It's also important to realize that if your echo setting changed, it's quite possible that other settings have changed as well.
If you're at your shell prompt, you would just type the unix command reset to restore normal settings. However, if you're still in your Rails console, you'll need to type:
system 'reset'
to run that command from Ruby.
Type reset and press enter, it should be fixed.

How to configure better errors rails for firefox

how to configure better errors for ROR on linux with firefox. Better errors gem is useful to open rails application error file with line number from browser only, so it will be less time consuming for developer to correct the error and no need to search file and line separately
First of all download and install sublime url handler patch to handle the url with line number. Download sublime-url-handler.
Goto to development.rb file and add BetterErrors.editor = :sublime
Goto firefox and type about:config in url and hit enter
Right click and create new property with boolean type with name " network.protocol-handler.expose.subl" set "False".
Restart firefox.
Run your rails app and get the error link page, click on error link it will ask open open with if sublime-url-hanlder is shown here well done choose and cheers if not shown than give your sublime executable path here and done.
Remember give sublime executable path only not /usr/bin/subl, or shared lib path. You can find the executable path by running subl and see the process details like "ps -eaf | grep subl" copy the path and give this path in firefox choose application.

"set number" in .vimrc not working in Vim for iOS

I added the following .vimrc file to the home directory of Vim for iOS on my iPad.
set showcmd
set number
set guifont=Courier:h24
imap jk <Esc>
For some mysterious reason, all commands work fine except set number. Since manually typing :set number still works, it can't be that Vim for iOS doesn't support displaying line numbers. I have no clue why it behaves differently when I put it in .vimrc. Any ideas?
Check with
:verbose set number?
where this got set last.
If that doesn't provide a hint, capture a log with vim -V20vimlog and check for :set number commands. (This assumes that you can launch Vim on the command-line on the iPad. If not, add :set verbose=20 verbosefile=vimlog to your ~/.vimrc.)
Also, the :scriptnames command shows all scripts that ran after your ~/.vimrc.

Change iTerm2 tab title dynamically for Ruby/Rails

I am using iTerm2 and usually have many tabs open. Unfortunately all tabs show me the same title "ruby" as it is all ruby scripts.
But one is rails server, the other rails console, the next is "spork", ... I would like to set the tab titles dynamically to "server", "console" or something similar as long as the processes are running and back to the default ("bash") when they are finished.
Anybody knows how to do this?
Thanks.
This command will set a tab's title to MY_NEW_TITLE
echo -e "\033];MY_NEW_TITLE\007"
The best way to do this depends on your shell.
I use zsh, which allows you to define hook functions which are run when command are run, before the prompt is printed, etc (actually, the code I'm using lives on github.
It looks as though bash has similar functionality.
I'd probably use the echo command in one of the other answers here, or zsh's title function to set the title from within your scripts, then ensure it's set back using a hook which runs before the next prompt is drawn.

Resources