Merge branch 'master' of bitbucket.org:vishap/scripts

This commit is contained in:
2017-07-01 17:30:39 +04:00
29 changed files with 1198 additions and 650 deletions

2
.gitignore vendored
View File

@@ -1,2 +1,4 @@
*.swp
*.swo
vim/bundle

2
bin/socks5_on_1080.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
ssh -f -N -D 192.168.0.3:1080 yerevak.vostan.org

332
config/.bashrc Executable file
View File

@@ -0,0 +1,332 @@
#!/bin/bash
# ~/.bashrc skeleton
# ~/.bashrc runs ONLY on non-login subshells! (different from ksh)
# add lines here very carefully as this may execute when you don't i
# expect them to
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#echo "BASHRC has run"
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Source global definitions
#
if [ -f /etc/bashrc ]; then
. /etc/bashrc
else
if ! shopt -q login_shell ; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. $i
else
. $i &>/dev/null
fi
fi
done
unset i
fi
fi
umask 002
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Find out system details.
#
os=`uname -o` #GNU/Linux AIX Solaris
cpu=`uname -p` #x86_64 powerpc sparc
kernel=`uname -s` #Linux AIX SunOS
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
#
if [ -n "$PS1" ]; then
#
# If there is no terminal info in the system for current terminal but there is
# one in local terminfo then use it.
#
tput -T $TERM longname 2>/dev/null >/dev/null
if [ "$?" -ne "0" ] && [ -f $HOME/.terminfo/$kernel/${TERM:0:1}/$TERM ]; then
export TERMINFO=$HOME/.terminfo/$kernel;
fi
#
# Number of colors and standard colors.
#
c_num=$(tput colors)
# regular foreground
c_red=$(tput setaf 1)
c_green=$(tput setaf 2)
c_orange=$(tput setaf 3)
c_blue=$(tput setaf 4)
c_pink=$(tput setaf 5)
c_cyan=$(tput setaf 6)
c_white=$(tput setaf 7)
c_viol=$(tput setaf 12)
# bold foreground
#cbf_red=$(tput bold; tput setaf 1)
#
# Load better colors for ls.
#
if [ $c_num -ge 256 ] && [ -f ~/.dir_colors ]; then
eval $(dircolors ~/.dir_colors)
fi
fi
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Prompt if interactive
#
if [ -n "$PS1" ]; then
#
# Set better colors if available.
#
if [ $c_num -ge 256 ]; then
c_reset="$(tput sgr0)"
c_user="$c_green"
c_cwd="$c_viol"
c_time="$c_pink"
c_branch="$c_cyan"
c_exit="$c_red"
c_jobs="$c_orange"
else
c_reset="$(tput sgr0)"
c_user="$c_green"
c_cwd="$c_viol"
c_time="$c_pink"
c_branch="$c_cyan"
c_exit="$c_red"
c_jobs="$c_orange"
fi
[ -n "$(which svn)" ] && prompt_check_svn=true
[ -n "$(which git)" ] && prompt_check_git=true
#
# 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:" # 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_reset\]\$ " # reset colors and print $
export PROMPT_COMMAND="__prompt_command; $PROMPT_COMMAND"
function __prompt_command()
{
#
# get exit code before any command is run.
# TODO: doesn't work on pi.
#
local exit_code="$?"
prompt_extra=""
#
# git branch if exist
#
if [ -n "$prompt_check_git" ]; then
local git_branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null | tr -d ' ')
if [ -n "$git_branch" ]; then
git_text="[$git_branch]"
else
git_text=""
fi
fi
#
# svn branch if exist
#
if [ -n "$prompt_check_svn" ]; then
local svn_rev=$(svn info . 2> /dev/null | awk -F ':' '/Revision:/ { print $2 }')
if [ -n "$svn_rev" ]; then
svn_text="[$svn_rev]"
else
svn_text=""
fi
fi
#
# exit code if not zero
#
if [ "$exit_code" -ne "0" ]; then
exit_text="[exit=$exit_code]"
else
exit_text=""
fi
#
# Info about jobs.
#
local jobs_bg=$(jobs -r | wc -l | tr -d ' ')
local jobs_stopped=$(jobs -s | wc -l | tr -d ' ')
if [ $jobs_bg -gt 0 ] || [ $jobs_stopped -gt 0 ]; then
jobs_text="[bg:$jobs_bg,stp:$jobs_stopped]"
else
jobs_text=""
fi
}
# Turn on checkwinsize
shopt -s checkwinsize
fi
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# User specific environment and startup programs
#
#
# 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 ] && [ -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
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
#
# colored GCC warnings and errors
#
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 ls='ls -a'
alias ll='ls -la'
alias pd='pushd >/dev/null'
alias bd='popd'
else
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
function cgrep() {
if [[ $# -eq 0 ]]
then
echo "Usage: codegrep <pattern> "
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
}
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
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.
#
[ -x $HOME/.bashrc.local ] && . $HOME/.bashrc.local
#
# Clean error level.
#
[ 1 ]

24
config/.ctags Normal file
View File

@@ -0,0 +1,24 @@
--verbose
--tag-relative=yes
--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*

300
config/.dir_colors Normal file
View File

@@ -0,0 +1,300 @@
# Dark 256 color solarized theme for the color GNU ls utility.
# Used and tested with dircolors (GNU coreutils) 8.5
#
# @author {@link http://sebastian.tramp.name Sebastian Tramp}
# @license http://sam.zoy.org/wtfpl/ Do What The Fuck You Want To Public License (WTFPL)
#
# More Information at
# https://github.com/seebi/dircolors-solarized
# Term Section
TERM Eterm
TERM ansi
TERM color-xterm
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM cons25
TERM console
TERM cygwin
TERM dtterm
TERM dvtm
TERM dvtm-256color
TERM eterm-color
TERM fbterm
TERM gnome
TERM gnome-256color
TERM jfbterm
TERM konsole
TERM konsole-256color
TERM kterm
TERM linux
TERM linux-c
TERM mach-color
TERM mlterm
TERM putty
TERM putty-256color
TERM rxvt
TERM rxvt-256color
TERM rxvt-cygwin
TERM rxvt-cygwin-native
TERM rxvt-unicode
TERM rxvt-unicode256
TERM rxvt-unicode-256color
TERM screen
TERM screen-16color
TERM screen-16color-bce
TERM screen-16color-s
TERM screen-16color-bce-s
TERM screen-256color
TERM screen-256color-bce
TERM screen-256color-s
TERM screen-256color-bce-s
TERM screen-256color-italic
TERM screen-bce
TERM screen-w
TERM screen.linux
TERM screen.xterm-256color
TERM st
TERM st-meta
TERM st-256color
TERM st-meta-256color
TERM tmux
TERM tmux-256color
TERM vt100
TERM xterm
TERM xterm-16color
TERM xterm-256color
TERM xterm-256color-italic
TERM xterm-88color
TERM xterm-color
TERM xterm-debian
TERM xterm-termite
## Documentation
#
# standard colors
#
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
#
#
# 256 color support
# see here: http://www.mail-archive.com/bug-coreutils@gnu.org/msg11030.html)
#
# Text 256 color coding:
# 38;5;COLOR_NUMBER
# Background 256 color coding:
# 48;5;COLOR_NUMBER
## Special files
NORMAL 00;38;5;244 # no color code at all
#FILE 00 # regular file: use no color at all
RESET 0 # reset to "normal" color
DIR 00;38;5;33 # directory 01;34
LINK 00;38;5;37 # symbolic link. (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
MULTIHARDLINK 00 # regular file with more than one link
FIFO 48;5;230;38;5;136;01 # pipe
SOCK 48;5;230;38;5;136;01 # socket
DOOR 48;5;230;38;5;136;01 # door
BLK 48;5;230;38;5;244;01 # block device driver
CHR 48;5;230;38;5;244;01 # character device driver
ORPHAN 48;5;235;38;5;160 # symlink to nonexistent file, or non-stat'able file
SETUID 48;5;160;38;5;230 # file that is setuid (u+s)
SETGID 48;5;136;38;5;230 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
STICKY_OTHER_WRITABLE 48;5;64;38;5;230 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 48;5;235;38;5;33 # dir that is other-writable (o+w) and not sticky
STICKY 48;5;33;38;5;230 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 00;38;5;64
## Archives or compressed (violet + bold for compression)
.tar 00;38;5;61
.tgz 00;38;5;61
.arj 00;38;5;61
.taz 00;38;5;61
.lzh 00;38;5;61
.lzma 00;38;5;61
.tlz 00;38;5;61
.txz 00;38;5;61
.zip 00;38;5;61
.z 00;38;5;61
.Z 00;38;5;61
.dz 00;38;5;61
.gz 00;38;5;61
.lz 00;38;5;61
.xz 00;38;5;61
.bz2 00;38;5;61
.bz 00;38;5;61
.tbz 00;38;5;61
.tbz2 00;38;5;61
.tz 00;38;5;61
.deb 00;38;5;61
.rpm 00;38;5;61
.jar 00;38;5;61
.rar 00;38;5;61
.ace 00;38;5;61
.zoo 00;38;5;61
.cpio 00;38;5;61
.7z 00;38;5;61
.rz 00;38;5;61
.apk 00;38;5;61
.gem 00;38;5;61
# Image formats (yellow)
.jpg 00;38;5;136
.JPG 00;38;5;136 #stupid but needed
.jpeg 00;38;5;136
.gif 00;38;5;136
.bmp 00;38;5;136
.pbm 00;38;5;136
.pgm 00;38;5;136
.ppm 00;38;5;136
.tga 00;38;5;136
.xbm 00;38;5;136
.xpm 00;38;5;136
.tif 00;38;5;136
.tiff 00;38;5;136
.png 00;38;5;136
.PNG 00;38;5;136
.svg 00;38;5;136
.svgz 00;38;5;136
.mng 00;38;5;136
.pcx 00;38;5;136
.dl 00;38;5;136
.xcf 00;38;5;136
.xwd 00;38;5;136
.yuv 00;38;5;136
.cgm 00;38;5;136
.emf 00;38;5;136
.eps 00;38;5;136
.CR2 00;38;5;136
.ico 00;38;5;136
# Files of special interest (base1)
.tex 00;38;5;245
.rdf 00;38;5;245
.owl 00;38;5;245
.n3 00;38;5;245
.ttl 00;38;5;245
.nt 00;38;5;245
.torrent 00;38;5;245
.xml 00;38;5;245
*Makefile 00;38;5;245
*Rakefile 00;38;5;245
*Dockerfile 00;38;5;245
*build.xml 00;38;5;245
*rc 00;38;5;245
*1 00;38;5;245
.nfo 00;38;5;245
*README 00;38;5;245
*README.txt 00;38;5;245
*readme.txt 00;38;5;245
.md 00;38;5;245
*README.markdown 00;38;5;245
.ini 00;38;5;245
.yml 00;38;5;245
.cfg 00;38;5;245
.conf 00;38;5;245
.h 00;38;5;245
.hpp 00;38;5;245
.c 00;38;5;245
.cpp 00;38;5;245
.cxx 00;38;5;245
.cc 00;38;5;245
.objc 00;38;5;245
.sqlite 00;38;5;245
.go 00;38;5;245
.sql 00;38;5;245
.csv 00;38;5;245
# "unimportant" files as logs and backups (base01)
.log 00;38;5;240
.bak 00;38;5;240
.aux 00;38;5;240
.lof 00;38;5;240
.lol 00;38;5;240
.lot 00;38;5;240
.out 00;38;5;240
.toc 00;38;5;240
.bbl 00;38;5;240
.blg 00;38;5;240
*~ 00;38;5;240
*# 00;38;5;240
.part 00;38;5;240
.incomplete 00;38;5;240
.swp 00;38;5;240
.tmp 00;38;5;240
.temp 00;38;5;240
.o 00;38;5;240
.pyc 00;38;5;240
.class 00;38;5;240
.cache 00;38;5;240
# Audio formats (orange)
.aac 00;38;5;166
.au 00;38;5;166
.flac 00;38;5;166
.mid 00;38;5;166
.midi 00;38;5;166
.mka 00;38;5;166
.mp3 00;38;5;166
.mpc 00;38;5;166
.ogg 00;38;5;166
.opus 00;38;5;166
.ra 00;38;5;166
.wav 00;38;5;166
.m4a 00;38;5;166
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axa 00;38;5;166
.oga 00;38;5;166
.spx 00;38;5;166
.xspf 00;38;5;166
# Video formats (as audio + bold)
.mov 00;38;5;166
.MOV 00;38;5;166
.mpg 00;38;5;166
.mpeg 00;38;5;166
.m2v 00;38;5;166
.mkv 00;38;5;166
.ogm 00;38;5;166
.mp4 00;38;5;166
.m4v 00;38;5;166
.mp4v 00;38;5;166
.vob 00;38;5;166
.qt 00;38;5;166
.nuv 00;38;5;166
.wmv 00;38;5;166
.asf 00;38;5;166
.rm 00;38;5;166
.rmvb 00;38;5;166
.flc 00;38;5;166
.avi 00;38;5;166
.fli 00;38;5;166
.flv 00;38;5;166
.gl 00;38;5;166
.m2ts 00;38;5;166
.divx 00;38;5;166
.webm 00;38;5;166
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
.axv 00;38;5;166
.anx 00;38;5;166
.ogv 00;38;5;166
.ogx 00;38;5;166

25
config/.gitconfig Normal file
View File

@@ -0,0 +1,25 @@
[user]
name = Vahagn Khachatryan
email = vahagn.khachatryan@gmail.com
[color]
diff = auto
status = auto
[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"
st = status
br = branch
co = checkout
ci = commit
[merge]
tool = vimdiff
conflictstyle = diff3
[mergetool]
prompt = false
[include]
path = ~/.gitconfig.local
[core]
excludesfile = ~/.gitignore.global

5
config/.gitignore.global Normal file
View File

@@ -0,0 +1,5 @@
*.swp
*.o
*.d
plink.log
llcalc_*

View File

@@ -1,19 +1,50 @@
#
# Ctrl-a is the prefix.
#
set -g prefix C-a
bind C-a send-prefix
unbind C-b
set-option -g history-limit 10000
# Start windows from #1 (default #0)
set -g base-index 1
# Status bar is on top.
set -g status-position top
set -g status-utf8 on
# Keep this much of history per window.
set -g history-limit 100000
# 256color mode.
set -g default-terminal "screen-256color"
setw -g xterm-keys on
# VI mode
set -g status-keys vi
setw -g mode-keys vi
set -g status-position top
# 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"
# 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"
#bind p paste-buffer
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
#bind -r C-h resize-pane -L
#bind -r C-j resize-pane -D
#bind -r C-k resize-pane -U
#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
bind m \
set -g mode-mouse on \;\
@@ -21,7 +52,8 @@ bind m \
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
bind m \
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 \;\

2
terminfo/README Normal file
View File

@@ -0,0 +1,2 @@
Hint: use 'tic' to compile terminfo files.
tic -o <dir> <file.terminfo>

View File

@@ -0,0 +1,27 @@
# Reconstructed via infocmp from file: /opt/bb/share/terminfo/s/screen-256color
screen-256color|GNU Screen with 256 colors,
am, km, mir, msgr, xenl,
colors#256, cols#80, it#8, lines#24, pairs#32767,
acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M,
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM,
cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0,
flash=\Eg, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@,
il=\E[%p1%dL, il1=\E[L, ind=^J, initc@, is2=\E)0, kbs=^H,
kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~,
kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O,
rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m,
rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7,
setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
sgr0=\E[m\017, smacs=^N, smcup=\E[?1049h, smir=\E[4h,
smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g,

View File

@@ -0,0 +1,51 @@
# Reconstructed via infocmp from file: /opt/bb/share/terminfo/x/xterm-256color
xterm-256color|xterm with 256 colors,
am, bce, ccc, km, mc5i, mir, msgr, npc, xenl,
colors#256, cols#80, it#8, lines#24, pairs#32767,
acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
ind=^J, indn=\E[%p1%dS,
initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~,
kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D,
kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^H,
kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l,
rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m,
rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,
smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,

View File

@@ -18,7 +18,7 @@ hi ModeMsg term=bold cterm=bold gui=bold
hi StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold
hi StatusLineNC term=reverse cterm=reverse gui=reverse
hi VertSplit term=reverse cterm=reverse gui=reverse
hi Visual term=reverse ctermbg=black guibg=grey60
hi Visual term=reverse ctermbg=DarkGray guibg=grey60
hi VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold
hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red
hi Cursor guibg=Green guifg=Black

View File

@@ -1,295 +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 <vahagn DOT khachatryan AT gmail DOT com>
"
" 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 <silent> <C-F5> :call CF5Compile(1)<CR>
" map <silent> <F5> :call CF5Compile(0)<CR>
"
" 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
"
" 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

View File

@@ -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 <EMAIL:hermitte {at} free {dot} fr>
" <URL:http://hermitte.free.fr/vim/>
" 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:

View File

@@ -18,7 +18,7 @@
"
" loaded_local_vimrc is set to 1 when initialization begins, and 2 when it
" completes.
if exists('g:loaded_locl_vimrc')
if exists('g:loaded_local_vimrc')
finish
endif
let g:loaded_local_vimrc=1
@@ -26,14 +26,22 @@ let g:loaded_local_vimrc=1
" Section: Event group setup
" Act when creating or loading a file
augroup LocalVimrc
au BufNewFile,BufRead * call s:LoadConfig()
au BufNewFile,BufRead * call s:LocalVimrcLoadForFile()
augroup END
" Function: LoadConfig()
"
" If the file .vimrc exists in the root of a git project - load it
function s:LoadConfig()
" If the file .vimrc exists in the path - load it
function s:LocalVimrcLoadForFile()
let l:path = fnameescape(expand("%:p:h"))
call g:LocalVimrcLoad( l:path )
endfunction
" Function: LocalVimrcLoad()
"
" If the file .vimrc exists in the path - load it
function! g:LocalVimrcLoad(path)
let l:path = a:path
if empty(l:path)
return
endif

489
vim/vimrc
View File

@@ -18,7 +18,7 @@ set fileformat=unix
set nobackup
"set backupdir="~/tmp,." git commit doesn't work.
" Try to set up UTF-8 encoding.
if has("multi_byte")
if has('multi_byte')
if &termencoding == ""
let &termencoding = &encoding
endif
@@ -38,7 +38,7 @@ set shiftwidth=4
" blanks according to softtabstop.
set smarttab
" Don't expand tabs.
set noexpandtab
set expandtab
if has('autocmd')
" Unset expandtab for make files in any case.
autocmd FileType make setlocal noexpandtab
@@ -82,12 +82,23 @@ set cino+=N-s
" lines.
set cino+=(0
" enable omni completion
set omnifunc=syntaxcomplete#Complete
" If modlines available then turn it on so each file could set its settings.
" ex. # vim: set expandtab:
if exists('+modeline')
set modeline
set modelines=5
endif
" read/write a .viminfo file, don't store more
if exists('+viminfo')
set viminfo='20,\"50
endif
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
@@ -100,8 +111,6 @@ set ttyfast "tf "smooths redraw by using more bandwidth
" 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 <F11> to toggle between 'paste' and 'nopaste'
@@ -111,6 +120,45 @@ set notimeout ttimeout ttimeoutlen=200
" Display
"
" Configure coloring on command line terminals.
if &term=="xterm"
" enable 256 colors
set t_Co=256
" set t_Co=8
set t_Sb=[4%dm
set t_Sf=[3%dm
endif
"
" Configure color theme, fonts and other graphics.
"
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
colorscheme vahagn_black_terminal
endif
" 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
endif
" wrap text at window edge without modifying buffer
set nowrap
" Scroll this much chars when scrolled horizontally.
@@ -127,16 +175,16 @@ set cmdheight=2
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')
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')
if exists('+confirm')
set confirm
endif
" Use visual bell instead of beeping when doing something wrong
if exists('&visualbell')
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
@@ -144,15 +192,17 @@ if exists('&visualbell')
set t_vb=
endif
" Display line numbers on the left
if exists('&number')
if exists('+number')
set number
endif
" Turn on spell check.
if exists("+spell")
if exists('+spell') && !&diff
set spell
highlight clear SpellBad
highlight SpellBad cterm=underline ctermfg=red gui=undercurl guisp=Red
endif
" Show 80th column.
if exists("+colorcolumn")
if exists('+colorcolumn')
set colorcolumn=+1 " color textwidth+1-th line
endif
@@ -165,12 +215,8 @@ 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
endif
" Highlight searched string as typed.
set incsearch
" Enable syntax highlighting
highlight DiffAdd cterm=none ctermfg=Black ctermbg=Green gui=none guifg=Black guibg=Green
@@ -181,36 +227,6 @@ highlight DiffText cterm=none ctermfg=Black ctermbg=Magenta gui=none guifg=Black
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
@@ -218,10 +234,25 @@ endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vimdiff
"
" Turn on spell check.
if &diff
"turn off spelling
set nospell
" ignore whitespaces
set diffopt+=iwhite
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TODO: review
"
@@ -244,12 +275,6 @@ if exists('&hidden')
set hidden
endif
" Modelined are used to configure files.
if exists('&modeline')
set modeline
set modelines=10
endif
" Set fold method if supported
if has('folding')
set nofoldenable
@@ -267,7 +292,7 @@ if has('folding')
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
if has('autocmd')
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
@@ -285,8 +310,6 @@ if has("autocmd")
" 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).
@@ -301,59 +324,17 @@ if has("autocmd")
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
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Commands
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Key Mappings
"
" F4 grep the word under cursor.
"map <F4> :execute "grep " . expand("<cword>") . " -r *.h *.cpp *.c *.f" <Bar> cw<CR>
map <F4> :execute "grep " . expand("<cword>") . " -r --include \*.h --include \*.cpp --include \*.c --include \*.f ." <Bar> cw<CR>
" Create a new tab.
map <silent> <C-F3> :tabnew<CR>
"
"command! -nargs=* PFdiff :!p4 diff <args> %
"
" Loads CF5Compile
" Compile and run file if Ctrl-F5 is pressed.
"
if !exists('*CF5Compile')
runtime plugin/cf5-compiler.vim
endif
map <silent> <C-F5> :call CF5Compile(1)<CR>
map <silent> <F5> :call CF5Compile(0)<CR>
"
" 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.
"
inoremap <C-U> <C-G>u<C-U>
"
" Move through wrapped lines instead of buffer lines.
"
noremap <Up> gk
noremap <Down> gj
imap <Up> <C-O>gk
imap <Down> <C-O>gj
"
" Working with tabs especially if using console version.
"
nnoremap th :tabfirst<CR>
nnoremap tj :tabnext<CR>
nnoremap tk :tabprev<CR>
nnoremap tl :tablast<CR>
nnoremap tm :tabm<Space>
nnoremap td :tabclose<CR>
"
" .gvimrc content here.
"
if has("gui_running")
if has('gui_running')
":tab drop {file}
" Hide show menu and toolbar.
@@ -366,23 +347,309 @@ if has("gui_running")
\set guioptions+=T <Bar>
\set showtabline=1 <Bar>
\endif <CR>
" Open file in a new tab.
if has("browsefilter")
let g:browsefilter = "All Files (*.*)\t*\n"
endif
else
" open ctag definition in new tab
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
" Create a new tab.
"map <silent> <C-F3> :tabnew<CR>
"
" Grep the word under cursor.
"
" Grep options affect GNU grep. The intend is that greps not supporting the
" options will continue working without options.
"
let $GREP_OPTIONS.=' --exclude-dir=.git --exclude-dir=.svn'
let $GREP_OPTIONS.=' --exclude=tags --exclude=*.o --exclude=*.log'
let $GREP_OPTIONS.=' --exclude=*.swp'
let $GREP_OPTIONS.=' --exclude-dir=llcalc* --exclude-dir=00*'
"let $GREP_OPTIONS.=' --include *.sh'
"let $GREP_OPTIONS.=' --include *.php'
"let $GREP_OPTIONS.=' --include *.h --include *.cpp --include *.c'
"let $GREP_OPTIONS.=' --include *.py'
"let $GREP_OPTIONS.=' --include *.java'
"let $GREP_OPTIONS.=' --include *.f'
"let $GREP_OPTIONS.=' --include *.xsd --include *.xml'
"let $GREP_OPTIONS.=' --include Makefile'
map af :execute "grep! ".expand("<cword>")." -r ." <Bar> cw<CR>
"
" 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.
"
inoremap <C-U> <C-G>u<C-U>
"
" Move through wrapped lines instead of buffer lines.
"
noremap <Up> gk
noremap <Down> gj
"imap <Up> <C-O>gk
"imap <Down> <C-O>gj
"
" Working with tabs especially if using console version.
"
nnoremap th :tabfirst<CR>
nnoremap tj :tabnext<CR>
nnoremap tk :tabprev<CR>
nnoremap tl :tablast<CR>
nnoremap tm :tabm<Space>
nnoremap td :tabclose<CR>
"
" 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.
"
if filereadable(expand("~/.vim/bundle/Vundle.vim/README.md"))
if filereadable(expand('~/.vim/bundle/Vundle.vim/README.md'))
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
"
" Adds nice status and tabline.
"
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 = '|'
let g:airline_powerline_fonts = 1
"
"
"
Plugin 'scrooloose/nerdtree'
let g:NERDTreeQuitOnOpen = 1
let g:NERDTreeDirArrows = 1
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
let g:NERDTreeIgnore = ['\.o$', '\.so$', '\.tsk$']
map at :NERDTreeToggle<CR>
"map am :NERDTreeFind<CR>
"
" 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 <C-n> :Explore<CR>
"map <C-m> :Explore %:p:h<CR>
"
" 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<CR>
"map at :BuffergatorTabsToggle<CR>
"
" :A switches to the header file (or vise versa)
" :AS splits and switches
" :AV vertical splits and switches
" :AT new tab and switches
" :AN cycles through matches
" :IH switches to file under cursor
" :IHS splits and switches
" :IHV vertical splits and switches
" :IHT new tab and switches
" :IHN cycles through matches
" <Leader>ih switches to file under cursor
" <Leader>is switches to the alternate file of file under
" cursor (e.g. on <foo.h> switches to foo.cpp)
" <Leader>ihn cycles through matches
"
Plugin 'vim-scripts/a.vim'
let g:alternateExtensions_h = "cpp,c"
let g:alternateExtensions_cpp = "h"
let g:alternateExtensions_c = "h"
map ah :A<CR>
"
" 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 <silent> ac :call CF5CompileOnly()<CR>
map <silent> ar :call CF5CompileAndRun()<CR>
"
" 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.
" gc - visual mode - comment selection.
"
Plugin 'tpope/vim-commentary'
nmap al <Plug>CommentaryLine
vmap al <Plug>Commentary
"
" Git wrapper.
"
Plugin 'tpope/vim-fugitive'
nmap git :Git
nmap gst :Gstatus
"
" Shows git diff.
" [c - jump prev diff
" ]c - jump nex diff
" <Leader>hs - stage the hunk
" <Leader>hr - revert the hunk
" :GitGutterNextHunk
" :GitGutterPrevHunk
" :GitGutterStageHunk
" :GitGutterRevertHunk
" :GitGutterToggle
" :GitGutterLineHighlightsToggle
"
Plugin 'airblade/vim-gitgutter'
let g:gitgutter_sign_column_always = 1
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.
"
"Plugin 'scrooloose/syntastic'
"let g:syntastic_cpp_compiler_options = ' -std=c++1y'
"let g:syntastic_mode_map = {
" \ "mode": "active",
" \ "active_filetypes": ["ruby", "php"],
" \ "passive_filetypes": ["c", "cpp"] }
"
" Nice colorschemes.
"
if has("gui_running")
Plugin 'nanotech/jellybeans.vim'
"colorscheme jellybeans
"let g:jellybeans_use_lowcolor_black = 0
endif
if has("gui_running")
Plugin 'altercation/vim-colors-solarized.git'
let g:solarized_termcolors=256
"set backgroung=dark
"set backgroung=light
"colorscheme solarized
endif
"
" :set syntax=cpp.doxygen to highlight doxygen comments.
"
Plugin 'vim-scripts/DoxyGen-Syntax'
"
" In vim, place the cursor on the line and
" :DoxLic - generates license comment.
" :DoxAuthor - skeleton and leave the cursor just after @author tag.
" :Dox - generates function/class comment.
" :DoxUndoc(DEBUG) - if you want to ignore all code fragment ifdefed with
" DEBUG.
" :DoxBlock -
"
Plugin 'vim-scripts/DoxygenToolkit.vim'
"
" Color table and picker.
" :XtermColorTable
" press: # to yank, t to toggle, f to set text color
"
"Plugin 'xterm-color-table.vim'
" Promising GDB manager.
"
Plugin 'vim-scripts/gdbmgr'
"
call vundle#end()
filetype plugin indent on
filetype plugin on
endif
if exists("dddd")
"Plugin 'Rip-Rip/clang_complete'
"Plugin 'flazz/vim-colorschemes'
"Plugin 'Valloric/YouCompleteMe'
"Plugin 'rhysd/vim-clang-format'
Plugin 'vim-scripts/Mark'
Plugin 'danro/rename.vim'
Plugin 'kana/vim-operator-user'
Plugin 'kien/ctrlp.vim'
let g:ctrlp_root_markers = ['.ctrlp']
let g:ctrlp_custom_ignore = {
\ 'file': '\v\.(o|d|dd)$',
\ }
Plugin 'majutsushi/tagbar'
map <C-t> :TagbarToggle<CR>
let g:tagbar_autoclose = 1
let g:tagbar_autofocus = 1
let g:tagbar_autoshowtag = 1
let g:tagbar_compact = 1
let g:tagbar_indent = 1
let g:tagbar_sort = 1
let g:tagbar_width = 60
let g:tagbar_ctags_bin = "/opt/swt/bin/ctags"
Plugin 'mattn/emmet-vim'
Plugin 'tmhedberg/matchit'
Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-unimpaired'
Plugin 'vim-scripts/Align'
Plugin 'vim-scripts/taglist.vim'
Plugin 'vim-scripts/xml.vim'
Plugin 'junegunn/vim-easy-align'
Plugin 'ntpeters/vim-better-whitespace'
let g:strip_whitespace_on_save = 1
"Plugin 'vim-scripts/TagHighlight'
"Plugin 'gcmt/taboo.vim'
"let g:taboo_tab_format = "[%m:%N:%W] %f"
" - - - - - - - - - - - - - -
" powerline
" - - - - - - - - - - - - - -
let g:Powerline_symbols = "unicode"
" Ack
Plugin 'mileszs/ack.vim'
let g:ack_default_options = " --ignore-file=is:tags -s -H --nocolor --nogroup --column"
let g:ack_highlight = 1
endif