Unable to reset my terminal when screen is on - shell

I have the following in my .zshrc
if [[ $STY = '' ]] then screen -xR; fi
I made a few changes to my .zshrc.
I run unsuccessfully to see changes
reset
I also restarted my shell unsuccessfully to see the changes.
This suggests me that the screen needs to be restarted somehow.
How can you restart screen such that I see the changes in my .zshrc?

source ~/.zshrc
Also maybe killall screen, then just start screen again?

Related

Terminal doesn't start after a change to bash_profile

I was having an issue with getting VS Code to run .bashrc when I launch the integrated terminal (apparently, there has been some recent changes that encourage the use of profiles over shellArgs). Since adding -l starts the terminal as a login shell which makes it read .bash_profile I made a change to this file by adding source ~/.bashrc at the end. So my new bash_profile looked like this:
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
PATH=~/bin:$PATH
source ~/.bashrc
Then I ran exec bash and this immediately froze the terminal!
I used Finder to revert the change and remove the line from the file but the terminal still won't start. Here's a recording of what happens when I start the terminal app from spotlight.
As it turns out, I had added /bin/bash at the end of .bashrc file and this for some reason caused an infinite loop of execution stopping the terminal from starting. As soon as I removed it, the terminal starts normally.

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

vscode integrated terminal throwing bash error - echo: command not found

On my Macbook, the integrated terminal in VSCODE which is using bash shell is throwing the error "bash: :echo: command not found" as soon as I open it and on every command that I execute in it.
But I dont see this error in my iterm or Terminal though. They both work fine. I am getting this error only in VSCode integrated terminal
It was not happening previously. I am not sure what got changed recently.
I checked if the same issue is happening in iterm and Terminal also or not. But it doesn't happen in them.
Checked the .bash_profile and .bashrc files. But they seem to be fine.
Only place I can find echo command in my bash_profile:
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007";':"$PROMPT_COMMAND";
fi
.bashrc doesn't contain any echo commands
Please let me know why this error is coming in vscode integrated terminal only and how to fix it.
Instead of this:
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007";':"$PROMPT_COMMAND";
Try this one:
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"';

Why am I seeing only 8 colors in terminal (xfce-terminal)?

I'm running Xubuntu 13.04 and I want to use Vim as my default editor for everything. I have downloaded many vim color schemas and tried them out, but all of them don't look like the official screenshot.
For example, vim's own color schema - desert should look like this:
But in my vim, many colors won't display, for example the background.
So this means a fighting with xfce's Terminal and I can't force it to use 256 colors.
the command tput colors gives me
8.
At the same time the code for ((x=0; x<=255; x++));do echo -e "${x}:\033[48;5;${x}mcolor\033[000m";done shows me nice colors. it seems i missed something. If I run
**$ echo $TERM**
I get xterm. It should be 'xterm-256color'
When I try
set term=xterm-256color
and
export TERM=xterm-256color
Then: echo $TERM
I get the message
xterm-256color.
But after signout/signup, I'm still not getting the right colors in Vim. And I see the Xterm is changed to xterm again.
I added:
if $TERM == "xterm-256color" set t_Co=256 endif
and
t_Co=256
to my .vimrc file and it didn't seem to help. Then I customized the xterm entries; added this to ~/.Xdefaults:
*customization: -color
XTerm*termName: xterm-256color
Add this to ~/.xsession to apply to new terminals:
if [ -f $HOME/.Xdefaults ]; then
xrdb -merge $HOME/.Xdefaults
fi
When I changed in preferences of terminal, emulate terminal environment, the 'xterm' to 'xterm-256color'
I get the message:
'*** VTE ***: Failed to load terminal capabilities from '/etc/termcap'
When I check /usr/share/vte/termcap/xterm, the file xterm-256color is missing. Same in folder xterm0.0. I tried to find this file on internet to download and put in the folder, but I couldn't find it.
This is driving me crazy the whole day... Have anyone suggestions?
Quick (Temporary) Way
Enter this whenever you open a new terminal:
export TERM=xterm-256color
Works for as long as the window is open.
Works-but-dirty Way
Append the line above to ~/.bashrc.
The problem with that, though, is that editing $TERM in .bashrc is a bad idea because doing that automatically makes any terminal using bash try to use it regardless of whether it actually supports 256 colors or not (like when SSH-ing or accessing the terminals with Ctrl+Alt+F1 to F6).
What I did, though is that since xfce4-terminal sets the $COLORTERM value to xfce4-terminal, I, instead appended the following to .bashrc:
if [ "$COLORTERM" == "xfce4-terminal" ] ; then
export TERM=xterm-256color
fi
That way, the relevant $TERM edit only happens if you're using xfce4-terminal, which just sets it to xterm anyway (and changing the emulation environment results in that "VTE" message).
References:
https://bbs.archlinux.org/viewtopic.php?id=175581
http://vim.wikia.com/wiki/256_colors_in_vim#Comments
http://promberger.info/linux/2008/04/05/getting-256-color-support-working-for-mutt-in-xfce4-terminal/
http://docs.xfce.org/apps/terminal/getting-started

Bash Login prompt disappeared

I recently made changes to my /etc/profile, and afterwards when I open a new tab in iTerm or Terminal I don't get a prompt. I tried reverting the changes in /etc/profile to the way I thought they were before - using Vim's undo - but I still don't get a login prompt, I just get a blank screen with a blinking cursor in the top left corner. I tried logging in as a different user, and the other user has the same problem, so I think the error is in the global bash login. /etc/motd doesn't run, but I'm not sure about the other files. Normally I would restart the computer but I have one shell that works and I'm hesitant to lose it by restarting the computer. Is there anywhere where an error would be logged? Thanks for your help,
Kevin
Here's my /etc/profile:
#put this in to try and debug, but does not show on the screen
echo "hello"
export PYTHONPATH=/Library/Python/2.6/site-packages:$PYTHONPATH
# System-wide .profile for sh(1)
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
fortune
Since when you open a new terminal it remains open, it seems that bash is still running but:
It does not show a prompt because you broke $PS1. In that case you might be still able to enter commands. export PS1='$ ' would be a good start in that case.
or
It is still doing something from /etc/profile. Either it's waiting for another process, or it has entered some kind of infinite loop - like the one caused by a shell file source loop.
Since you have a working terminal, you should check the running processes in ps before and after you start a new shell, to get an idea on what's going on.
I accidentally closed the window, and after I did I tried restarting the computer. When I logged back in the prompt displayed properly. Thanks for the help in the meantime.

Resources