Showing posts with label unix screen. Show all posts
Showing posts with label unix screen. Show all posts

Tuesday, June 11, 2013

Custom regions in Unix screen

My preferred Unix screen layout looks like this:

##########################
#                 #      #
#                 #      #
#                 ########
#                 #      #
#                 #      #
#                 ########
#                 #      #
#                 #      #
##########################


These are the .screenrc settings required:

# region 0 (width = max - 80; height = max)
screen -t 'LARGE LEFT REGION'
split -v

# region 1 (width = 80; height = max / 3)
focus
resize 80
screen -t 'RIGHT COLUMN: UPPER SCREEN'

# region 2 (width = 80; height = max / 3)
split
focus
screen -t 'RIGHT COLUMN: MIDDLE SCREEN'

# region 3 (width = 80; height = max / 3)
split
focus
screen -t 'RIGHT COLUMN: LOWER SCREEN'

Harmonizing .bashrc with .profile to make Unix screen happy

Unix screen doesn't read your .profile on startup. So aliases like ...

alias vi="vim"                                 
alias cdd="cd ~/Documents"
alias cdk="cd ~/Desktop"

... resident in your .profile won't available to you after starting screen.

If you already have a .bashrc then just copy parts of your .profile into your .bashrc. And if you don't have a .bashrc then use ...

ln -sf .profile .bashrc 

... to symlink your .bashrc to your .profile.

Monday, June 10, 2013

(Re)compiling screen from source

Older versions of the UNIX screen program can't split windows vertically.

Do the following to compile screen from source:

$ git clone git://git.savannah.gnu.org/screen.git screen
$ cd screen/src
$ ./autogen.sh
$ ./configure
$ ./config.status
$ make
$ sudo make install
$ screen --version

The screen/src/INSTALL file is chatty. But it explains the steps listed here.

Tuesday, April 22, 2008

Configuring UNIX screen

Working with Víctor this morning. Getting UNIX screen set up on the project server. UNIX screen is notoriously difficult to set up and outstanding useful once you do. Happily, our session this morning went smoothly. We followed the six steps in Phil Hollenback's linux.com article here and only had to insert one additional step, for a total of seven. What worked for us:


1. Set the screen binary userid bit to true. Our starting conditions showed that the groupid bit was set to true on the screen binary upon installation but that the userid bit (in the first triplet of permissions settings) was not. So we were required to go through this first step.

2. Set the permissions on the /var/usr/screen directory to 755. Hollenback doesn't list this step in his article so we had to insert it here. But it was relatively easy to figure out because screen barked. The only unusual thing here is that /var/usr/screen was setting to the more-liberal 775 immediately after installation. Which means that by resetting permissions to 755 we actually restricted the directory's access further. But it did work. Everything else is easy.

3. First user starts a session. Example: Víctor runs screen -S Abjad

4. First user turns multiuser mode on: Víctor runs ctrl-A :multiuser on

5. First user adds second user: Víctor types ctrl-A :acladd tbaca

6. Second user attaches to first user's screen session: Trevor types screen -x vadan/Abjad


That's it. Extremely useful.

Gene's .vimrc and .screenrc

"What're you using for .vimrc and .screenrc?"

Then email:

filetype indent on
filetype plugin on
colorscheme evening
"colorscheme default
source ~/.vim/WordLength.vim
syntax on
set mouse=a
set printoptions=paper:letter,duplex:off,collate:n,syntax:n
set tags=~/.tags
set tabstop=3
set shiftwidth=3
set textwidth=75
set autoindent
set noignorecase
set nobackup
set noexpandtab
set clipboard=unnamed
set grepprg=grep\ -nH\ $*
set foldmethod=indent

WordLength.vim is a script Gene put together when editing a ton of SQL with fieldnames absolutely limited to 18 characters.

function! WordLength()
let saveLine = line(".")
let savePos = col(".")
execute "normal b"
let startPos = col(".")
execute "normal e"
let endPos = col(".")

if (savePos < endPos) && (savePos > startPos)
let leftCount = endPos-savePos
execute "normal " . leftCount . "h"
elseif savePos == startPos
execute "normal b"
endif

return endPos-startPos+1
endfunction
command! Wl echo WordLength()
nmap ^C :Wl^M

And in python:

set expandtab
set wrap
set textwidth=80
set wrapmargin=1

And .screenrc:

hardstatus alwayslastline "[%n: %t]%? [%u]%? %h"
vbell on
multiuser on
acladd root

Screen hardstatus niceities

Want to see which screen session you're in?

hardstatus on
hardstatus alwayslastline
hardstatus string "%{rk}%H %{gk}%c %{yk}%M%d %{wk}%?%-Lw%?%{bw}%n*%f%t%?(%u)%?%{wk}%?%+Lw%?"

From a blog here.