diff --git a/startup_hooks/login b/startup_hooks/login index ce8a889..953be43 100644 --- a/startup_hooks/login +++ b/startup_hooks/login @@ -1,37 +1,48 @@ -set login_sourced +if( ! $?CSHENV_LOGIN_SOURCED ) then + setenv CSHENV_LOGIN_SOURCED + + if( $?CSHENV_DEBUG ) then + echo "Starting login..." + endif + + if( ! $?CSHENV_DIR ) then + setenv CSHENV_DIR ~/cshenv + endif + + if( $?CSHENV_DEBUG ) then + echo "Set CSHENV_DIR to: " ${CSHENV_DIR} + endif + + #echo "Under: " $_ + #echo "Zero: " $0 + + #if( -n "${_}" ) then + # echo $0 + # setenv CSHENV_LOGIN_PATH $0 + #else + # echo ${_}:1 + # setenv CSHENV_LOGIN_PATH "${_}:1" + #else + #endif + + #echo login hook lives at: ${CSHENV_LOGIN_PATH} + + + setenv LC_NUMERIC en_US.UTF-8 + setenv LC_MEASUREMENT en_US.UTF-8 + setenv LC_MONETARY en_US.UTF-8 + setenv LC_TIME en_US.UTF-8 + + if( $?CSHENV_DEBUG ) then + echo "Ending login..." + endif + + # Chain off to tcshrc, afterwards, if login hasn't been sourced + source ${CSHENV_DIR}/startup_hooks/tcshrc -if( $?CSHENV_DEBUG ) then - echo "Starting login..." endif -#if( ! $?CSHENV_DIR ) then - #setenv CSHENV_DIR ~/proj/cshenv -#endif - -#echo "Under: " $_ -#echo "Zero: " $0 - -#if( -n "${_}" ) then -# echo $0 -# setenv CSHENV_LOGIN_PATH $0 -#else -# echo ${_}:1 -# setenv CSHENV_LOGIN_PATH "${_}:1" -#else -#endif - -#echo login hook lives at: ${CSHENV_LOGIN_PATH} - - -if( $?CSHENV_DEBUG ) then - echo "Ending login..." -endif ########################### # vim: ft=tcsh ########################### - -setenv LC_NUMERIC en_US.UTF-8 -setenv LC_MEASUREMENT en_US.UTF-8 -setenv LC_MONETARY en_US.UTF-8 -setenv LC_TIME en_US.UTF-8 diff --git a/startup_hooks/tcshrc b/startup_hooks/tcshrc index 2f4aab1..aa41a71 100644 --- a/startup_hooks/tcshrc +++ b/startup_hooks/tcshrc @@ -1,41 +1,37 @@ -set tcshrc_sourced +# Only take this file in, if LOGIN is sourced. LOGIN will be sourced +# first, therefore, and will chain off to this. +if( $?CSHENV_LOGIN_SOURCED && ! $?CSHENV_TCSHRC_SOURCED ) then -if( $?CSHENV_DEBUG ) then - echo "Starting tcshrc..." -endif + set CSHENV_TCSHRC_SOURCED -if( ! $?CSHENV_DIR ) then - setenv CSHENV_DIR ~/proj/cshenv -endif + if( $?CSHENV_DEBUG ) then + echo "Starting tcshrc..." + endif -if( $?CSHENV_DEBUG ) then - echo "Setup CSHENV_DIR to: " ${CSHENV_DIR} -endif + #if( -z ${_} ) then + #echo $0 + #setenv CSHENV_TCSHRC_PATH $0 + #else + #echo ${_} + #setenv CSHENV_TCSHRC_PATH "${_}" + #endif -#if( -z ${_} ) then - #echo $0 - #setenv CSHENV_TCSHRC_PATH $0 -#else - #echo ${_} - #setenv CSHENV_TCSHRC_PATH "${_}" -#endif + #echo tcshrc hook lives at: ${CSHENV_TCSHRC_PATH} -#echo tcshrc hook lives at: ${CSHENV_TCSHRC_PATH} + if( -c `tty` ) then + if( $?CSHENV_DEBUG ) then + echo "Going to source core tcshrc..." + endif + source ${CSHENV_DIR}/tcshrc + endif -if( -c `tty` ) then - if( $?CSHENV_DEBUG ) then - echo "Going to source core tcshrc..." - endif - source ${CSHENV_DIR}/tcshrc -endif + # Not using tcshrc bits for non-login shells. Will decide what to do later. -# Not using tcshrc bits for non-login shells. Will decide what to do later. - -if( $?CSHENV_DEBUG ) then - echo "Ending tcshrc..." + if( $?CSHENV_DEBUG ) then + echo "Ending tcshrc..." + endif endif ########################### # vim: ft=tcsh ########################### - diff --git a/tcshrc b/tcshrc index 83bdfbe..4bda0ad 100644 --- a/tcshrc +++ b/tcshrc @@ -35,7 +35,7 @@ if( $?CSHENV_DEBUG ) then endif - +bindkey -v #The history size for your shell can be set globally now @@ -53,6 +53,9 @@ if( $?CSHENV_DEBUG ) then echo "Tcsh safe-source alias constructed..." endif + +safe_source ${CSHENV_DIR}/tcshrc.conf + # Dispatch to find out what our OS is and any fixups # This will figure out what system we're on and setup all # system specific notions. From the sourced file, @@ -63,15 +66,34 @@ endif source ${CSHENV_DIR}/tcshrc.system if( $?CSHENV_DEBUG ) then - echo "Trying to source tcshrc.alias" + echo "Trying to source tcshrc.aliases" endif -source ${CSHENV_DIR}/tcshrc.alias +source ${CSHENV_DIR}/tcshrc.aliases if( $?CSHENV_DEBUG ) then echo "Trying to source tcshrc.prompt" endif source ${CSHENV_DIR}/tcshrc.prompt +if( $?CSHENV_DEBUG ) then + echo "Trying to source tcshrc.bindkeys" +endif +source ${CSHENV_DIR}/tcshrc.bindkeys + +if( $?CSHENV_DEBUG ) then + echo "Trying to source tcshrc.${CSHENV_SYSTEM}" +endif +safe_source ${CSHENV_DIR}/tcshrc.${CSHENV_SYSTEM} + +if( $?CSHENV_DEBUG ) then + echo "Trying to source tcshrc.${CSHENV_HOSTNAME}" +endif +safe_source ${CSHENV_DIR}/tcshrc.${CSHENV_HOSTNAME} + +if( $?CSHENV_ORGANIZATION ) then + safe_source ${CSHENV_DIR}/tcshrc.${CSHENV_ORGANIZATION} +endif + ########################### # vim: ft=tcsh ########################### diff --git a/tcshrc.alias b/tcshrc.alias deleted file mode 100644 index e69de29..0000000 diff --git a/tcshrc.aliases b/tcshrc.aliases new file mode 100644 index 0000000..d87fdb5 --- /dev/null +++ b/tcshrc.aliases @@ -0,0 +1,69 @@ +#Classic UNIXy aliases + +#Dir motion +alias pd pushd +alias pu pushd +alias po popd + +#Standard ls aliases that I use: +alias ll l -l +alias la l -a +alias li l -i + +#standard long ls aliases that I use +alias llh l -lh +alias lli ll -i +alias llhi llh -i +alias llih llhi + +#{I derive lla from ll, not la, because it's a long ls, similarly for llA} +alias lla ll -a +alias lla ll -A + +alias llha llh -a +alias llah llha + +alias llhia llhi -a +alias llahi llhia +alias lliah llahi +alias lliha llahi +alias llaih llahi +alias llhai llahi + +alias lt l -t +alias llt ll -t + +#alias mkdir mkdir -p +alias md mkdir +alias rd rmdir + +alias . pwd + +#Job control aliases TODO: Update these for arguments + +alias , jobs +alias = "%&" +alias + "%%" +alias - stop + + +#More specific aliases + +alias show set + +alias lh l -sh + +# Detect and activate vim, if present +if( -f `which vim` ) then + alias vi vim + setenv EDITOR vim + setenv VISUAL vim +endif + +safe_source ${CSHENV_DIR}/tcshrc.aliases.${CSHENV_SYSTEM} +safe_source ${CSHENV_DIR}/tcshrc.aliases.${CSHENV_HOSTNAME} +safe_source ${CSHENV_DIR}/tcshrc.aliases.user + +########################### +# vim:filetype=tcsh +########################### diff --git a/tcshrc.bindkeys b/tcshrc.bindkeys new file mode 100644 index 0000000..f047f9c --- /dev/null +++ b/tcshrc.bindkeys @@ -0,0 +1,17 @@ +############################ +### TCSH Bindkey scripts ### +############################ + +## Vi keybindings by default +bindkey -v + +if( $?CSHENV_BINDKEY_CHOICE ) then + bindkey $CSHENV_BINDKEY_CHOICE +endif + + +bindkey ^G list-choices + +########################### +# vim:filetype=tcsh +########################### diff --git a/tcshrc.prompt.colors b/tcshrc.prompt.colors index d0c71a9..faa6bb9 100644 --- a/tcshrc.prompt.colors +++ b/tcshrc.prompt.colors @@ -35,6 +35,8 @@ set depth_color_seq="${color_start}${depth_color}${color_end}" set command_color_seq="${color_start}${command_color}${color_end}" +set oldp_color="${color_start}${dim_white}${color_end}" + ########################### # vim:filetype=tcsh ########################### diff --git a/tcshrc.prompt.defs b/tcshrc.prompt.defs index e69de29..434edb3 100644 --- a/tcshrc.prompt.defs +++ b/tcshrc.prompt.defs @@ -0,0 +1,138 @@ +########################## +### PROMPT DEFINITIONS ### +########################## + +if( $?CSHENV_DEBUG ) then + echo "Sourcing prompt setup and definitions..." +endif + + +if( $?CSHENV_DEBUG ) then + echo "Trying to fix tty bug" +endif + +if( ! $?unknown_tty ) then + set unknown_tty="?" + if( $?CSHENV_DEBUG ) then + echo "Unknown tty set..." + endif +endif + +setenv CSHENV_CACHE_DIR ~/.tcsh_cache + +set promptchars='%#' + +set default_screen_offset_count=80 + +set prompt_simple="${oldp_color_seq}[%n@%m: %c]%# " + + +switch( $CSHENV_SYSTEM ) + + # All BSD derived systems (and actually most non-GNU tools) have the 6th entry for stty being columns + case Darwin: + #FALLTHROUGH + + # TODO: Figure out a collapse? + #case *BSD: #Is this legal in CSH? + #FALLTHROUGH + + case FreeBSD: + #FALLTHROUGH + + case NetBSD: + #FALLTHROUGH + + case OpenBSD: + if( $?CSHENV_DEBUG ) then + echo "Using BSDish stty for width" + endif + set screen_offset_count=`stty -a | head -1 | awk '{print $6}' | sed -e "s/;//g"` + breaksw + + + + # Linux breaks the typical behavior, and makes the 7th entry be stty + case Cygwin: + case Linux: + if( $?CSHENV_DEBUG ) then + echo "Linux prompt width for stty blows..." + endif + #Some cshes don't like the split line here! + set screen_offset_count=`stty -a | head -1 | sed -e 's/;//g' | awk '{print $7}' | sed -e 's/;//g'` + breaksw + + default: + #We don't know how to handle this case. Just use a guessed + #value of 80, since we cannot tell. + set screen_offset_count=$default_screen_offset_count + echo "Using a default screen offset value" + breaksw + +endsw + +if( $?CSHENV_DEBUG ) then + echo "Screen offset computed to be: ${screen_offset_count}" +endif + +set screen_width=$screen_offset_count +#echo $screen_offset_count +@ screen_offset_count = $screen_offset_count - 18 +#echo "A" + +set screen_offset="" +set n="1" + + +if ( ! -d $CSHENV_CACHE_DIR ) then + mkdir $CSHENVTCSH_CACHE_DIR +endif +#echo $screen_offset_count +if ( -f ${CSHENV_CACHE_DIR}/screen.$screen_width ) then + source ${CSHENV_CACHE_DIR}/screen.$screen_width +else + while ( ${n} < ${screen_offset_count} ) + set screen_offset="${screen_offset} " + @ n = ($n + 1) + end + echo "set screen_offset='${screen_offset}'" > ${CSHENV_CACHE_DIR}/screen.${screen_width} + #echo "Make a manual cache entry for screen width." +endif + + +set date_prompt_core="${date_color_seq}%Y-%W-%D ${time_color_seq}%P" +set date_prompt_left="${date_prompt_core}" +set date_prompt="${screen_offset}${date_prompt_core}" +#unset edit + +if( $?CSHENV_DEBUG ) then + echo "Building Cool prompt" +endif + + +set depth_prompt=" ${depth_color_seq}(${shlvl})" +if( $?CSHENV_HIDE_SHELL_LEVEL_AT_ONE ) then + if( $shlvl == 1 ) then + set depth_prompt="" + endif +endif + +#we "convert" pts/$number entries to ttypK entries? +set line_prompt="${line_color_seq}`tty | sed -e 's;/dev/tty;;' -e 's;/dev/pts/;p/;' -e 's;/dev/;;' -e 's/not a tty/${unknown_tty}/'`" +set user_prompt="${name_color_seq}%n" +set host_prompt="${host_color_seq}${CSHENV_HOSTNAME}" +set path_prompt="${path_color_seq}%c02" +set end_prompt="${prompt_color_seq}%#${command_color_seq} " + + +set prompt_cool="${date_prompt}${text_color_seq}%L${brace_color_seq}\[${line_prompt}${depth_prompt}${text_color_seq}\- ${user_prompt}${at_color_seq}@${host_prompt}${text_color_seq}\: ${path_prompt}${brace_color_seq}\]${end_prompt}" + +if( ! ${?cshenv_user_prompt_override} ) then + set prompt="$prompt_cool" +endif +alias oldp 'set prompt="$prompt_simple"; set cshenv_user_prompt_override' +alias newp 'set prompt="$prompt_cool"; set cshenv_user_prompt_override' + +########################### +# vim:filetype=tcsh +########################### diff --git a/vim/vimrc b/vim/vimrc new file mode 100644 index 0000000..ed5c683 --- /dev/null +++ b/vim/vimrc @@ -0,0 +1,24 @@ +"ADAM David Alan Martin's updated vimrc +"source ~/.vim/default.vim + +"setf oopcpp + +source ~/.vim/vimrc.colors + +source ~/.vim/vimrc.globalprefs + + +source ~/.vim/vimrc.defkeymaps + + +source ~/.vim/vimrc.keymaps + +source ~/.vim/vimrc.functions + +source ~/.vim/vimrc.fileprefs +source ~/.vim/vimrc.syntaxcolors +source ~/.vim/vimrc.statusline + +"compiler msvc +"set makeprg=wmake +"set errorformat=\ %#%f(%l\\\,%c):\ %m diff --git a/vim/vimrc.colors b/vim/vimrc.colors new file mode 100644 index 0000000..0e42093 --- /dev/null +++ b/vim/vimrc.colors @@ -0,0 +1,21 @@ +" Vim status line colors +" hi User0 ctermfg=black ctermbg=white cterm=bold +" hi User1 ctermfg=red ctermbg=white cterm=bold +" hi User2 ctermfg=darkmagenta ctermbg=white cterm=bold +" hi User3 ctermfg=blue ctermbg=white cterm=bold +" hi User4 ctermfg=cyan ctermbg=white cterm=bold +" hi User5 ctermfg=darkyellow ctermbg=white cterm=bold +" hi User6 ctermfg=darkgreen ctermbg=white cterm=bold +" hi User8 ctermfg=magenta ctermbg=black cterm=bold +" hi User9 ctermfg=white ctermbg=black cterm=bold + +"hi User0 ctermfg=green ctermbg=green term=bold +hi statusline ctermfg=lightgrey ctermbg=black +hi User1 ctermfg=red ctermbg=white term=standout +hi User2 ctermfg=darkmagenta ctermbg=white term=standout +hi User3 ctermfg=blue ctermbg=white term=standout +hi User4 ctermfg=cyan ctermbg=white term=standout +hi User5 ctermfg=brown ctermbg=white term=standout +hi User6 ctermfg=darkgreen ctermbg=white term=standout +hi User8 ctermfg=magenta ctermbg=black term=bold +hi User9 ctermfg=white ctermbg=black term=bold diff --git a/vim/vimrc.defkeymaps b/vim/vimrc.defkeymaps new file mode 100644 index 0000000..d167eb2 --- /dev/null +++ b/vim/vimrc.defkeymaps @@ -0,0 +1,38 @@ +" Key Mappings +map +map + +" "insert" +map [2~ i +map [2~ + +" "home" +map [1~ ^ +map [1~ 0 +map [1~ + +" "pgup" +map [5~ +map [5~ + +" "delete" +map [3~ x +map [3~ +" "end" +map [4~ $ +map [4~ + +" "pgdn" +map [6~ +map [6~ + +" "UP", "Down", "LEFT", and "RIGHT" arrow keys +map [A +map [B +map [C +map [D + +imap [A +imap [B +imap [C +imap [D diff --git a/vim/vimrc.fileprefs b/vim/vimrc.fileprefs new file mode 100644 index 0000000..ee03f5d --- /dev/null +++ b/vim/vimrc.fileprefs @@ -0,0 +1,27 @@ +"au BufNewFile,BufRead *.i,*.l setf c +au BufNewFile,BufRead mk* setf make +"au BufNewFile,BufRead *.slogo setf c +au BufNewFile,BufRead *.tex map _ {!}fmt -p -s -w 70 +au BufNewFile,BufRead *.tex set textwidth=78 +au BufNewFile,BufRead *.java set tabstop=4 +au BufNewFile,BufRead *.java set shiftwidth=4 +au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h setf cpp + +" Alephaish +au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set sw=4 +au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set ts=4 +au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set noet + +au BufNewFile,BufRead */cshenv/tcshrc.* setf tcsh + +" falcish +"au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set ts=3 +"au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set sts=3 +"au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set sw=3 +"au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set et + +au FileType * setlocal formatoptions=tcq + +if has("syntax") + syntax on +endif diff --git a/vim/vimrc.functions b/vim/vimrc.functions new file mode 100644 index 0000000..54c1329 --- /dev/null +++ b/vim/vimrc.functions @@ -0,0 +1,17 @@ +function! MyFoldText() + + " This function attempts to fetch out a definition line + " for correct foldtext + + let line = getline( v:foldstart ) + let typeline = getline( 1 + v:foldstart ) + let defline = " ".getline( 2 + v:foldstart )." {".typeline."} " + let sub = substitute( line, '/\*\|\*/\|{{{\d\=', '', 'g' ) + let nm= substitute( sub, ' *\| *', '', 'g' ) + + if ( nm == "func" ) + return v:folddashes . defline + else + return v:folddashes . sub + endif +endfunction diff --git a/vim/vimrc.globalprefs b/vim/vimrc.globalprefs new file mode 100644 index 0000000..392ba26 --- /dev/null +++ b/vim/vimrc.globalprefs @@ -0,0 +1,43 @@ +"Color settings +set background=dark + +"Smart indentation settings +set noautoindent +set nosmartindent +set nocindent +set indentexpr= + +"Global editor settings +set tabstop=4 +set shiftwidth=4 +set sts=4 +set sta +set expandtab +set showmatch +let loaded_matchparen= 1 +set textwidth=200 + +"Environment look-and-feel settings +set showmode +set statusline=%1*[%02n]%8*Pos:\ %4*%3l/%3L%8*,\ %2*%c%2V%8*\ %5*@%8*\ %6*%P\ %8*File:\ %3*%-08.24f%8*%=%4*%(\ (%M%R%H)%)%=%9*\ASCII=%03b\ HEX=%02B%8* +set laststatus=2 + +"set ruler + + +set path=.,$VIM_PATH,, +set foldmethod=marker +set foldtext=MyFoldText() +set nohlsearch + +set mouse=a + +set modeline +set modelines=16 + +"Wildcard expansion menu from command-colon line +set wildmenu + +if &term =~ "rxvt" + set t_Co=16 +endif diff --git a/vim/vimrc.keymaps b/vim/vimrc.keymaps new file mode 100644 index 0000000..0092843 --- /dev/null +++ b/vim/vimrc.keymaps @@ -0,0 +1,10 @@ +"Adam Keymaps +map _ {!}fmt -p -s -w 78 + +map - ddkP +map + ddp + +"Properly map Y to yank to end of line, instead of yank line. +map Y y$ + +map zz zM diff --git a/vim/vimrc.statusline b/vim/vimrc.statusline new file mode 100644 index 0000000..1ef5ddf --- /dev/null +++ b/vim/vimrc.statusline @@ -0,0 +1,51 @@ +function! GetYearGlyph() + " TODO Write a full parser which adjusts for some "second centry" + " point generates: + " 00 - 09 as \`0 - \`9 + " 10 - 19 as \'0 - \'9 + " 20 - 29 as \"0 - \"9 + " 30 - 39 as \^0 - \^9 + " 40 - 49 as \~0 - \~9 + " 50 - 59 as \*0 - \*9 + " return %{strftime('%y')}[1] + + let year= strftime('%Y') + let decade= year / 10 % 10 + let glyph= + \ ( year % 1000 ) > 100 ? decade : + \ decade == 0 ? "`" : + \ decade == 1 ? "'" : + \ decade == 2 ? '"' : + \ decade == 3 ? "^" : + \ decade == 4 ? "~" : + \ decade == 4 ? "~" : + \ decade == 5 ? "+" : + \ decade == 6 ? "*" : + \ decade == 7 ? "/" : + \ decade == 7 ? "%" : + \ decade == 7 ? "&" : + \ "?" + + let year= year % 10 + + return glyph . year +endfunction + +" This is a rebuild of the original vim status line. I'll put the original +" one here from globalprefs. We also have to get vim to reset its environment +" when I start. + + +set statusline= " reset the status line, for ADAM's colorful status line +set statusline+=%1*[%02.03n]%0* " max/min for buf #, in [] +set statusline+=Pos:\ %4*%3l/%3L%0* " Pos: '.'/'$', +set statusline+=\ %2*%c%2V%0* " Column # and tab detect +set statusline+=\ %5*@%0* " Colored @ for percent +set statusline+=\ %6*%P%0* " Percent thru file +set statusline+=\ File:\ %3*%<%-f%0* " File: Path left trim and align +set statusline+=%4*%(\ (%M%R%H)%)%0* " File editing mode (+/-,RO,HLP) +set statusline+=%= " Divider between left & right align +set statusline+=\ %9*X=%02B " Current char byte val in hex + +"Lastly put the time in classic Magenta, like my TCSH prompt: +set statusline+=\ %8*%{GetYearGlyph()}-%{strftime('%m-%d\ %H:%M')} diff --git a/vim/vimrc.syntaxcolors b/vim/vimrc.syntaxcolors new file mode 100644 index 0000000..1e8cb3c --- /dev/null +++ b/vim/vimrc.syntaxcolors @@ -0,0 +1,24 @@ +"hi PreProc ctermfg=green +hi Comment ctermfg=darkgrey cterm=bold +hi Identifier ctermfg=cyan +hi Object ctermfg=red +hi Exception ctermfg=brown +hi Error ctermbg=red ctermfg=white cterm=bold +hi Caller ctermfg=cyan +hi Target ctermfg=green ctermbg=red +hi Sync ctermfg=green ctermbg=red +hi Debug ctermfg=darkgreen +hi Type ctermfg=lightgreen +hi CommentSpecial ctermfg=Magenta guifg=Magenta +hi SpecialComment ctermfg=Magenta guifg=Magenta +hi doxygenSpecial ctermfg=Magenta guifg=Magenta +hi doxygenCommentSpecial ctermfg=Magenta guifg=Magenta +hi doxygenBriefSpecial ctermfg=Magenta guifg=Magenta +hi doxygenBrief ctermfg=cyan +hi doxygenComment ctermfg=Blue guifg=Blue +"hi doxygenSpecialTypeOnelineDesc cterm=bold ctermfg=LightMagenta guifg=firebrick3 gui=bold +"hi doxygenParam ctermfg=cyan +"hi doxygenOther ctermfg=cyan +hi doxygenBody ctermfg=cyan +hi doxygenSpecialMultilineDesc ctermfg=cyan +hi NamedConstant ctermfg=lightblue