2017/01/01
Started with a a very plain but working fluxbox setup.
logon to the new user account
$ mkdir bin src tmp sbo pkg vb
vb - virtualbox share directory, shared with host linux
Create $HOME/.bash_profile file. This simple profile check for a home bin directory and adds it to your PATH if it exists. It also sources the .bashrc file to pickup bash prompts and aliases.
# add home bin to PATH
if [ -d $HOME/bin ]
then
PATH="$HOME/bin:$PATH"
fi
# source home bashrc file
if [ -f $HOME/.bashrc ]
then
. $HOME/.bashrc
fi
Create $HOME/.basrc file. Create a fancy coloured prompt and a few useful aliases. Did I mention I love awk.
#
# fancy Prompt
function fancy_path()
{
pwd | gawk -F '/' '
p2=$(NF-2)
p1=$(NF-1)
p0=$(NF)
if(NF == 2) {
if(p1 == "")
printf("/%s\n", p0)
else
printf("%s/%s\n", p1, p0)
} else {
if(p2 != "")
printf(".../%s/%s\n", p1, p0)
else
printf("/%s/%s\n", p1, p0)
}
}'
}
# 30=black, 31=red 32=green 33=yellow 34 = blue 35=magenta 36=cyan 37=white
PS1='\[\033[01;32m\][slack] \[\033[01;34m\]$(fancy_path) \$\[\033[00m\] '
alias ls="ls --color"
alias ll="ls -oh"
alias la="ls -a"
alias lla="ls -al"
alias vi="vim"
alias down="cd $HOME/Downloads"
'
$ su -
# visudo
-Uuncomment the wheel line
#%wheel ALL=(ALL) ALL
-Added line for longer timeout
Defaults timestamp_timeout=180
If you did not add your user account to the wheel group when you created the user you need to do it now with the "gpasswd" command
$ gpasswd -a john wheel
I like the Inconsolata font. It is monospaced and has a real zero with a stroke thru it so you do not see it as a capital letter O. I also like the Droid Sans mono font and it supports many more unicode symbols including the APL characters. How could you live without a bit of APL!!
Download the fonts. Unzip and move DroidSansMono.ttf and the Inconsolata-Regular.ttf file into $HOME/.fonts directory
$ cd $HOME/.fonts
$ mkfontdir
$ mkfontscale
$ sudo fc-cache -f -v
Not sure if you need this but, exit and restart X
I wanted a terminal that supports unicode just incase I break into a fit of APL programming. urxvt seems to be the non-VTE based terminal of choice. This took a lot longer than I expected.
Download and install the slackbuild for unicode terminal application: https://slackbuilds.org/repository/14.2/system/rxvt-unicode/
Out of the box
I decide to use readline library configuration. (technically it is not really the readline lib, there is a copy of the readline lib embedded into bash at compile time). The out-of-the-box readline configuration is setup for the linux console and xterm applications. To fix things we need to add the
I ran the "od -c" command and noted that Home sends
Edit /etc/inputrc to include these codes.
# /etc/inputrc
# This file configures keyboard input for programs using readline.
# See "man 3 readline" for more examples.
# Configure the system bell. Options are none, visible, and audible.
#set bell-style none
# Enable 8 bit input.
set meta-flag On
set input-meta On
set convert-meta Off
set output-meta On
# Set various nice escape sequences:
"\eOd": backward-word
"\eOc": forward-word
# for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
# for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
# for rxvt and urxvt.... ADD THESE TWO LINES
"\e[7~": beginning-of-line
"\e[8~": end-of-line
Edit the .Xresource file to suit your prefered colours. I found one on the net and edited it a bit using the www.colorpicker.com site.
!! 2016/12/14
!! *background: rgb:1a/1a/1a
!! *background: rgb:12/12/12
!! *foreground: rgb:f0/f0/f0
*background: rgb:00/00/00
*foreground: rgb:f5/f5/f5
!! *fadeColor: S_base3
!! *cursorColor: S_base01
!! *pointerColorBackground:S_base1
!! *pointerColorForeground:S_base01
!! black dark/light
*color0: rgb:00/00/00
*color8: rgb:66/66/66
!! red dark/light
*color1: rgb:9e/18/28
*color9: rgb:f0/37/4c
!! green dark/light
*color2: rgb:00/88/00
*color10: rgb:61/a1/71
!! yellow dark/light
*color3: rgb:d2/bb/4b
*color11: rgb:e7/db/52
!! blue dark/light
*color4: rgb:1a/62/91
*color12: rgb:26/8d/d2
!! magenta dark/light
*color5: rgb:96/3c/59
*color13: rgb:a9/3c/59
!! cyan dark/light
*color6: rgb:41/81/79
*color14: rgb:6d/a4/a4
!! white dark/light
*color7: rgb:be/be/be
*color15: rgb:ff/ff/ff
Bash uses a few terminal screen control functions to wrap lines when they get to long. To find the right escape sequences for your terminal type it uses the TERM environment variable to look up screen control in the /etc/termcap file. When urxvt runs it sets the TERM variable to rxvt-unicode-256color.
urxvt installed a terminfo file for itself but did not include a termcap entry. Without the termcap entry for "rxvt-unicode-256color" bash will scroll horizontally when you have long command lines. I am not a fan of horizontal scrolling.
We need to add the urxvt entry to termcap.
.
$ cd /usr/share/terminfo/r directory
$ infocmp -C rxvt-unicode-256color
# Reconstructed via infocmp from file: /usr/share/terminfo/r/rxvt-unicode-256color
# (untranslatable capabilities removed to fit entry within 1023 bytes)
# (sgr removed to fit entry within 1023 bytes)
# (acsc removed to fit entry within 1023 bytes)
# (terminfo-only capabilities suppressed to fit entry within 1023 bytes)
# (some function-key capabilities suppressed to fit entry within 1023 bytes)
rxvt-unicode-256color|rxvt-unicode terminal with 256 colors (X Window System):\
:am:bw:eo:hs:km:mi:ms:xn:xo:\
:co#80:it#8:li#24:lm#0:\
:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
:K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\
:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ae=\E(B:al=\E[L:\
:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\
:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\
:dl=\E[M:do=^J:ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:\
:ho=\E[H:i1=\E[!p:ic=\E[@:im=\E[4h:\
:is=\E[r\E[m\E[2J\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l:\
:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\
:k6=\E[17~:k7=\E[18~:k8=\E[19~:kD=\E[3~:kI=\E[2~:kN=\E[6~:\
:kP=\E[5~:kb=\177:kd=\E[B:ke=\E>:kh=\E[7~:kl=\E[D:kr=\E[C:\
:ks=\E=:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:\
:nd=\E[C:rc=\E8:sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:\
:st=\EH:ta=^I:te=\E[r\E[?1049l:ti=\E[?1049h:ts=\E]2;:\
:ue=\E[24m:up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l:\
:ve=\E[?12l\E[?25h:vi=\E[?25l:vs=\E[?12;25h:
Since we already installed the cool Droid fonts, setting up the font is fairly simple. You can either set it via the command line
urxvt -fn "xft:DroidSansMono:pixelsize=15"
or set it via the .Xresouces file
URxvt.font: xft:DroidSansMono:pixelsize=15
or set it via a shell script
#!/bin/bash
#
# 2016/12/13 created
# 2017/01/01 changed font to Droid
#
urxvt -fn "xft:DroidSansMono:pixelsize=15" -geometry 86x42+10+10 -sl 6000 &
# urxvt -fn "xft:DroidSansMono:pixelsize=15" -geometry 86x46+10+10 -sl 6000 &
# urxvt -fn "xft:Inconsolata-Regular:pixelsize=16" -geometry 86x46+10+10 -sl 6000 &
# urxvt -fn "xft:Terminus:pixelsize=17" -geometry 82x46+10+10 -sl 6000 &
# urxvt -fn "xft:Terminus:pixelsize=17" -geometry 86x46+10+10 -sl 6000 &
Slight detour..... I wanted a key to pop up the fluxbox "right click" menu so decide to use the "menu" key to do this. This is nice when you have something open full screen and can not click on the desktop.
Added one line to the $HOME/.fluxbox/menu file
Menu :RootMenu
Create .vimrc to suit your desires.
"
" 2014/02/19 created
" ------------------------------------------------------------
" SECTION ONE -- Options
" ------------------------------------------------------------
" vim not vi
set nocompatible
set mouse=a
" search case
" all-lowercase string your search will be case-insensitive
" any characters in uppercase the search will be case-sensitive
set ignorecase
set smartcase
" highlight search results (as you type)
" <leader><space> mapping makes it easy to hide search results
" This gets rid of the distracting highlighting once you done with it
set incsearch
set showmatch
set hlsearch
nnoremap <leader><space> :nohlsearch<cr>
" just the 81st column of wide lines
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)
" expand tab to 4 spaces
" .....use :retab to fix up old files
" use tabs in makefiles, no expandtab
set tabstop=4
set shiftwidth=4
set expandtab
autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=0
" always have an extra line on bottom and top
set scrolloff=1
" allow dirty buffers to be hidden
set hidden
" hidden characters tabs, spaces, eol
exec "set listchars=tab:\ubb\ubb,eol:\ub6,trail:\ub7"
" ------------------------------------------------------------
" SECTION TWO -- Functions
" ------------------------------------------------------------
function! Tognums()
" tri-toggle number,relativenumber, and list
if &number
set nonumber
set norelativenumber
set nolist
elseif &relativenumber
set number
set norelativenumber
set list
else
set nonumber
set relativenumber
set list
endif
endfunction
" ------------------------------------------------------------
" SECTION THREE -- Key Mappings
" ------------------------------------------------------------
" FEW KEY ADJUSTMENTS
" extra escape key
inoremap jj <ESC>
" extra eol
nnoremap \\ $
" make colon commands easier
nnoremap ; :
vnoremap ; :
" MISC SHORTCUTS
" n=numbers and show hidden chars
" s=spell
" c=C comment
" c=shell comment
nnoremap <leader>n :call Tognums()<CR>
nnoremap <leader>s :set spell!<CR>
nnoremap <leader>c <ESC>0i// <ESC><CR>
nnoremap <leader>C <ESC>0i# <ESC><CR>
" using register f for quick macros and shortcuts \f
" usually record quick macros into reg f .... qf<keystrokes>q
nnoremap <leader>f @f
" buffer shortcuts
nnoremap <leader>b :bn<cr>
nnoremap <leader>w <c-w><c-w>
" FUNCTION KEY STUFF
" f2 to paste clipboard and add CR (and control-v)
nmap <c-v> "+gP
nmap <F2> "+gPA<CR><ESC>
imap <F2> <ESC>"+gPA<CR><ESC>
"
" f3 insert todays date
nnoremap <F3> "=strftime("%Y/%m/%d ")<CR>P
inoremap <F3> <C-R>=strftime("%Y/%m/%d")<CR>
"
" markdown underlines
nmap <F4> 0yypv$r=
nmap <F5> 0yypv$r-
"
" reformt paragraph
" this is pretty stupid and should be fixed
nmap <F6> mZ{V}gq`Z
"
Created script to mount the VirtualBox shared directory
#!/bin/bash
#
# 2016/12/11 copied from another VM
#
VBDIR="$HOME"/vb
sudo mount -t vboxsf vbshare $VBDIR
Download and install sbopkg from www.sbopkg.org