Invalid options in tmux without custom configuration - macos

I just installed tmux 3.1c on my Mac and have not created any custom configuration(neither ~/.tmux.conf nor ~/.config/tmux/tmux.conf exists)
When I run tmux in both native Terminal and in iTerm2 I am getting the following errors printed in the top of the screen
invalid option: pane-active-border-bg
invalid option: pane-border-bg
I am using zsh with oh-my-zsh plugin but have not found anything that could try to set those options.
Are there any ideas on how to fix that issue?

You can search the manual and you search for "pane-border-style", so the new way is like this:
set -g pane-border-style fg=red

Related

VS Code Terminal Won't Map Option Key to Meta

I am trying to enable the option/alt key as Meta in my terminal in VS Code. I set the "terminal.integrated.macOptionIsMeta": true in my settings.json but it is not working.
I made this same change to my system Terminal app and iTerm2.
iTerm is the only one that works. In iTerm the option key is mapped to Meta but not in the VS Code terminal or Terminal.
Does anyone know why this could be or how to correct it?
OS X 10.15.7
VS Code Version: 1.63.2
iTerm2 Build 3.4.12
Terminal Version 2.10 (433)
VS Code
iTerm2
Terminal
This appears to be an issue with how OS X handles tmux-keyboard integration, not VS Code.
The relationship between Option/Alt and Esc/Meta does not work well. Even if this feature is enabled in your terminal emulator. Consequently, when binding the Meta+ to an action in .tmux.conf the resulting behavior is not as expected.
bind -n M-j select-pane -L
bind -n M-k ​select-pane -R
Alt+j and Alt+k work as expected.
However, when binding the Meta+[DirectionKey]:
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
Alt+Left and Alt+Right do NOT work and you need to use Esc+Left and Esc+Right.

Stata is not seeing environment variables needed for ODBC connection

