How to configure screen
Add below lines to ~/.bashrc
if [ "$TERM" = "screen" ]; then
mycommand () {
if [ "n$tname" != "n" ];then
printf '\ek%s\e\\' "($tname)"
else
printf '\ek%s\e\\' "<$PWD>"
fi
}
PROMPT_COMMAND="mycommand; $PROMPT_COMMAND"
fi
Add below lines to ~/.screenrc
startup_message off
chdir
autodetach on
defscrollback 10000
caption always "%{= b} %= %H"
hardstatus alwayslastline "%-Lw%{= G}%50>%n%f* %t%{-}%+Lw%<"
shelltitle "shell"
shell -$SHELL
download linuxsty.vim from http://www.vim.org/scripts/script.php?script_id=4369 and copy it as
~/.vimrc and remove all other vim related files and directory ( rm -rf ~/.vim/plugin ; rm -rf ~/.viminfo etc )
Most Used Commands
1) start a session
screen -S "star"
2) start a new tab
ctrl +a then c
3) switch tabs
ctrl +a then 0...to 9 number
4) re attach to session
screen -x // attach to a session
5) show all running sessions
screen -ls
6) kill current window
ctrl + a then K
7) Name a tab
export tname="name of the tab"
8) copy paste
ctrl + a , then [
press Spacebar to start selection
press Spacebar to stop selection
goto another tab in screen
ctrl +a , then ]
this will paste
9) use kitty
10) in vim , press :shell to goto shell and execute