diff --git a/README.md b/README.md new file mode 100644 index 0000000..bb6c65c --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# README # + +These are my scripts and configuration files. I don't think they are of any use to others. But feel free to dig in and if you find something useful for you then use it :) diff --git a/config/.screenrc b/config/.screenrc new file mode 100644 index 0000000..120a194 --- /dev/null +++ b/config/.screenrc @@ -0,0 +1,2 @@ +defscrollback 10000 + diff --git a/config/.tmux.conf b/config/.tmux.conf new file mode 100644 index 0000000..b8ad2f0 --- /dev/null +++ b/config/.tmux.conf @@ -0,0 +1,29 @@ +set -g prefix C-a +bind C-a send-prefix +unbind C-b + +set-option -g history-limit 10000 + +set -g status-keys vi +setw -g mode-keys vi +set -g status-position top + +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +set -g mode-mouse off + +bind m \ + set -g mode-mouse on \;\ + set -g mouse-resize=pane on \;\ + set -g mouse-select-pane on \;\ + set -g mouse-select-window on \;\ + display 'Mouse: ON' +bind m \ + set -g mouse-resize=pane off \;\ + set -g mouse-select-pane off \;\ + set -g mouse-select-window off \;\ + display 'Mouse: OFF' + diff --git a/mg/.vimrc.local b/mg/.vimrc.local new file mode 100755 index 0000000..0b4315c --- /dev/null +++ b/mg/.vimrc.local @@ -0,0 +1,3 @@ +set expandtab +set path=.,/usr/include,/usr/include/c++/4.4.4,../,../../Isrc,../Isrc,./Isrc +set tags+=../tags,../../tags diff --git a/mg/build_and_run.csh b/mg/build_and_run.csh new file mode 100755 index 0000000..ef30bf0 --- /dev/null +++ b/mg/build_and_run.csh @@ -0,0 +1,17 @@ +#!/bin/csh + +set dwa=~/devel/mg/dwa_02_23/ic/lv/aoi-dbg/ + +if ( { rsh amy-bld-07 "cd $dwa && cglu && cd locallv && gmake calibre" } ) then +else + exit +endif +if ( { calibre -drc -hier -turbo $1 } ) then +else + exit +endif +if ( { merge.csh } ) then +else + exit +endif + diff --git a/mg/create_dwa.csh b/mg/create_dwa.csh index 281e612..c95a85b 100644 --- a/mg/create_dwa.csh +++ b/mg/create_dwa.csh @@ -1,23 +1,38 @@ #!/bin/csh -if ( $1 == '' ) then +if ( $1 == "" ) then echo 'DWA folder is not specified.' exit endif + +if ( $2 == "" ) then + echo 'VCO is not specified.' + exit +endif + +if ( $2 != "aoi" && $2 != "aoi-dbg" && $2 != "aoh" ) then + echo 'VCO is unknown.' + exit +endif + +set VVCO=$2 + +if ( $3 != "" ) then + set PRJ=$3 +else + set PRJ="" +endif + +###################### +# Create DWA +###################### mkdir -p $1 cd $1 setenv DWA `pwd` -if ( $2 != '' ) then - set VVCO=$VCO-$2 -else - set VVCO=$VCO -endif - ic_dwa -lv $IWA $DWA $VVCO -###################### cd $DWA/ic/ic_superproj/$VVCO cglu pmake mk_imports imports @@ -26,15 +41,35 @@ cd $DWA/ic/lv/$VVCO cglu cm_add_verfiles -#cd $DWA/ic/lv/$VCO-dbg/lithas/Dsrc -#cvs update build.pl - cd $DWA/ic/lv/$VVCO setenv CAL_DWA $DWA setenv CAL_IWA $IWA +###################### +# Syn project files. +###################### +if ( $PRJ == "wrap" || $PRJ == "fill" ) then + cd Dsrc/iclv + foreach i (`ls Isrc/dfm_fill*`) + cvs update `basename $i` + touch `basename $i` + end + cd - +endif + +###################### +# Run ctags. +###################### +cd Dsrc +ptags +cd - + +###################### +# Build project. +###################### pmake lcl_exec ic_create_deps +pmake systests lv_verify # # Set path after build. Otherwise tcsh doesn't find binaries. @@ -43,10 +78,7 @@ setenv MGC_HOME $DWA/ic/ic_superproj/$VVCO/Mgc_home setenv MGC_BIN $MGC_HOME/bin setenv PATH $MGC_BIN\:$PATH +#cd $DWA/ic/lv/$VCO-dbg/lithas/Dsrc +#cvs update build.pl #cd #$DWA/ic/lv/$VCO/lithas/Isrc/build.pl debug calibre -j 8 - -#cd $WA/ic/lv/$VCO -#cglu -#gmake $PB systests lv_verify -j8 -#gmake $PB systests lv_verify diff --git a/mg/create_iwa.csh b/mg/create_iwa.csh index 2a102d8..4906513 100644 --- a/mg/create_iwa.csh +++ b/mg/create_iwa.csh @@ -18,7 +18,7 @@ endif # # Check out sources. # -echo cvs checkout -r calibre_2014_3 ic/lv/src ic/ic_superproj/src +cvs checkout ic/lv/src ic/ic_superproj/src ###################### cd $IWA/ic/lv diff --git a/mg/cshrc b/mg/cshrc index f626e75..46b702d 100644 --- a/mg/cshrc +++ b/mg/cshrc @@ -1,15 +1,22 @@ # -# MG global +# Set DISPLAY if not set. +# +if ( $?DISPLAY == 0 ) then + setenv DISPLAY amy-nbaghram-lnx:1.0 +# echo "Display is set to $DISPLAY" +endif +# +# MG global # setenv VCO `/usr/mgc/bin/mgcvco` setenv MGC_SITE `domainname` switch($MGC_SITE:q) case amy.mentorg.com: - source /user/icdet/bin/detalias.arm.csh + source /wv/icdet/bin/detalias.arm.csh setenv MGLS_LICENSE_FILE 1717@amy-lic-01.amy.mentorg.com - #setenv WG_SERVER /share/ic_wg_server/CACHED_WG_SERVER - #setenv MGC_SERVER $WG_SERVER + #setenv WG_SERVER /share/ic_wg_server/CACHED_WG_SERVER + #setenv MGC_SERVER $WG_SERVER breaksw case wv.mentorg.com: source /user/icdet/bin/detalias.csh @@ -24,6 +31,7 @@ endsw setenv LM_LICENSE_FILE $MGLS_LICENSE_FILE\:1717@wv-lic-toolworks.wv.mentorg.com setenv PATH $PATH\:/user/icdet/bin:/user/icbuild/bin +setenv PATH $PATH\:/user/peteoss/bin:/user/peteoss/$VCO/bin setenv PATH $PATH\:/user/pevtools/bin:/user/pevtools/$VCO/bin setenv PATH $PATH\:/usr/mgc/bin:/usr/mgc/lib/mgcms @@ -33,9 +41,11 @@ if ( $?LD_LIBRARY_PATH ) then else setenv LD_LIBRARY_PATH /user/pevtools/$VCO/lib64 endif + +setenv LD_LIBRARY_PATH /user/peteoss/$VCO/lib64\:$LD_LIBRARY_PATH # -# MG development environment +# MG development environment # setenv CVSROOT :pserver:calcvs:/cvs/ic setenv BUILD64 1 @@ -48,81 +58,95 @@ alias create_dwa 'source $HOME/devel/scripts/mg/create_dwa.csh' alias create_iwa 'source $HOME/devel/scripts/mg/create_iwa.csh' #if ( -x /share/cal_daily/latest ) then -# setenv IWA /share/cal_nightly/latest +# setenv IWA /share/cal_nightly/latest if ( -x /share/cal_nightly/latest ) then - setenv IWA /share/cal_nightly/latest + setenv IWA /share/cal_nightly/latest else if ( -x /wv/cal_nightly/latest_ube ) then - setenv IWA /wv/cal_nightly/latest_ube + setenv IWA /wv/cal_nightly/latest_ube else if ( -x /sj/cal_nightly/latest_ube ) then - setenv IWA /sj/cal_nightly/latest_ube + setenv IWA /sj/cal_nightly/latest_ube endif setenv CALIBRE_PRINT_STACK_TRACE 4242 +#setenv CALIBRE_DUMP_CORE_ON_ABORT 1 +setenv CALIBRE_DFM_FILL_WRAP_DUMP_COLLECTIONS 1 +setenv DFM_FILL_WRAP_2D_EXPERIMENTAL 1 +#setenv CALIBRE_MTFLEX_LOCAL_HOST_DIR $HOME/devel/mg/test/dfm_fill_wrap_vertical_shape +#setenv CALIBRE_MTFLEX_LOCAL_HOST_DIR $HOME/devel/mg/test/dfm_fill_wrap_vertical_shape +#setenv TMP $HOME/devel/mg/test/dfm_fill_wrap_vertical_shape +#setenv TEMP $HOME/devel/mg/test/dfm_fill_wrap_vertical_shape # -# MG test environment (These are needed for terra) +# MG test environment (These are needed for terra) # #export MGC_HOME=/amy/cal_nightly/latest/ic/ic_superproj/$VCO/Mgc_home #export MGC_HOME=/wv/icdet/work_areas/latest_ube/ic/ic_superproj/$VCO/Mgc_home/ #export MGC_BIN=$MGC_HOME/bin #export PATH=$MGC_BIN:$PATH -if ( -e /wv/pevtools/data_dir ) then +if ( -e /wv/pevtools/data_dir ) then setenv DESIGN_DIR /wv/pevtools/data_dir endif -if ( -e /wv/calgrid/sge/default/common/settings.csh ) then - setenv DFM_TEST_BASE /wv/cal_dfm_qa/tot_master/calibre/dfm/rq/ - setenv TEST_SUITE_TOP /wv/amy_dfm_qa/tot_master/calibre - setenv CALIBRE_SKIP_OS_CHECKS 1 - source /wv/calgrid/sge/default/common/settings.csh - setenv SGE_ROOT /wv/calgrid/uge811 +if ( -e /amy/cal_dfm_qa/tot_master/calibre/dfm/fill/WRAP ) then + setenv DFM_TEST_BASE /amy/cal_dfm_qa/tot_master/calibre/dfm/fill/WRAP + setenv TEST_SUITE_TOP /amy/cal_dfm_qa/tot_master/calibre endif +if ( -e /wv/calgrid/sge/default/common/settings.csh ) then + setenv DFM_TEST_BASE /wv/cal_dfm_qa/tot_master/calibre/dfm/rq/ + setenv TEST_SUITE_TOP /wv/amy_dfm_qa/tot_master/calibre + setenv CALIBRE_SKIP_OS_CHECKS 1 + source /wv/calgrid/sge/default/common/settings.csh + setenv SGE_ROOT /wv/calgrid/uge811 +endif + +setenv CAL_OPTIONS "-turbo -hyper" + # -# post-review +# post-review # if ( -e /tools/ActivePython-2.5.6.10-linux-x86/bin/post-review ) then - setenv PATH $PATH\:/tools/ActivePython-2.5.6.10-linux-x86/bin + setenv PATH $PATH\:/tools/ActivePython-2.5.6.10-linux-x86/bin else if ( -e /wv/pevtools/ActivePython-2.5.4.4-linux-x86_64/bin/post-review ) then - setenv PATH $PATH\:/wv/pevtools/ActivePython-2.5.4.4-linux-x86_64/bin + setenv PATH $PATH\:/wv/pevtools/ActivePython-2.5.4.4-linux-x86_64/bin endif # -# Eugene's check-in script +# Eugene's check-in script # if ( -x /home/anikin/bin/prepare_for_checkin ) then - alias prepare_for_checkin /home/anikin/bin/prepare_for_checkin + alias prepare_for_checkin /home/anikin/bin/prepare_for_checkin endif # -# VTune and inspector +# VTune and inspector # if ( -x /opt/intel/vtune_amplifier_xe/amplxe-vars.csh ) then - source /opt/intel/vtune_amplifier_xe/amplxe-vars.csh > /dev/null - setenv LM_LICENSE_FILE $LM_LICENSE_FILE\:1717@rukbat.wv.mentorg.com - alias vtune amplxe-gui + source /opt/intel/vtune_amplifier_xe/amplxe-vars.csh > /dev/null + setenv LM_LICENSE_FILE $LM_LICENSE_FILE\:1717@rukbat.wv.mentorg.com + alias vtune amplxe-gui endif if ( -x /opt/intel/inspector_xe_2011/inspxe-vars.csh ) then - source /opt/intel/inspector_xe_2011/inspxe-vars.csh > /dev/null + source /opt/intel/inspector_xe_2011/inspxe-vars.csh > /dev/null endif # -# Private settings +# Private settings # setenv PATH $HOME/local_rh_x64/bin:$HOME/bin:$HOME/devel/scripts/mg:$HOME/devel/scripts/bash:$PATH setenv LD_LIBRARY_PATH $HOME/local_rh_x64/lib:$HOME/local_rh_x64/lib64\:$LD_LIBRARY_PATH setenv EDITOR /home/vkhachat/local_rh_x64/bin/gvim # -# ICWBEV +# ICWBEV # alias icwbev $HOME/local_rh_x64/private/fw/bin/icwbev alias oasis_info $HOME/local_rh_x64/private/fw/bin/oasis_info # -# Aliases +# Aliases # alias cdw 'cd $HOME/devel/mg' alias setmgchome 'source $HOME/devel/scripts/mg/setmgchome.csh' -alias ptags 'ctags --recurse=yes --verbose -h ".h.C"' +alias ptags 'ctags --recurse=yes --verbose -h ".h.C" base lvbase iclv ponte dfm locallv' diff --git a/mg/integrate.csh b/mg/integrate.csh new file mode 100755 index 0000000..8da4e88 --- /dev/null +++ b/mg/integrate.csh @@ -0,0 +1,8 @@ +#!/bin/csh + +if ( $1 == "" || $2 == "" || $3 == "" ) then + echo 'Syntax: .' + exit +endif + +cvs diff -tc -r $2 -r $3 $1 | patch -l -F 3 $1 diff --git a/mg/merge.csh b/mg/merge.csh new file mode 100755 index 0000000..b4b9295 --- /dev/null +++ b/mg/merge.csh @@ -0,0 +1,4 @@ +#!/bin/csh + +calibredrv `dirname $0`/merge.tcl + diff --git a/mg/merge.tcl b/mg/merge.tcl new file mode 100644 index 0000000..12d0616 --- /dev/null +++ b/mg/merge.tcl @@ -0,0 +1,15 @@ +proc merge_phase { prefix } { + set pattern $prefix + append pattern "_*" + set dumps [glob $pattern ] + foreach f $dumps { + lappend input -in $f + } + #layout filemerge $input -out dump_merged.oas -smartdiff -mode append + eval "layout filemerge $input -out dump_merged_$prefix.oas -smartdiff -mode append" +} + +merge_phase phase0 +merge_phase phase1 +merge_phase phase2 +merge_phase phase3 diff --git a/mg/setmgchome.csh b/mg/setmgchome.csh deleted file mode 100644 index e8b00e8..0000000 --- a/mg/setmgchome.csh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/csh - -if ( $1 != '' ) then - set DIR=`readlink -f $1` -else - set DIR=`pwd` -endif - -setenv DWA $DIR -setenv VVCO $VCO - -setenv MGC_HOME $DWA/ic/ic_superproj/$VVCO/Mgc_home -setenv MGC_BIN $MGC_HOME/bin -setenv PATH $MGC_BIN\:$PATH - diff --git a/vim/plugin/cf5-compiler.vim b/vim/plugin/cf5-compile.vim similarity index 51% rename from vim/plugin/cf5-compiler.vim rename to vim/plugin/cf5-compile.vim index f6c06b3..1c84d0a 100755 --- a/vim/plugin/cf5-compiler.vim +++ b/vim/plugin/cf5-compile.vim @@ -1,37 +1,100 @@ +" Copyright (c) 2014 Vahagn Khachatryan " +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to deal +" in the Software without restriction, including without limitation the rights +" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +" copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +" THE SOFTWARE. +" +" Name: cf5-compile.vim +" Version: 1.0.1 +" Authors: Vahagn Khachatryan " -" Functions to compile and link a single c/cpp/java files. +" Licence: http://www.opensource.org/licenses/mit-license.php +" The MIT License " -" let g:cf5output -" =0 - no output window opened. -" =1 - ouput window opened. +" Summary: Vim plugin to compile the edited files and run it. +" +" Description: +" Functions to compile/link and run a single c/cpp/java/..etc +" file based programs. It's irreplaceable for small tests or +" experiments. +" +" How To Use +" -------------- +" Put this file into vim plugin directory. For linux users should +" be $HOME/.vim/plugin. +" In your .vimrc file add +" +" map :call CF5Compile(1) +" map :call CF5Compile(0) +" +" This will allow Ctrl-F5 to "compile and run" and F5 to only +" "compile" the file. Please, note that "filetype" is used to +" define the compiler/interpreter used. +" +" The value of the following variables are used while compiling +" a file: +" g:argv - command line arguments to pass to program. +" g:pyflags - flags to pass to python interpreter. +" g:cppflags - flags to pass to c++ compiler. +" g:wcppflags - flags to pass to (windows) compiler. +" g:lcppflags - flags to pass to (linux) compiler. +" g:ldflags - flags to pass to linker. +" g:ldlibpath - paths to add to PATH or LD_LIBRARY_PATH. +" +" I personally use this script with let-modeline.vim. The last +" allows to define some of compiler options right in the file. For +" example I have the following header in some of my cpp files: +" /* +" VIM: let g:lcppflags="-std=c++11 -O2 -pthread" +" VIM: let g:wcppflags="/O2 /EHsc /DWIN32" +" VIM: let g:cppflags=g:Iboost.g:Itbb +" VIM: let g:ldflags=g:Lboost.g:Ltbb.g:tbbmalloc.g:tbbmproxy +" VIM: let g:ldlibpath=g:Bboost.g:Btbb +" VIM: let g:argv="" +" */ +" +" You might also consider using independence.vim or localvimrc.vim +" in order to configure the plugin for a particular directory. +" +" Enjoy. " if exists('g:loaded_cf5_compiler') finish endif let g:loaded_cf5_compiler = 1 -" -" Make sure let-modeline.vim is loaded. -" -if !exists('*FirstModeLine') - runtime plugin/let-modeline.vim -endif - " " Init global variables with default values. " -function! s:initDefaults() - let g:cf5output=0 - let g:argv="" - let g:pyflags="" - let g:cppflags="" - let g:wcppflags="/O2 /EHsc /DWIN32" - let g:lcppflags="-O2" - let g:ldflags="" - let g:wldflags="" - let g:ldlibpath="" -endfunction +let g:argv="" +let g:flags="" +let g:pyflags="" +let g:cppflags="" +let g:wcppflags="/O2 /EHsc /DWIN32" +let g:lcppflags="-O2" +let g:ldflags="" +let g:wldflags="" +let g:ldlibpath="" +" +" This is an experimental option. +" =0 - no output window opened. +" =1 - output window opened. +" +let g:cf5output=0 " " Microsoft Visual C++ @@ -119,6 +182,17 @@ function! s:InterpretPython(run) endif endfunction +function! s:InterpretMatlab(run) + " Interpret it + let cmd = "octave " . g:flags . " " . expand("%") . ' ' . g:argv + echo cmd + let cout = system( cmd ) + echo cout + if v:shell_error + return + endif +endfunction + function! s:Compile(run) if &filetype=="c" || &filetype=="cpp" if has("win32") || has("win64") @@ -133,6 +207,9 @@ function! s:Compile(run) if &filetype=="java" call s:CompileJava(a:run) endif + if &filetype=="matlab" + call s:InterpretMatlab(a:run) + endif endfunction " @@ -200,13 +277,12 @@ function! CF5Compile(run) return endif " - " First init global variables to let cf5-opt override it. - " - call s:initDefaults() - " " Set source specific compiler options. + " let-modeline.vim should be loaded for FirstModeLine. " - call FirstModeLine() + if exists('*FirstModeLine') + call FirstModeLine() + endif " " Clear output window " diff --git a/vim/vimrc b/vim/vimrc index 5df0418..38a4bac 100755 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,7 +1,23 @@ -"source $VIMRUNTIME/vimrc_example.vim -"source $VIMRUNTIME/mswin.vim -"behave mswin +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Behaviour. +" +" All our scripts and files are here. +if filereadable(expand("~/devel/scripts/vim/vimrc")) + set runtimepath+=~/devel/scripts/vim +endif + +" Set 'nocompatible' to ward off unexpected things that your distro might +" have made, as well as sanely reset options when re-sourcing .vimrc +set nocompatible +" Line ending is UNIX. +set fileformat=unix +" Swap files go here. +"set directory="~/tmp,." console version complains all the time. +" Don't backup files. +set nobackup +"set backupdir="~/tmp,." git commit doesn't work. +" Try to set up UTF-8 encoding. if has("multi_byte") if &termencoding == "" let &termencoding = &encoding @@ -11,47 +27,211 @@ if has("multi_byte") "setglobal bomb set fileencodings=ucs-bom,utf-8,latin1 endif +" Make tabes to be equal to 4 space chars. +set tabstop=4 +" Number of spaces a counts. If different from tabstop a combination of +" tabs and spaces will be inserted. +set softtabstop=4 +" For indentation shift by 4 chars. +set shiftwidth=4 +" When on insert shiftwidth space in front of line. When off inserts +" blanks according to softtabstop. +set smarttab +" Don't expand tabs. +set noexpandtab +if has('autocmd') + " Unset expandtab for make files in any case. + autocmd FileType make setlocal noexpandtab + " Set expandtab for python files in any case. + autocmd FileType python setlocal expandtab +endif +" Attempt to determine the type of a file based on its name and possibly its +" contents. Use this to allow intelligent auto-indenting for each filetype, +" and for plugins that are filetype specific. +filetype indent plugin on +" When opening a new line and no filetype-specific indenting is enabled, keep +" the same indent as the line you're currently on. Useful for READMEs, etc. +set autoindent +" Allow backspacing over autoindent, line breaks and start of insert action +set backspace=indent,eol,start +" Stop certain movements from always going to the first character of a line. +" While this behaviour deviates from that of Vi, it does what most users +" coming from other editors would expect. +set nostartofline +" Try to not cross 80 char boundary. +set textwidth=80 -set nocompatible " Use Vim defaults (much better!) -set backspace=indent,eol,start " allow backspacing over everything in insert mode -"set bs=2 " allow backspacing over everything in insert mode -"set backup " keep a backup file -set viminfo='20,\"50 " read/write a .viminfo file, don't store more - " than 50 lines of registers -set history=50 " keep 50 lines of command line history -set ruler " show the cursor position all the time -set tabstop=4 " make tabes to be equal to 4 space chars. -set shiftwidth=4 " for indentation shift by 4 chars. -set noexpandtab " don't expand tabs. For MG devel/mg/.vimrc sets expandtab. -set softtabstop=4 " insert/ deletes 4 space chars. -set smarttab " insert/ space in front of line instead of tab. -set fileformat=unix " line ending is unix -set textwidth=80 " 80 char text +" Existing long lines are not broken. +set formatoptions+=l +" Auto-wrap comments using textwidth. +set formatoptions=cq +" Insert comment leader if is hit in insert mode or 'o' in Normal mode. +set formatoptions+=ro +"set formatoptions-=o " don't autoformat on 'o' e.g. comment wrapping + +" +" C++ oriented. +" +"do not auto insert single line comments +set comments-=:// +" Auto-insert multi-line comment continuations +set comments+=f:// +" Do not indent after namespace XX{ +set cino+=N-s +" Match open-bracket indentation when breaking parameter lists over multiple +" lines. +set cino+=(0 + + + + + + +set viminfo='20,\"50 " read/write a .viminfo file, don't store more +" than 50 lines of registers let g:netrw_preview = 1 " netrw open window to the right let g:netrw_browse_split = 3 " open in a tab -" In many terminal emulators the mouse works just fine, thus enable it. -if has('mouse') - set mouse=a + +set ttyfast "tf "smooths redraw by using more bandwidth +"set sessionoptions-=options +"show shortmessages +"set shortmess+=atIW +" Set timeout for detecting command key sequence +set timeoutlen=400 + +"set autoread "update file modified outside of vim + +" Quickly time out on keycodes, but never time out on mappings +set notimeout ttimeout ttimeoutlen=200 +" Use to toggle between 'paste' and 'nopaste' +"set pastetoggle= + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Display +" + +" wrap text at window edge without modifying buffer +set nowrap +" Scroll this much chars when scrolled horizontally. +set sidescroll=1 +" break at a suitable character (as in breakat) +"set linebreak +" Begin scrolling this lines from window edge. +set scrolloff=0 + +" Set the command window height to 2 lines, to avoid many cases of having to +" press to continue" +set cmdheight=2 +" Always display the status line, even if only one window is displayed +set laststatus=2 +" Display the cursor position on the last line of the screen or in the status +" line of a window +if exists('&ruler') + set ruler +endif +" Instead of failing a command because of unsaved changes, raise a dialogue +" asking if you wish to save changed files. +if exists('&confirm') + set confirm +endif +" Use visual bell instead of beeping when doing something wrong +if exists('&visualbell') + set visualbell + " And reset the terminal code for the visual bell. If visualbell is set, and + " this line is also included, vim will neither flash nor beep. If visualbell + " is unset, this does nothing. + set t_vb= +endif +" Display line numbers on the left +if exists('&number') + set number +endif +" Turn on spell check. +if exists("+spell") + set spell +endif +" Show 80th column. +if exists("+colorcolumn") + set colorcolumn=+1 " color textwidth+1-th line endif -" a copy-past from my linux vimrc -if &term=="xterm" - set t_Co=8 - set t_Sb=[4%dm - set t_Sf=[3%dm -endif +" Show command-line completion above the command line. +set wildmenu +" wildmenu ignore list +set wildignore=*.o,*.obj,*.bak,*.exe,*.d,*.dd +" Complete to longest common string +set wildmode=longest:full +" remember more history +set history=1000 " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") - syntax on - set hlsearch - " - " This will turn on svrf highlighting - au BufRead,BufNewFile *.svrf set filetype=calibre + syntax on + set hlsearch endif +" Enable syntax highlighting +highlight DiffAdd cterm=none ctermfg=Black ctermbg=Green gui=none guifg=Black guibg=Green +highlight DiffDelete cterm=none ctermfg=Black ctermbg=Red gui=none guifg=Black guibg=Red +highlight DiffChange cterm=none ctermfg=Black ctermbg=Yellow gui=none guifg=Black guibg=Yellow +highlight DiffText cterm=none ctermfg=Black ctermbg=Magenta gui=none guifg=Black guibg=Magenta +" Display tabs and trailing spaces visually +set list +set listchars=tab:>-,trail:ยท + + + +" +" .gvimrc content here. +" +if has("gui_running") + " set color scheme + colorscheme darkblue + "set guioptions-=m + "set guioptions-=T + set lines=50 + set columns=85 + + " Set the font. + if has("win32") || has("win64") + "set guifont=FreeMono:h14:cANSI + "set guifont=Courier\ AM:h12 + else + "set guifont=Bitstream\ Vera\ Sans\ Mono\ 12 + set guifont=Monospace\ 12 + endif +else + colors vahagn_black_terminal +endif +" Configure coloring on command line terminals. +if &term=="xterm" + set t_Co=8 + set t_Sb=[4%dm + set t_Sf=[3%dm +endif +" In many terminal emulators the mouse works just fine, thus enable it. +if has('mouse') +" set mouse=n +endif + + + + + + + + + + + + + + + + + " One such option is the 'hidden' option, which allows you to re-use the same " window and switch from an unsaved buffer without saving it first. Also allows " you to keep an undo history for multiple files when re-using the same window @@ -61,144 +241,92 @@ endif " try to quit without saving, and swap files will keep you safe if your computer " crashes. if exists('&hidden') - set hidden -endif - -" Instead of failing a command because of unsaved changes, raise a dialogue -" asking if you wish to save changed files. -if exists('&confirm') - set confirm -endif - -" Use visual bell instead of beeping when doing something wrong -if exists('&visualbell') - set visualbell -endif - -" Display line numbers on the left -if exists('&number') - set number -endif - -" Turn on spell check. -if exists("+spell") - set spell -endif - -" Show 80th column. -if exists("+colorcolumn") - set colorcolumn=+1 " color textwidth+1-th line + set hidden endif " Modelined are used to configure files. if exists('&modeline') - set modeline - set modelines=10 + set modeline + set modelines=10 endif -" Set fold method if supported +" Set fold method if supported if has('folding') - set nofoldenable - set foldmethod=indent "fold based on indent - set foldnestmax=5 - set foldlevel=1 - if has("autocmd") - autocmd FileType vim setlocal foldmethod=marker - autocmd FileType c setlocal foldmethod=syntax - autocmd FileType h setlocal foldmethod=syntax - autocmd FileType cpp setlocal foldmethod=syntax - endif -endif - -" Unset expandtab for make files in any case. -if has('autocmd') - autocmd FileType make setlocal noexpandtab -endif - -" Set expandtab for python files in any case. -if has('autocmd') - autocmd FileType python setlocal expandtab + set nofoldenable + set foldmethod=indent "fold based on indent + set foldnestmax=3 + set foldminlines=4 + set foldlevel=1 + set foldcolumn=2 " foldcolumn is width 2 + if has("autocmd") + autocmd FileType vim setlocal foldmethod=marker + autocmd FileType c setlocal foldmethod=syntax + autocmd FileType h setlocal foldmethod=syntax + autocmd FileType cpp setlocal foldmethod=syntax + endif endif " Only do this part when compiled with support for autocommands. if has("autocmd") - " Enable file type detection. - " Use the default filetype settings, so that mail gets 'tw' set to 72, - " 'cindent' is on in C files, etc. - " Also load indent files, to automatically do language-dependent indenting. - filetype plugin indent on + " Enable file type detection. + " Use the default filetype settings, so that mail gets 'tw' set to 72, + " 'cindent' is on in C files, etc. + " Also load indent files, to automatically do language-dependent indenting. + filetype plugin indent on - " Put these in an autocmd group, so that we can delete them easily. - augroup vimrcEx - au! + " start with all folds open + au BufRead,BufNewFile,BufWinEnter * normal zR + " highlight lone colon characters + highlight WarnChar ctermbg=yellow ctermfg=red guibg=#FFCC33 guifg=#FF0000 + "apply highlight when opening a file, changing text (N or I), or opening a split + au BufRead,InsertCharPre *.cpp 2mat WarnChar /\w\+;\?:;\?\w\+/ - " For all text files set 'textwidth' to 78 characters. - autocmd FileType text setlocal textwidth=79 + " Put these in an autocmd group, so that we can delete them easily. + augroup vimrcEx + au! - " When editing a file, always jump to the last known cursor position. - " Don't do it when the position is invalid or when inside an event handler - " (happens when dropping a file on gvim). - " Also don't do it when the mark is in the first line, that is the default - " position when opening a file. - autocmd BufReadPost * - \ if line("'\"") > 1 && line("'\"") <= line("$") | - \ exe "normal! g`\"" | - \ endif - augroup END + " When editing a file, always jump to the last known cursor position. + " Don't do it when the position is invalid or when inside an event handler + " (happens when dropping a file on gvim). + " Also don't do it when the mark is in the first line, that is the default + " position when opening a file. + autocmd BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + + augroup END -else - set autoindent " always set autoindenting on endif " has("autocmd") " Convenient command to see the difference between the current buffer and the " file it was loaded from, thus the changes you made. " Only define it when not defined already. if !exists(":DiffOrig") - command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis - \ | wincmd p | diffthis + command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis + \ | wincmd p | diffthis endif -set diffexpr=MyDiff() -function MyDiff() - let opt = '-a --binary ' - if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif - if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif - let arg1 = v:fname_in - if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif - let arg2 = v:fname_new - if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif - let arg3 = v:fname_out - if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif - let eq = '' - if $VIMRUNTIME =~ ' ' - if &sh =~ '\ ' . arg3 . eq -endfunction - -" Don't let vim be too smart. -set formatoptions=cql +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Key Mappings " -" P4 -command! -nargs=* PFedit :!p4 edit % -command! -nargs=* PFrevert :!p4 revert % -command! -nargs=* PFdiff :!p4 diff % + +" F4 grep the word under cursor. +"map :execute "grep " . expand("") . " -r *.h *.cpp *.c *.f" cw +map :execute "grep " . expand("") . " -r --include \*.h --include \*.cpp --include \*.c --include \*.f ." cw +" Create a new tab. +map :tabnew +" +"command! -nargs=* PFdiff :!p4 diff % " " Loads CF5Compile " Compile and run file if Ctrl-F5 is pressed. " if !exists('*CF5Compile') - runtime plugin/cf5-compiler.vim -endif + runtime plugin/cf5-compiler.vim +endif map :call CF5Compile(1) map :call CF5Compile(0) " @@ -214,7 +342,7 @@ noremap gj imap gk imap gj " -" Working with tabs especially if using Putty. +" Working with tabs especially if using console version. " nnoremap th :tabfirst nnoremap tj :tabnext @@ -223,36 +351,38 @@ nnoremap tl :tablast nnoremap tm :tabm nnoremap td :tabclose " -" .gvimrc content here. +" .gvimrc content here. " if has("gui_running") - - colors darkblue " set color scheme - set lines=50 - set columns=85 - if has("win32") || has("win64") - set guifont=FreeMono:h14:cANSI - "set guifont=Courier\ AM:h12 - endif + ":tab drop {file} + " Hide show menu and toolbar. + map :if &guioptions =~# 'm' + \set guioptions-=m + \set guioptions-=T + \set showtabline=0 + \else + \set guioptions+=m + \set guioptions+=T + \set showtabline=1 + \endif - ":tab drop {file} - - " Hide show menu and toolbar. - map :if &guioptions =~# 'm' - \set guioptions-=m - \set guioptions-=T - \set showtabline=0 - \else - \set guioptions+=m - \set guioptions+=T - \set showtabline=1 - \endif - - " Open file in a new tab. - map :browse tabnew %:p:h + " Open file in a new tab. + if has("browsefilter") + let g:browsefilter = "All Files (*.*)\t*\n" + endif else - colors vahagn_black_terminal endif +" +" Vundle experimental stuff here. +" +if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md")) + filetype off + set rtp+=~/.vim/bundle/Vundle.vim + call vundle#begin() + Plugin 'VundleVim/Vundle.vim' + call vundle#end() + filetype plugin indent on +endif