I use the Simba ODBC driver (2.3.2) to connect Stata to BigQuery from my macOS laptop. I recently upgraded to Big Sur (11.2.1) and lost the ability to do this.
I am using iODBC and I am able to test the DSN successfully. I was also able to get everything to work in macOS 10.15.7 just fine (on a different machine).
The problem appears to be that Stata is not seeing the DYLD_LIBRARY_PATH environment variable that I have defined in my .bash_profile profile according to the driver configuration instructions.
In Stata, I get this error:
. odbc list
The ODBC file libiodbc.dylib could not be found on this system.
Setting the unix LD_LIBRARY_PATH environment variable may correct this error.
r(680);
I am able to set this in bash:
$ echo $DYLD_LIBRARY_PATH
:/usr/lib/:/usr/local/
But that does not seem to work since:
$ printenv | grep 'DYLD'
is empty. I suspect something in Big Sur is preventing this environment variable from being set.
Happy to try anything to fix this.
To fix this, you need to disable SIP, which keeps the $DYLD_LIBRARY_PATH environment variable from being defined without issuing a warning.
To disable SIP:
Restart your computer in Recovery mode by holding down Command(⌘)-R once it powers off. Press that until you see the Apple icon and a progress bar.
From the Utilities menu, select Terminal.
At the prompt, type the following command and then press return: csrutil disable
Terminal should display a message that SIP was disabled.
From the Apple menu, select Restart.
Now you need to define an environment variable that points to the folder with libiodbc.dylib. To figure out where that folder is, type this in Terminal:
find / -name libiodbc.dylib 2>&1 | grep -v "find: "
Using your favorite text editor (like pico, emacs, or vi), you need to edit your .zshenv file. Open this file (or create it if it does not exist) with
pico ~/.zshenv
Using the first folder from above, define an environment variable by typing this in the file:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:<FOLDER-PATH-HERE>
Save and exit the text editor.
To apply the changes to the current shell, type source .zshenv.
This should make Stata and BQ play nice again.
zsh is the default shell starting with Catalina, so if you use another shell, you should modify things accordingly. I use bash myself, but I hope my translation for zsh works.
You may need to start Stata from the command line for this to fully work.
Here's the output of the command after the fix above:
I got this to work on Apple Silicon/ Monterey. At some point Apple rolled out SIP (https://support.apple.com/en-us/HT204899) and the env variable LD_LIBRARY_PATH is no longer accessible, so STATA is unable to find the .dylib file.
Instead of disabling SIP, which is strongly discouraged by Apple, load STATA from the command line and set LD_LIBRARY_PATH in the same command.
Something like this (your paths and STATA version may vary)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/homebrew/lib/ && \
/Applications/Stata/StataIC.app/Contents/MacOS/StataIC &

How to reset vim and neovim when sourcing wrong file .zshrc instead of init.vim

I'm using macOS Catalina which has built in Vim 8.1. I'm also using iTerm with zsh and oh-my-zsh. I installed neovim for my personal use and when I setting it up, I accidentally enter source .zshrc in Command mode instead of source init.vim. From then, when I open neovim or built in vim, it does not source init.vim anymore and shows error message like below:
Error detected while processing VIMINIT:
E33: No previous substitute regular expression
Press ENTER or type command to continue
There is a line in my .zshrc that exports VIMINIT variable
export VIMINIT="~/.config/nvim/init.vim"
How can I undo this or is there any other way to reset vim to original setting? Thank you so much
I tried #Niloct solution, unset VIMINIT and vim/neovim is backed to normal. After that, I reopen the iTerm and it showed error message again. Therefore I removed the export line from .zshrc and the problem has been solved.
To load a clean neovim:
nvim -u NONE -U NONE -N -i NONE
Actually I have an alias for that
alias vinone='nvim -u NONE -U NONE -N -i NONE'
This way you can type vinone and use your default neovim

Set up path on prompt on pycharm terminal windon

I just upgrade pycharm into 2016.3.1. Before upgrade, I do not have problem to see the current directory path under the prompt on terminal window. After upgrade into pycharm 2016
3.1. All directory path on prompt on terminal window seems like messed up with 133;C;133;D;01337;RemoteHost=hawkins#pc_name.home1337;CurrentDir=/Users/hawkins/path133;MAC:path hawkins$ 133;B for some reason. Anyone have expereience on how to resolve this?
MAC:path$
133;C;133;D;01337;RemoteHost=hawkins#pc_name.home1337;CurrentDir=/Users/hawkins/path133;MAC:path hawkins$ 133;B
133;C;133;D;01337;RemoteHost=hawkins#pc_name.home1337;CurrentDir=/Users/hawkins/path133;MAC:path hawkins$ 133;B
133;C;133;D;01337;RemoteHost=hawkins#pc_name.home1337;CurrentDir=/Users/hawkins/path133;MAC:path hawkins$ 133;B
I had a similar problem. It turned out my problem was due to have iTerm shell integration installed.
As you have tagged the question [osx], I assume that you might also have done this.
There is a nice explanation to what these strange symbols mean in this answer: https://unix.stackexchange.com/a/294886/47407
I figured I could avoid having to uninstall Shell Integration by clearing my PROMT_COMMAND, and setting PS1 again. I made a shell script called pycharm_terminal.sh with the following
export PROMT_COMMAND=
export PS1="\[\e[31m\]\u\[\e[0m\] at \[\e[33m\]\h\[\e[0m\] in \[\e[32m\]\w\[\e[0m\] at [\A] \[\033[31m\]`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\[\033[35m\]\n$ \[\033[00m\]"
bash -i
The PS1 variable can be set to whatever you had before. This is just how I like mine.
Now, in PyCharm Settings: Go to Tools > Terminal and in "Shell path" set it to /bin/bash <path_to_pycharm_terminal.sh>.
Now try opening a new terminal in PyCharm. It shouldn't have those control character errors.
Solution that worked for me:
Go to Settings > Plugins
Find plugin "Python Terminal" and disable it
Restart PyCharm
The only negative effect I've noticed - auto activation of virtualenv on terminal start doesn't work.
for some reason, I figure it out by create a .pycharmrc under by user directories
and setting up /usr/local/bin/bash --rcfile ~/.pycharmrc under Tool->Terminal on shell path. It seems like it fixed but i have no idea why
MAC: path$ cat ~/.pycharmrc
exec bash
This is what worked for me:
Created new file pycharm_terminal.sh with one command bash -l
Then I set PyCharm Settings: to Tools > Terminal and in "Shell path" set it to /bin/bash/path_to_pycharm_terminal.sh.
Restart PyCharm and all work as expected
bash -l, by man, is a: -l Make bash act as if it had been invoked as a login shell (see INVOCATION below).
which is probably mean, that when PyCharm starts the Terminal and executing the pycharm_terminal.sh with bash -l, everything in .bash_profile is include by default
Found this question while trying to resolve similar issue for 'Geany' on mac osx. I had an install of iterm2 on my machine and was getting garbage in front of the terminal prompt.
similar solution as KPLauritzen offered also works for 'Geany' terminal as such.
Hope this helps someone:
Create shell script in home directory using desired PS1 & CLICOLOR settings:
~/geany_terminal.sh
export PROMT_COMMAND=
export PS1='[\e[1;32m][\u#\h \W] \D{%F %T}\n\$[\e[0m]'
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
bash -i
Then I went to 'Edit -> Preferences --> Terminal' and set my 'Shell' to:
/bin/bash /Users/myusername/geany_terminal.sh
Upon reloading Geany, the Terminal now displays with PS1 and CLICOLOR settings exactly as I have set in my .bash_profile without garbage in front.
You can just activate your .bash_profile
/bin/bash --rcfile ~/.bash_profile

Multiple tabs with tmux / tmuxinator and iTerm2

I would like to open all my useful stuff like here in iTerm2:
Not like this:
I'm using tmuxinator I've defined some tabs. I wonder if it's possible to get the former behaviour at all.
I just tried with tmux 1.8. Not totally obvious, but it works.
Here's what you do:
Open iTerm2 (latest, be sure to have at least tmux 1.8 installed).
In iTerm2, run command tmux <your tmuxinator profile>. Then detach ^b d.
In iTerm2, run command tmux -CC attach -t <your session>. You will see your tabs open in different windows.
Open menu Shell->Tmux->Dashboard
Select and hide all the windows.
Select all the hidden windows, and click Open in Tabs.
I'd like to know how to avoid the part about hiding and opening in tabs.
Just wanted to add some comments onto what justingordon mentioned (1).
This all works great. But I found how to streamline step 4-6 so it happens automatically.
Go to iTerm2's Preferences, under General, you will see a section titled tmux. There's an option that says When attaching, open unrecognized windows in. If you change the current selection from Windows to Tabs.
Two extra tips.
If you want you could select the option Automatically hide the tmux client session after connection. This will minimize the iTerm2 window in which you typed
tmux -CC attach
I also enabled the option Focus follows mouse. You can find this option under Preferences then Pointer. It should be the first option on the bottom left.
To use tmuxinator with iterm2 panes, use the following configuration:
attach: false
in combination with
on_project_exit:
- tmux -CC attach -t way
It looks like an issue in the documentations as told here
This is an example that I normally use:
# ~/.tmuxinator/way.yml
name: way
root: ~/learn/ruby/ruby-way/
attach: false
on_project_exit:
- tmux -CC attach -t way
# Runs before everything. Use it to start daemons etc.
on_project_start:
- export EDITOR="emacsclient --server-file=way -c"
- export VISUAL=$EDITOR
- emacs --daemon=way --title=RUBY-WAY
- $EDITOR &
windows:
- console:
- echo "A currar"
- testing:
- echo "A testear"
I hope that this helps.
Add this to your tmuxinator config:
attach: false
post: tmux -CC attach
https://github.com/tmuxinator/tmuxinator/pull/293

Resources