From fa0339d4d042e947cb121d94ba4d077525b89e37 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Tue, 3 Feb 2015 10:26:28 +0400 Subject: [PATCH 01/19] Verbosity of backups is turned off. --- backup/backup.git.sh | 6 ++++-- backup/backup.mybook.public.sh | 4 ++-- backup/backup.mybook.vahagn.sh | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/backup/backup.git.sh b/backup/backup.git.sh index 3a582c1..cbb33ac 100755 --- a/backup/backup.git.sh +++ b/backup/backup.git.sh @@ -1,3 +1,5 @@ +#!/bin/bash + CD=cd DATE=/bin/date TAR=/bin/tar @@ -48,7 +50,7 @@ for FILE in `ls -t git.*.tar.bz2.gpg`; do echo "$FILE is removed to meet keep number of backups $KEEP." | tee -a $LOG rm $FILE 2>&1| tee -a $LOG fi; - i=`expr $i + 1` + i=$(($i+1)) done i=0 for FILE in `ls -t git.*.tar.bz2.sig`; do @@ -56,7 +58,7 @@ for FILE in `ls -t git.*.tar.bz2.sig`; do echo "$FILE is removed to meet keep number of backups $KEEP." | tee -a $LOG rm $FILE 2>&1| tee -a $LOG fi; - i=`expr $i + 1` + i=$(($i+1)) done # # Footer diff --git a/backup/backup.mybook.public.sh b/backup/backup.mybook.public.sh index 09256f9..cde9c4e 100755 --- a/backup/backup.mybook.public.sh +++ b/backup/backup.mybook.public.sh @@ -1,7 +1,7 @@ #!/bin/bash DATE=/bin/date -SYNC=/usr/bin/rsync -auAXv --delete +SYNC="/usr/bin/rsync -auAX --delete" TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z` LOG=/mnt/hdd/backup/backup.mybook.public.$TIMESTAMP.log @@ -9,7 +9,7 @@ echo Starting $LOG | tee -a $LOG echo start `$DATE` | tee -a $LOG $SYNC /mnt/mybook/Public/_captured_MY_VIDEO /mnt/hdd/public/ | tee -a $LOG $SYNC /mnt/mybook/Public/pix /mnt/hdd/public/ | tee -a $LOG -#$SYNC /mnt/mybook/Public/music/* /mnt/hdd/public/ | tee -a $LOG +$SYNC /mnt/mybook/Public/music /mnt/hdd/public/ | tee -a $LOG $SYNC /mnt/mybook/Public/books /mnt/hdd/public/ | tee -a $LOG $SYNC /mnt/mybook/Public/map /mnt/hdd/public/ | tee -a $LOG $SYNC /mnt/mybook/Public/src /mnt/hdd/public/ | tee -a $LOG diff --git a/backup/backup.mybook.vahagn.sh b/backup/backup.mybook.vahagn.sh index f463032..0b0bd42 100755 --- a/backup/backup.mybook.vahagn.sh +++ b/backup/backup.mybook.vahagn.sh @@ -1,12 +1,12 @@ #!/bin/bash DATE=/bin/date -SYNC=/usr/bin/rsync -auAXv --delete +SYNC="/usr/bin/rsync -auAX --delete" TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z` LOG=/mnt/hdd/backup/backup.mybook.vahagn.$TIMESTAMP.log echo Starting $LOG | tee -a $LOG echo start `$DATE` | tee -a $LOG -$SYNC /mnt/mybook/vahagn /mnt/hdd/ | tee -a $LOG +$SYNC /mnt/mybook/vahagn /mnt/hdd/backup | tee -a $LOG echo end `$DATE` | tee -a $LOG From e46a578f17befeb9e079764ef0e1f7363dacbcf5 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Thu, 9 Jun 2016 09:12:18 -0400 Subject: [PATCH 02/19] Fix: Spell check now works in GUI mode again. --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 7cccd08..15d8be3 100755 --- a/vim/vimrc +++ b/vim/vimrc @@ -199,7 +199,7 @@ endif if exists('+spell') && !&diff set spell highlight clear SpellBad - highlight SpellBad cterm=underline ctermfg=red + highlight SpellBad cterm=underline ctermfg=red gui=undercurl guisp=Red endif " Show 80th column. if exists('+colorcolumn') From 48aacd2721541ddd88d4d93d9ea224c4979190ae Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Wed, 10 Aug 2016 04:27:52 -0400 Subject: [PATCH 03/19] Buffergator is configured to persist. --- vim/vimrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vim/vimrc b/vim/vimrc index 15d8be3..758151e 100755 --- a/vim/vimrc +++ b/vim/vimrc @@ -439,6 +439,8 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) " Manipulation with buffers and tabs. " Plugin 'vim-scripts/Buffergator' + let g:buffergator_autodismiss_on_select = 0 + let g:buffergator_autoupdate = 1 let g:buffergator_suppress_keymaps = 1 let g:buffergator_viewport_split_policy = "L" map ab :BuffergatorToggle From 40af9cf335427c69e67ec070f4e01d89e8d42e01 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Thu, 27 Oct 2016 00:15:12 +0100 Subject: [PATCH 04/19] Command prompt time is moved after hostname + minor enhancements/bug fixes. --- config/.bashrc | 118 +++++++++++++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 53 deletions(-) diff --git a/config/.bashrc b/config/.bashrc index 531d9f0..401792c 100755 --- a/config/.bashrc +++ b/config/.bashrc @@ -41,6 +41,23 @@ kversion=`uname -v` krelease=`uname -r` hostnm=`hostname` +# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +# +# Bash history +# + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth +# append to the history file, don't overwrite it +shopt -s histappend +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=5000 +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # # Terminal colors if interactive @@ -109,12 +126,13 @@ if [ -n "$PS1" ]; then # # Colors should be set here and surrounded with \[\]otherwise bash fails to # calculate prompt length. The text is set through PROMPT_COMMAND - PS1="\[$c_user\]\u@\h: \[$c_cwd\]\w" # username@host: working_dir + PS1="\[$c_user\]\u@\h:" # username@host: + PS1+="\[$c_time\]\t" # time + PS1+=" \[$c_cwd\]\w" # working_dir PS1+="\[$c_branch\]\$git_text" # git branch PS1+="\[$c_branch\]\$svn_text" # svn revision PS1+="\[$c_exit\]\$exit_text" # exit status of last command PS1+="\[$c_jobs\]\$jobs_text" # background/suspended jobs - PS1+=" \[$c_time\]\t" # time PS1+="\[$c_reset\]\$ " # reset colors and print $ export PROMPT_COMMAND="__prompt_command; $PROMPT_COMMAND" @@ -175,92 +193,86 @@ fi # # User specific environment and startup programs # -if [ $kernel == Linux ]; then + +# +# Set my paths. +# +if [ -e $HOME/local ]; then + MYLOCAL=$HOME/local +elif [ $kernel == Linux ] && [ -e $HOME/local-lnx ]; then MYLOCAL=$HOME/local-lnx -elif [ $kernel == SunOS ]; then +elif [ $kernel == SunOS ] && [ -e $HOME/local-sun ]; then MYLOCAL=$HOME/local-sun fi +if [ -e $MYLOCAL/bin ]; then + export PATH=$MYLOCAL/bin:$PATH +fi + MYSCRIPTS=$HOME/devel/scripts -PATH=$MYLOCAL/bin:$PATH -PATH=$MYSCRIPTS/bin:$PATH +if [ -e $MYSCRIPTS/bin ]; then + export PATH=$MYSCRIPTS/bin:$PATH +fi # # VIM # export EDITOR=vim +# +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +# +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + # # GIT # [ -f $MYSCRIPTS/bash/git-completion.bash ] && . $MYSCRIPTSE/bash/git-completion.bash # -# GCC +# colored GCC warnings and errors # -#if [ -e /depot/gcc-4.7.2/bin ]; then -# PATH=/depot/gcc-4.7.2/bin:$PATH -# LD_LIBRARY_PATH=/depot/gcc-4.7.2/lib64:$LD_LIBRARY_PATH -#elif [ -e /depot/gcc-4.7.0/bin ]; then -# PATH=/depot/gcc-4.7.0/bin:$PATH -# LD_LIBRARY_PATH=/depot/gcc-4.7.0/lib64:$LD_LIBRARY_PATH -#elif [ -e /depot/gcc-4.5.2/bin ]; then -# PATH=/depot/gcc-4.5.2/bin:$PATH -# LD_LIBRARY_PATH=/depot/gcc-4.5.2/lib64:$LD_LIBRARY_PATH -#fi - -# -# GDB -# -#prepath /depot/gdb-7.5.1/bin - -# -# VTune Amplifier -# -#export INTEL_LICENSE_FILE=28518@us01-lic10:28518@us01-lic11:28518@us01-lic12:28518@tyndall -#alias vtune=/depot/vtune_amplifier_xe_2013_update5/bin64/amplxe-gui - -# -# PURIFY and all. -# -#postpath /depot/coverity/swat/bin -#export RSU_TEMPLATE2_INI=/depot/pure/templates2.ini -#export RSU_LICENSE_MAP=/depot/pure/PurifyPlus_License_Map -#export PURECOVOPTIONS="-force-rebuild=no -log-file=./%v.%p.log -counts-file=./%v.%p.pcv -windows=no" -#export PUREOPTIONS="-force-rebuild=no -always-use-cache-dir=yes -cache-dir=$HOME/tmp/pure_cache" -#export QUANTIFYOPTIONS="-force-rebuild=no -always-use-cache-dir=yes -cache-dir=$HOME/tmp/pure_cache" -#export LD_LIBRARY_PATH=$HOME/prj/fw/rmain/3pty/qt/4.7.2/amd64/lib:$LD_LIBRARY_PATH -#alias purecov="/depot/swe/a2007.12/bin/purecov" -#alias quantify"/depot/swe/a2007.12/bin/quantify" - -# -# Make sure to export PATH -# -export PATH -export HISTFILESIZE=5000 # Store 5000 commands in history -export HISTCONTROL=ignoredups # Don't put duplicate lines in the history. +export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # # Aliases # if [ $kernel == AIX ]; then - alias l='ls -a' alias ls='ls -a' alias ll='ls -la' alias pd='pushd >/dev/null' alias bd='popd' else - alias l='ls -a --color=tty' - alias ls='ls -a --color=tty' - alias ll='ls -la --color=tty' + alias ls='ls -a --color=auto' + alias ll='ls -la --color=auto' alias pd='pushd >/dev/null' alias bd='popd' + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' fi alias cgrep="grep --include \*.cpp --include \*.h --include \*.c" + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # # Run local settings. # -[ -f $PWD/.bashrc.local ] && . $PWD/.bashrc.local +[ -x $PWD/.bashrc.local ] && . $PWD/.bashrc.local +# +# Clean error level. +# +[ 1 ] From 4aeb9960640a5472f1be26f382c021e64af8d38a Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sun, 5 Feb 2017 12:36:43 +0000 Subject: [PATCH 05/19] Using cf5-compile from github.com/vishap/cf5-compile --- vim/plugin/cf5-compile.vim | 312 ------------------------------------ vim/plugin/let-modeline.vim | 234 --------------------------- vim/vimrc | 90 ++++++----- 3 files changed, 51 insertions(+), 585 deletions(-) delete mode 100755 vim/plugin/cf5-compile.vim delete mode 100755 vim/plugin/let-modeline.vim diff --git a/vim/plugin/cf5-compile.vim b/vim/plugin/cf5-compile.vim deleted file mode 100755 index cca8e4c..0000000 --- a/vim/plugin/cf5-compile.vim +++ /dev/null @@ -1,312 +0,0 @@ -" 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 -" -" Licence: http://www.opensource.org/licenses/mit-license.php -" The MIT License -" -" 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 - -" -" Init global variables with default values. -" -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++ -" -function! s:CompileMSVC(run) "{{{2 - let exename=expand("%:p:r:s,$,.exe,") - let srcname=expand("%") - " compile it - let ccline="cl ".g:cppflags." ".g:wcppflags." ".srcname." /Fe".exename." /link ".g:ldflags. " ".g:wldflags - echo ccline - let cout = system( ccline ) - if v:shell_error - echo cout - return - endif - echo cout - " run it - if a:run==1 - let en = "set PATH=\"".g:ldlibpath."%PATH%\"" - let cmdline=exename." ".g:argv - let cont = [ en, cmdline ] - let tf = tempname() - let tf = fnamemodify( tf, ":p:r") - let tf = tf.".bat" - call writefile( cont, tf ) - - let eout = system( tf ) - echo eout - - call delete( tf ) - endif -endfunction - -" -" GCC -" -function! s:CompileGCC(run) "{{{2 - let exename=expand("%:p:r:s,$,.exe,") - let srcname=expand("%") - " compile it - let ccline="g++ ".g:cppflags." ".g:lcppflags." ".g:ldflags." ".srcname." -o".exename - call s:appendOutput(ccline) - let cout = system( ccline ) - if v:shell_error - call s:appendOutput(cout) - return - endif - call s:appendOutput(cout) - " run it - if a:run == 1 - let $LD_LIBRARY_PATH="LD_LIBRARY_PATH=".g:ldlibpath.":".$LD_LIBRARY_PATH - let cmdline=exename." ".g:argv - call s:appendOutput(cmdline) - let eout = system( cmdline ) - call s:appendOutput(eout) - endif -endfunction - -function! s:CompileJava(run) "{{{2 - " compile it - let cmd = "javac " . g:javaflags . " " . expand("%") - echo cmd - let cout = system( cmd ) - echo cout - if v:shell_error - return - endif - " run it - "let classpath=expand("%:p:r") - let exename=expand("%:r") - let cmd = "java " . exename . " " . g:argv - echo cmd - let eout = system( cmd ) - echo eout -endfunction - -function! s:InterpretPython(run) - " Interpret it - let cmd = "python " . g:pyflags . " " . expand("%") . ' ' . g:argv - echo cmd - let cout = system( cmd ) - echo cout - if v:shell_error - return - 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") - call s:CompileMSVC(a:run) - else - call s:CompileGCC(a:run) - endif - endif - if &filetype=="python" - call s:InterpretPython(a:run) - endif - if &filetype=="java" - call s:CompileJava(a:run) - endif - if &filetype=="matlab" - call s:InterpretMatlab(a:run) - endif -endfunction - -" -" Output Window {{{1 -" -" Create output window. {{{2 -" -function! s:getOutputWindow() - if !exists("w:outputwin") - let w:outputwin=tempname().'_output' - endif - let obuff = w:outputwin - - let winnr = bufwinnr('^'.obuff.'$') - - if (winnr < 0) - execute "below 10new ".obuff - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap - " setlocal nomodifiable - let winnr = bufwinnr('^'.obuff.'$') - endif - - return winnr -endfunction -" -" Append text to output window. {{{2 -" -function! s:appendOutput( text ) - if exists("g:cf5output") && (g:cf5output==1) - let cwinnr = winnr() - let owinnr = s:getOutputWindow() -" setlocal modifiable - execute owinnr . 'wincmd w' - execute 'normal! Go'.a:text -" setlocal nomodifiable - execute cwinnr.'wincmd w' - else - echo a:text - endif -endfunction -" -" Clear text from output window. {{{2 -" -function! s:clearOutputWindow() - if exists("g:cf5output") && (g:cf5output==1) - let cwinnr = winnr() - let owinnr = s:getOutputWindow() -" setlocal modifiable - execute owinnr . 'wincmd w' - execute 'normal ggdG' -" setlocal nomodifiable - execute cwinnr . 'wincmd w' - endif -endfunction - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Public interface. -"" - -" -" Load compile instructions and call window or linux compiler. {{{1 -" -function! CF5Compile(run) - " - " Interpreters and compilers don't work with buffers, but ratter they run - " on files. So, make sure that the file is updated. - " - if &modified == 1 - echo "The buffer is not saved. First save it." - return - endif - " - " Set source specific compiler options. - " let-modeline.vim should be loaded for FirstModeLine. - " - if exists('*FirstModeLine') - call FirstModeLine() - endif - " - " Clear output window - " - call s:clearOutputWindow() - " - " Compile. - " - call s:Compile(a:run) -endfunction -" -" Load compile instructions and call window or linux compiler. -" -function! CF5CompileAndRun() - call CF5Compile(1) -endfunction -" -" Load compile instructions and call window or linux compiler. -" -function! CF5CompileOnly() - call CF5Compile(0) -endfunction - diff --git a/vim/plugin/let-modeline.vim b/vim/plugin/let-modeline.vim deleted file mode 100755 index d216139..0000000 --- a/vim/plugin/let-modeline.vim +++ /dev/null @@ -1,234 +0,0 @@ -" example -> VIM: let b:toto="foo" g:tata=4 g:egal="t=y".&tw -" =========================================================================== -" File: let-modeline.vim {{{1 -" Author: Luc Hermitte -" -" URL: http://hermitte.free.fr/vim/ressources/dollar_VIM/plugin/let-modeline.vim -" Version: 1.6 -" Last Update: 23rd Mar 2004 -" -" Purpose: {{{2 -" Defines the function : FirstModeLine() that extends the VIM modeline -" feature to variables. In VIM, it is possible to set options in the -" first and last lines. -> :h modeline -" The function proposed extends it to 'let {var}={val}' affectations. -" -" Exemples Of Useful Aplications: {{{2 -" Typical Example: {{{3 -" When editing a LaTeX document composed of several files, it is very -" practical to know the name of the main file whichever file is edited -- -" TKlatex does this thanks the global variable g:TeXfile. Hence it knows -" that latex should be called on this main file ; aux2tags.vim could also -" be told to compute the associated .aux file. -" Anyway. Defining (through menus or a let command) g:TeXfile each time is -" really boring. It bored me so much that I programmed a first version of -" this script. In every file of one of my projects I added the line : -" % VIM: let g:TeXfile=main.tex -" [main.tex is the name of the main file of the project] -" Thus, I can very simply call LaTeX from within VIM without having to -" wonder which file is the main one nor having to specify g:TeXfile each -" time. -" -" Using Callback Functions: {{{3 -" Actually, in order to affect g:TeXfile, I have to call another function. -" Hence, I define a callback function (in my (La)TeX ftplugin) that checks -" whether I want to set g:TeXfile. In that case, the callback function -" calls the right function and return true. Otherwise, it returns false. -" You will find the code of this precise callback function as an example at -" the end of this file. -" -" Tune C Compilations: {{{3 -" An easy way to tune the parameters of the compilation of simple programs -" without having to maintain a makefile: -" // VIM: let $CPPFLAGS='-I../../libs': -" -" --------------------------------------------------------------------------- -" Format: {{{2 -" On the _first_ line of any file, the extended modeline format is: -" {line} ::= [text]{white}VIM:[white]let{affectations} -" {affectations} ::= {sgl_affect.} -" {affectations} ::= {sgl_affect.}{white}{affectations} -" {sgl_affect.} ::= {variable}[white]=[white]{value} -" {variable} ::= cf. vim variable format ; beware simple -" variables (other than global-, buffer-, -" or window-variables) are not exported. -" Can also be an environment variable -> $VAR. -" {value} ::= string or numeral value : no function -" call allowed. -" -" Options: {{2 -" (*) 'modeline' : vim-option that must be set to 1 -" (*) 'modelines': vim-option corrsponding to the number of lines -" searched. -" (*) b:ModeLine_CallBack(var,val) : callback function -" Enable to define callback functions when needed. cf. lhlatex.vim -" -" Installation: {{{2 -" (*) Drop the file into your $$/plugin/ or $$/macros/ folder. -" (*) Source it from your .vimrc and add the autocommand: -" " Loads FirstModeLine() -" if !exists('*FirstModeLine') -" " :Runtime emules :runtime with VIM 5.x -" Runtime plugin/let-modeline.vim -" endif -" if exists('*FirstModeLine') -" aug ALL -" au! -" " To not interfer with Templates loaders -" au BufNewFile * :let b:this_is_new_buffer=1 -" " Modeline interpretation -" au BufEnter * :call FirstModeLine() -" aug END -" endif -" -" -" Remarks: {{{2 -" (*) The only way to call a function is through the callback feature. -" Affectation like 'let g:foo="abc".DEF()' are recognized and -" forbiden. -" (*) The modeline is recognized thanks to "VIM" in that *must* be in -" uppercase letters -" -" Changes: {{{2 -" v1.6: Support for environment variables. -" vim 6.x only -" Doesn't check into folded lines anymore -" v1.5: Check that the format of the variables and values is correct -" before it tries to set the variables -> no more error messages -" when using 2html.vim. -" v1.4: With Vim 6.x, it doesn't mess anymore with the search history -" v1.3: Parse several lines according to &modelines and &modeline -" v1.2: no-reinclusion mecanism -" v1.1b: extend variable names to accept underscores -" -" Todo: {{{2 -" (*) Enforce the patterns and the resulting errors -" (*) Permit to have comments ending characters at the end of the line. -" (*) Simplify the regexps -" -" }}}1 -" =========================================================================== -" Definitions: {{{1 -if exists("g:loaded_let_modeline") | finish | endif -let g:loaded_let_modeline = 1 - -" Internal function dedicated to the recognition of function calls {{{2 -function! s:FoundFunctionCall(value_str) - let str = substitute(a:value_str, '"[^"]*"', '', 'g') - let str = substitute(str, "'[^']*'", '', 'g') - return match(str, '(.*)') != -1 -endfunction - -" Internal function dedicated to the parsing of a line {{{2 -function! FML_parse_line(mtch) - " call confirm('Find:'.a:mtch, '&ok', 1) - if a:mtch !="" - let mtch = a:mtch - let re_var = '\s\+\([[:alnum:]:_$]\+\)' - " beware the comments ending characters - let re_val = '\(\%(' . "'[^']*'" . '\|"[^"]*"\|[-a-zA-Z0-9:_.&$]\)\+\)$' - let re_other = '^\(.\{-}\)' - let re_sub = re_other . re_var . '\s*=\s*' . re_val - while strlen(mtch) != 0 - let vari = substitute( mtch, re_sub, '\2', '' ) - let valu = substitute( mtch, re_sub, '\3', '' ) - " call confirm('regex: '.re_sub."\nmtch: <<".mtch.">>\nvar: ".vari."\nval: ".valu, '&ok', 1) - if (vari !~ '^[[:alnum:]:_$]\+$') || (valu !~ re_val) - return - endif - " Check : no function ! - if s:FoundFunctionCall(valu) - echohl ErrorMsg - echo "Find a function call in the affectation : let " . vari . " = " . valu - echohl None - return - endif - let mtch = substitute( mtch, re_sub, '\1', '' ) - ""echo vari . " = " . valu . " --- " . mtch . "\n" - " call confirm('vari: '.vari.' = '.valu." --- " . mtch, '&Ok', 1) - if exists("b:ModeLine_CallBack") - exe 'let res = '. b:ModeLine_CallBack . '("'.vari.'","'.valu.'")' - if res == 1 | return | endif - endif - " Else - execute "let " . vari . " = " . valu - endwhile - endif -endfunction - -" Internal function dedicated searching the matching lines {{{2 -function! s:Do_it_on_range(first, last) - " let modeline_pat = '[vV][iI][mM]\d*:\s*let\s*\zs.*$' - let modeline_pat = '[vV][iI][mM]\d*:\s*let\zs.*$' - if &verbose >= 2 " {{{ - echo "\n->"a:first.','.a:last. 'g/'.modeline_pat. - \ '/:call FML_parse_line(matchstr(getline("."),"'. - \ escape(modeline_pat, '\\') .'"))' - endif " }}} - let s:save_fold_enable= &foldenable - set nofoldenable - if exists(':try') - try - silent execute a:first.','.a:last. 'g/'.modeline_pat. - \ '/:call FML_parse_line(matchstr(getline("."),"'. - \ escape(modeline_pat, '\\') .'"))' - " Purge the history for the search pattern just used. - call histdel('search', -1) - finally - let &foldenable = s:save_fold_enable - endtry - else " Older versions of Vim - silent execute a:first.','.a:last. 'g/'.modeline_pat. - \ '/:call FML_parse_line(matchstr(getline("."),"'. - \ escape(modeline_pat, '\\') .'"))' - " Purge the history for the search pattern just used. - call histdel('search', -1) - let &foldenable = s:save_fold_enable - endif -endfunction - -" The main function {{{2 -function! FirstModeLine() - if !&modeline | return | endif - let pos = line('.') . 'normal! ' . virtcol('.') . '|' - let e1 = 1+&modelines-1 - let b2 = line('$') - &modelines+1 - " call confirm('e1='.e1."\nb2=".b2, '&ok', 1) - if e1 >= b2 - call s:Do_it_on_range(1, line('$')) - else - call s:Do_it_on_range(1, e1) - call s:Do_it_on_range(b2, line('$')) - endif - if !exists('b:this_is_new_buffer') - exe pos - else - unlet b:this_is_new_buffer - endif - " call confirm('fini!', '&ok', 1) -endfunction - -" }}}2 - -" }}}1 -" =========================================================================== -" Example of a callback function {{{1 -" Version I use in my (La)TeX ftplugin -if 0 - - let b:ModeLine_CallBack = "TeXModeLine_CallBack" - function! TeXModeLine_CallBack(var,val) - if match(a:var, "g:TeXfile") != -1 - " restore quotes around the file name - "let valu = substitute( valu, '^"\=\([[:alnum:].]\+\)"\=$', '"\1"', '' ) - call TKSetTeXfileName( 2, a:val ) - return 1 - else - return 0 - endif - endfunction - -endif -" }}}1 -" =========================================================================== -" vim600: set fdm=marker: diff --git a/vim/vimrc b/vim/vimrc index 758151e..0426bd2 100755 --- a/vim/vimrc +++ b/vim/vimrc @@ -375,15 +375,6 @@ let $GREP_OPTIONS.=' --exclude-dir=llcalc* --exclude-dir=00*' "let $GREP_OPTIONS.=' --include Makefile' map af :execute "grep! ".expand("")." -r ." cw -" -" Loads CF5Compile -" Compile and run file if Ctrl-F5 is pressed. -" -if !exists('*CF5Compile') - runtime plugin/cf5-compiler.vim -endif -map a4 :call CF5CompileOnly() -map a5 :call CF5CompileAndRun() " " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, " so that you can undo CTRL-U after inserting a line break. @@ -430,36 +421,12 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) " " Adds nice status and tabline. " - Plugin 'bling/vim-airline' + Plugin 'vim-airline/vim-airline' + "Plugin 'vim-airline/vim-airline-themes' let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '|' - - " - " Manipulation with buffers and tabs. - " - Plugin 'vim-scripts/Buffergator' - let g:buffergator_autodismiss_on_select = 0 - let g:buffergator_autoupdate = 1 - let g:buffergator_suppress_keymaps = 1 - let g:buffergator_viewport_split_policy = "L" - map ab :BuffergatorToggle - "map at :BuffergatorTabsToggle - - " - " - " - "Plugin 'eiginn/netrw' - "let g:netrw_altv = 1 - "let g:netrw_fastbrowse = 2 - "let g:netrw_keepdir = 0 - "let g:netrw_liststyle = 3 - "let g:netrw_retmap = 1 - "let g:netrw_silent = 1 - "let g:netrw_special_syntax= 1 - "map :Explore - "map :Explore %:p:h - + let g:airline_powerline_fonts = 1 " " " @@ -471,6 +438,29 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) let g:NERDTreeIgnore = ['\.o$', '\.so$', '\.tsk$'] map at :NERDTreeToggle "map am :NERDTreeFind + " + " Commented out in favour of NERDTree + " + "Plugin 'eiginn/netrw' + "let g:netrw_altv = 1 + "let g:netrw_fastbrowse = 2 + "let g:netrw_keepdir = 0 + "let g:netrw_liststyle = 3 + "let g:netrw_retmap = 1 + "let g:netrw_silent = 1 + "let g:netrw_special_syntax= 1 + "map :Explore + "map :Explore %:p:h + " + " Manipulation with buffers and tabs. + " + Plugin 'vim-scripts/Buffergator' + let g:buffergator_autodismiss_on_select = 0 + let g:buffergator_autoupdate = 1 + let g:buffergator_suppress_keymaps = 1 + let g:buffergator_viewport_split_policy = "L" + map ab :BuffergatorToggle + "map at :BuffergatorTabsToggle " " :A switches to the header file (or vise versa) @@ -493,16 +483,33 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) let g:alternateExtensions_cpp = "h" let g:alternateExtensions_c = "h" map ah :A + " + " Extends modeline to variables. + " Needed by CF5 compile to read options right from file. + " + Plugin 'vim-scripts/let-modeline.vim' + " + " CF5 compile. + " Compiling cpp files without make file. + " + Plugin 'vishap/cf5-compile' + map ac :call CF5CompileOnly() + map ar :call CF5CompileAndRun() + " " Comment code. - " gc - visusl mode - comment selection. + " gc - visual mode - comment selection. " - "Plugin 'tpope/vim-commentary' + Plugin 'tpope/vim-commentary' + nmap al CommentaryLine + vmap al Commentary " " Git wrapper. " Plugin 'tpope/vim-fugitive' + nmap git :Git + nmap gst :Gstatus " " Shows git diff. " [c - jump prev diff @@ -521,7 +528,7 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) let g:gitgutter_map_keys = 0 let g:gitgutter_realtime = 0 let g:gitgutter_eager = 0 - + let g:gitgutter_async = 1 " " Check syntaxis on fly. @@ -570,6 +577,11 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) " "Plugin 'xterm-color-table.vim' + + " Promising GDB manager. + " + Plugin 'vim-scripts/gdbmgr' + " call vundle#end() filetype plugin indent on From ee0d5924190b5485772291f2317a3dc3f2311e55 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Tue, 21 Feb 2017 09:13:59 -0500 Subject: [PATCH 06/19] cgrep --- config/.bashrc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/config/.bashrc b/config/.bashrc index 401792c..8106d64 100755 --- a/config/.bashrc +++ b/config/.bashrc @@ -259,7 +259,28 @@ else alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi -alias cgrep="grep --include \*.cpp --include \*.h --include \*.c" + +function cgrep() { + if [[ $# -eq 0 ]] + then + echo "Usage: codegrep " + else + grep -nR --colour \ + --include=\*.cpp \ + --include=\*.c \ + --include=\*.hpp \ + --include=\*.h \ + --include=\*.inc \ + --include=\*.php \ + --include=\*.py \ + --include=\*.sh \ + --exclude-dir=.git \ + --exclude-dir=.svn \ + --exclude-dir=llcalc* \ + --exclude-dir=00* \ + "$1" . + fi +} # Add an "alert" alias for long running commands. Use like so: From 7e2d5762e2f9c7a88c8f4526414e5881fb2b8716 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sat, 27 May 2017 10:59:57 +0100 Subject: [PATCH 07/19] vim templates added --- vim/vimrc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 0426bd2..c65b16e 100755 --- a/vim/vimrc +++ b/vim/vimrc @@ -495,7 +495,17 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) Plugin 'vishap/cf5-compile' map ac :call CF5CompileOnly() map ar :call CF5CompileAndRun() - + + " + " Provide templates + " + Plugin 'aperezdc/vim-template' + "let g:templates_no_autocmd = 1 + let g:templates_no_builtin_templates = 1 + " + " Local vimrc + " + Plugin 'embear/vim-localvimrc' " " Comment code. From 0a7e572358a834874165cd81823375c93db1ae1f Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Thu, 22 Jun 2017 14:41:22 -0400 Subject: [PATCH 08/19] create_tags is added --- config/.bashrc | 33 +++++++++++++++++++++++++++++++++ config/.ctags | 27 +++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/config/.bashrc b/config/.bashrc index 8106d64..11d3699 100755 --- a/config/.bashrc +++ b/config/.bashrc @@ -282,6 +282,39 @@ function cgrep() { fi } +function create_tags() { + #Bloomberg + if [ -e /opt/swt/bin/ctags ]; then + CTAGS=/opt/swt/bin/ctags + else + CTAGS=ctags + fi + CTAGS_OPT='--recurse=yes ' + CTAGS_OPT+='--verbose ' + CTAGS_OPT+='--totals=yes ' + CTAGS_OPT+='--tag-relative=yes ' + + CTAGS_DIR='.ctags_dir' + if [ -f $PWD/$CTAGS_DIR ]; then + CTAGS_ROOT="$PWD" + elif [ -f $PWD/../$CTAGS_DIR ]; then + CTAGS_ROOT="$PWD/.." + elif [ -f $PWD/../../$CTAGS_DIR]; then + CTAGS_ROOT="$PWD/../.." + else + CTAGS_ROOT="$PWD" + fi + + if [ -f $CTAGS_ROOT/$CTAGS_DIR ]; then + CTAGS_SRC="-L $CTAGS_ROOT/$CTAGS_DIR" + else + CTAGS_SRC='$@' + fi + + cd $CTAGS_ROOT + $CTAGS $CTAGS_OPT $CTAGS_SRC + cd - +} # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert diff --git a/config/.ctags b/config/.ctags index 36b03aa..f41233b 100644 --- a/config/.ctags +++ b/config/.ctags @@ -1,5 +1,24 @@ -# Basic options ---recurse=yes +--verbose --tag-relative=yes ---exclude=.git - +--exclude=.git* +--exclude=.doxygen +--exclude=*.o +--exclude=*.d +--exclude=*.a +--exclude=*.so +--exclude=*.tsk +--exclude=*.cap +--exclude=*.defs +--exclude=*.dep +--exclude=*.mem +--exclude=*.opts +--exclude=*.pub +--exclude=*.txt +--exclude=*.swp +--exclude=*.swo +--exclude=*.swn +--exclude=build +--exclude=llcalc* +--exclude=ported.* +--exclude=00* +--exclude=*plink* From fb0b718f2e80e96da7d1daa0997d3104de9e0b05 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Mon, 26 Jun 2017 05:33:50 -0400 Subject: [PATCH 09/19] Minor fixes on create_tags and .bashrc.local --- config/.bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/.bashrc b/config/.bashrc index 11d3699..bc62c81 100755 --- a/config/.bashrc +++ b/config/.bashrc @@ -308,7 +308,7 @@ function create_tags() { if [ -f $CTAGS_ROOT/$CTAGS_DIR ]; then CTAGS_SRC="-L $CTAGS_ROOT/$CTAGS_DIR" else - CTAGS_SRC='$@' + CTAGS_SRC="$%" fi cd $CTAGS_ROOT @@ -324,7 +324,7 @@ alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo # # Run local settings. # -[ -x $PWD/.bashrc.local ] && . $PWD/.bashrc.local +[ -x $HOME/.bashrc.local ] && . $HOME/.bashrc.local # # Clean error level. From 63b0446598a3de15b9e3d5bb25a416e0d7fccab0 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sat, 25 Nov 2017 11:14:52 +0000 Subject: [PATCH 10/19] signcolumn removed from gitgutter setup. --- vim/vimrc | 1 - 1 file changed, 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 5db07dd..0cf14fa 100755 --- a/vim/vimrc +++ b/vim/vimrc @@ -515,7 +515,6 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) " :GitGutterLineHighlightsToggle " Plugin 'airblade/vim-gitgutter' - set signcolumn=yes let g:gitgutter_map_keys = 0 let g:gitgutter_realtime = 0 let g:gitgutter_eager = 0 From 1aa7f2c8ee502b80649b6a9f7200b66e9ce1a272 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sun, 4 Feb 2018 08:48:06 +0000 Subject: [PATCH 11/19] Adding vimux to vimrc. --- bin/socks5_on_1080.sh | 2 -- config/.gitconfig | 2 ++ vim/vimrc | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) delete mode 100755 bin/socks5_on_1080.sh diff --git a/bin/socks5_on_1080.sh b/bin/socks5_on_1080.sh deleted file mode 100755 index a4cf1ce..0000000 --- a/bin/socks5_on_1080.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -ssh -f -N -D 192.168.0.3:1080 yerevak.vostan.org diff --git a/config/.gitconfig b/config/.gitconfig index 71f9342..537d598 100644 --- a/config/.gitconfig +++ b/config/.gitconfig @@ -23,3 +23,5 @@ path = ~/.gitconfig.local [core] excludesfile = ~/.gitignore.global +[credentail] + helper = cache diff --git a/vim/vimrc b/vim/vimrc index bdd781b..5a247fa 100755 --- a/vim/vimrc +++ b/vim/vimrc @@ -427,6 +427,7 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = '|' let g:airline_powerline_fonts = 1 + " " " @@ -461,7 +462,6 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) let g:buffergator_viewport_split_policy = "L" map ab :BuffergatorToggle "map at :BuffergatorTabsToggle - " " :A switches to the header file (or vise versa) " :AS splits and switches @@ -483,6 +483,11 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) let g:alternateExtensions_cpp = "h" let g:alternateExtensions_c = "h" map ah :A + + " + " Tmux integration. + " + Plugin 'benmills/vimux' " " Extends modeline to variables. " Needed by CF5 compile to read options right from file. @@ -495,7 +500,7 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) Plugin 'vishap/cf5-compile' map ac :call CF5CompileOnly() map ar :call CF5CompileAndRun() - + " " Provide templates " @@ -552,6 +557,7 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) " " Nice colorschemes. + " Actual colorscheme is set outside as vundle resets it. " if &t_Co >= 256 || has('gui_running') Plugin 'nanotech/jellybeans.vim' @@ -604,6 +610,9 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) filetype plugin on endif +" +" Vundle resets this if set inside vundle section. +" if &t_Co >= 256 || has('gui_running') colorscheme jellybeans hi clear SpellBad From 71fa894a78fbc9d3ab711a8c59a3d9a04b2b423e Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sun, 18 Mar 2018 00:21:44 +0000 Subject: [PATCH 12/19] backup.hdd.sh --- bin/backup.hdd.sh | 29 +++++++++++++++++++++++++++++ bin/backup.mybook.public.sh | 17 ----------------- 2 files changed, 29 insertions(+), 17 deletions(-) create mode 100755 bin/backup.hdd.sh delete mode 100755 bin/backup.mybook.public.sh diff --git a/bin/backup.hdd.sh b/bin/backup.hdd.sh new file mode 100755 index 0000000..12192a4 --- /dev/null +++ b/bin/backup.hdd.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +DATE=/bin/date +SYNC=/usr/bin/rsync +TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z` +HDD=/mnt/hdd +HDD_MIRROR=/mnt/hdd2 + +LOGFILE=/mnt/hdd/backup/backup.mybook.public.$TIMESTAMP.log +LOG=/usr/bin/tee -a $LOGFILE + +echo Starting $LOG | $LOG +echo start `$DATE` | $LOG + + +function backup() { + DIR=$1 + MIRROR_DIR=$(dirname $DIR) + $SYNC -auAXv --delete $HDD/$DIR $HDD_MIRROR/$MIRROR_DIR | $LOG +} + +backup "public/_captured_MY_VIDEO" +backup "public/pix" +#$SYNC /mnt/mybook/Public/music/* /mnt/hdd/public/ | tee -a $LOG +backup "public/books" +backup "vahagn" + +echo end `$DATE` | $LOG + diff --git a/bin/backup.mybook.public.sh b/bin/backup.mybook.public.sh deleted file mode 100755 index cde9c4e..0000000 --- a/bin/backup.mybook.public.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -DATE=/bin/date -SYNC="/usr/bin/rsync -auAX --delete" -TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z` - -LOG=/mnt/hdd/backup/backup.mybook.public.$TIMESTAMP.log -echo Starting $LOG | tee -a $LOG -echo start `$DATE` | tee -a $LOG -$SYNC /mnt/mybook/Public/_captured_MY_VIDEO /mnt/hdd/public/ | tee -a $LOG -$SYNC /mnt/mybook/Public/pix /mnt/hdd/public/ | tee -a $LOG -$SYNC /mnt/mybook/Public/music /mnt/hdd/public/ | tee -a $LOG -$SYNC /mnt/mybook/Public/books /mnt/hdd/public/ | tee -a $LOG -$SYNC /mnt/mybook/Public/map /mnt/hdd/public/ | tee -a $LOG -$SYNC /mnt/mybook/Public/src /mnt/hdd/public/ | tee -a $LOG -echo end `$DATE` | tee -a $LOG - From f5a3b82eac25edde99c48761b3459b10b605455b Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sun, 18 Mar 2018 00:27:33 +0000 Subject: [PATCH 13/19] Vundle.vim as submodule. --- .gitmodules | 3 +++ vim/bundle/Vundle.vim | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 vim/bundle/Vundle.vim diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d7a8ec7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vim/bundle/Vundle.vim"] + path = vim/bundle/Vundle.vim + url = https://github.com/VundleVim/Vundle.vim.git diff --git a/vim/bundle/Vundle.vim b/vim/bundle/Vundle.vim new file mode 160000 index 0000000..9a38216 --- /dev/null +++ b/vim/bundle/Vundle.vim @@ -0,0 +1 @@ +Subproject commit 9a38216a1c0c597f978d73547d37681fc689c90d From 7feb9493ca0c2add0933bf400a4308b881e040d5 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Tue, 27 Mar 2018 22:41:11 +0100 Subject: [PATCH 14/19] Removing old tmux commands from tmux.conf --- config/.tmux.conf | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/config/.tmux.conf b/config/.tmux.conf index 65ad295..d516468 100644 --- a/config/.tmux.conf +++ b/config/.tmux.conf @@ -10,7 +10,7 @@ set -g base-index 1 # Status bar is on top. set -g status-position top -set -g status-utf8 on +#set -g status-utf8 on # Keep this much of history per window. set -g history-limit 100000 @@ -23,8 +23,8 @@ setw -g xterm-keys on set -g status-keys vi setw -g mode-keys vi # Setup 'v' to begin selection as in Vim -bind-key -t vi-copy v begin-selection -bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" +#bind-key -t vi-copy v begin-selection +#bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" # Update default binding of 'Enter' to also use copy-pipe #unbind -t vi-copy Enter #bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" @@ -41,21 +41,21 @@ bind l select-pane -R #bind -r C-l resize-pane -R #No mouse -set -g mode-mouse off -set -g mouse-select-pane off -set -g mouse-resize-pane off -set -g mouse-select-window off +#set -g mode-mouse off +#set -g mouse-select-pane off +#set -g mouse-resize-pane off +#set -g mouse-select-window 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 mode-mouse off \;\ - set -g mouse-resize=pane off \;\ - set -g mouse-select-pane off \;\ - set -g mouse-select-window off \;\ - display '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 mode-mouse off \;\ +# set -g mouse-resize=pane off \;\ +# set -g mouse-select-pane off \;\ +# set -g mouse-select-window off \;\ +# display 'Mouse: OFF' From c547c1d15a9c4c1da15ee3799c4b64adebc9f59f Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Tue, 27 Mar 2018 22:42:24 +0100 Subject: [PATCH 15/19] adding 'git top ' --- config/.gitconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/.gitconfig b/config/.gitconfig index 537d598..ebf136e 100644 --- a/config/.gitconfig +++ b/config/.gitconfig @@ -7,13 +7,13 @@ [push] default = simple [alias] - tree = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold cyan)<%an>%Creset' --abbrev-commit --date=relative - drqs = "!f(){ git checkout -b feature/DRQS$1; }; f" - svnsync = "!f(){ git co master && git pull && ssh devgit svnsync $(git config --get remote.origin.url | cut -d : -f 2 );}; f" + tree = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold cyan)<%an>%Creset' --abbrev-commit --date=relative + top = "!f() { GIT_TOP=\"${GIT_DIR%%/.git/modules/*}\"; [ \".$GIT_TOP\" != \".$GIT_DIR\" ] && cd \"$GIT_TOP\"; exec \"$@\"; }; f" st = status br = branch co = checkout ci = commit + svnsync = "!f(){ git co master && git pull && ssh devgit svnsync $(git config --get remote.origin.url | cut -d : -f 2 );}; f" [merge] tool = vimdiff conflictstyle = diff3 From ad86b0608c25d51e923d2ac910519c54d196c99d Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Tue, 27 Mar 2018 22:48:18 +0100 Subject: [PATCH 16/19] fixing create_tag, adding git top dir lookup. --- config/.bashrc | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/config/.bashrc b/config/.bashrc index bc62c81..e444b75 100755 --- a/config/.bashrc +++ b/config/.bashrc @@ -282,6 +282,7 @@ function cgrep() { fi } + function create_tags() { #Bloomberg if [ -e /opt/swt/bin/ctags ]; then @@ -294,21 +295,19 @@ function create_tags() { CTAGS_OPT+='--totals=yes ' CTAGS_OPT+='--tag-relative=yes ' - CTAGS_DIR='.ctags_dir' - if [ -f $PWD/$CTAGS_DIR ]; then - CTAGS_ROOT="$PWD" - elif [ -f $PWD/../$CTAGS_DIR ]; then - CTAGS_ROOT="$PWD/.." - elif [ -f $PWD/../../$CTAGS_DIR]; then - CTAGS_ROOT="$PWD/../.." - else - CTAGS_ROOT="$PWD" + CTAGS_DIR_CFG='.ctags_dir' + CTAGS_ROOT="$PWD" + if [ ! -f $PWD/$CTAGS_DIR_CFG ]; then + GIT_ROOT=$(git top pwd) + if [ -f $GIT_ROOT/$CTAGS_DIR_CFG ]; then + CTAGS_ROOT="$GIT_ROOT" + fi fi - if [ -f $CTAGS_ROOT/$CTAGS_DIR ]; then + if [ -f $CTAGS_ROOT/$CTAGS_DIR_CFG ]; then CTAGS_SRC="-L $CTAGS_ROOT/$CTAGS_DIR" else - CTAGS_SRC="$%" + CTAGS_SRC="$@" fi cd $CTAGS_ROOT From 3fa2f20559953682863109bcbc4f8fbaa2ba0032 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Tue, 27 Mar 2018 22:56:46 +0100 Subject: [PATCH 17/19] Backup script. --- bin/backup.hdd.sh | 49 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/bin/backup.hdd.sh b/bin/backup.hdd.sh index 12192a4..1010268 100755 --- a/bin/backup.hdd.sh +++ b/bin/backup.hdd.sh @@ -1,29 +1,48 @@ #!/bin/bash DATE=/bin/date -SYNC=/usr/bin/rsync +RSYNC=/usr/bin/rsync TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z` -HDD=/mnt/hdd -HDD_MIRROR=/mnt/hdd2 LOGFILE=/mnt/hdd/backup/backup.mybook.public.$TIMESTAMP.log -LOG=/usr/bin/tee -a $LOGFILE - -echo Starting $LOG | $LOG -echo start `$DATE` | $LOG +LOG="/usr/bin/tee -a $LOGFILE" +function term() { + echo "Terminating." | $LOG + exit 1 +} +trap term INT function backup() { - DIR=$1 - MIRROR_DIR=$(dirname $DIR) - $SYNC -auAXv --delete $HDD/$DIR $HDD_MIRROR/$MIRROR_DIR | $LOG + ORIG_DIR=$1 + MIRROR_DIR=$2 + echo "Sync $ORIG_DIR to $MIRROR_DIR" + $RSYNC -aAXv --delete --force --progress $ORIG_DIR $MIRROR_DIR | $LOG } -backup "public/_captured_MY_VIDEO" -backup "public/pix" -#$SYNC /mnt/mybook/Public/music/* /mnt/hdd/public/ | tee -a $LOG -backup "public/books" -backup "vahagn" +function backuphdd() { + HDD_ORIG=/mnt/hdd + HDD_MIRROR=/mnt/hdd2 + ORIG_DIR=$HDD_ORIG/$1 + MIRROR_DIR=$HDD_MIRROR/$(dirname $1) + backup $ORIG_DIR $MIRROR_DIR +} +# +# Log Header +# +echo Starting $LOGFILE | $LOG +echo start `$DATE` | $LOG +# +# Sync folders +# +backuphdd "public/_captured_MY_VIDEO" +backuphdd "public/pix" +backuphdd "public/music" +backuphdd "public/books" +backuphdd "vahagn" +# +# Log Footer +# echo end `$DATE` | $LOG From 463c782e8e2a9d12d39e85c5438482c75cab1498 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sun, 22 Apr 2018 12:27:58 +0100 Subject: [PATCH 18/19] Detecting vundle and configuring localvimrc --- vim/vimrc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 442843f..042a143 100755 --- a/vim/vimrc +++ b/vim/vimrc @@ -397,24 +397,24 @@ nnoremap tl :tablast nnoremap tm :tabm nnoremap td :tabclose -" -" Locate and load .vimrc.local from curent directory. -" -if !exists('*LocalVimrcLoad') - runtime plugin/local-vimrc.vim -endif -call LocalVimrcLoad( getcwd() ) - """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Plugins " " -" Vundle experimental stuff here. +" Detect Vundle " -if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) +let s:vundle_path = '~/.vim/bundle/Vundle.vim' +if filereadable(expand('C:/devel/scripts/vim/bundle/Vundle.vim/README.md')) + let s:vundle_path = 'C:/devel/scripts/vim/bundle/Vundle.vim' +endif + +" +" Vundle stuff here. +" +if filereadable(expand(s:vundle_path.'/README.md')) filetype off - set rtp+=~/.vim/bundle/Vundle.vim + let &rtp=&rtp.','.s:vundle_path call vundle#begin() Plugin 'VundleVim/Vundle.vim' @@ -511,6 +511,8 @@ if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md')) " Local vimrc " Plugin 'embear/vim-localvimrc' + let g:localvimrc_name = [ ".vimrc.local" ] + let g:localvimrc_ask = 0 " " Comment code. From 9881a5d1d5ed3a55f829d052df5848009dd405e6 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Sun, 29 Apr 2018 08:05:48 +0100 Subject: [PATCH 19/19] jellybeans_use_gui_italics = 0 --- vim/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/vim/vimrc b/vim/vimrc index 042a143..e9b2904 100755 --- a/vim/vimrc +++ b/vim/vimrc @@ -563,6 +563,7 @@ if filereadable(expand(s:vundle_path.'/README.md')) if &t_Co >= 256 || has('gui_running') Plugin 'nanotech/jellybeans.vim' let g:jellybeans_use_lowcolor_black = 0 + let g:jellybeans_use_gui_italics = 0 "colorscheme jellybeans endif if &t_Co >= 256 || has('gui_running')