Site perso : Emmanuel Branlard
source /home/manu/Config/profiles/bashrc_common
#export PS1='\[\033[1m\]\[\033[1;33m\]\u:\[\e[32;1m\]\w \[\e[33;1m\]\$\[\033[m\] '
#export PS1="\033[33;40m[\u@\h \w]\\$\007 \033[0m\007"
#export PS1='\[\033[33;40m\][\u@\h \[\e[33;40m\]\w]\[\e[33;1m\]\$\[\033[m\] '
#########################################################
# PROGRAM PATHS and VARIABLES
#########################################################
#export MATLABPATH=/home/manu/Config/matlab
#path for listen music player
#export MOZILLA_FIVE_HOME=/usr/lib/iceweasel
#export LD_LIBRARY_PATH=/usr/lib/iceweasel
#/usr/lib/listen/listen.py "$@"
#intel fortran
#source /opt/intel/Compiler/11.1/069/bin/ifortvars.sh ia32
source /opt/intel-fortran/bin/ifortvars.sh ia32
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib/
#gpg --keyserver keyserver.ubuntu.com --recv 778978B00F7992B0
#gpg --export --armor 778978B00F7992B0 | sudo apt-key add -
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
#Killing PC BEEP
#xset -b
#setxkbmap -option compose:ralt
#########################################################
# ALIASES
#########################################################
# some more ls aliases
alias ll='ls -lhb'
alias lsnoco='ls -F --color=none --group-directories-first'
alias ls='ls -F --color=always --group-directories-first'
alias la='ls -lAXh'
alias lag='ls -lAgXh|grep'
alias lsd='ls -l|grep drwx'
alias dir='ls -1'
alias lad='ls -lAh|grep drwx'
alias cd..='cd ..'
alias grepnoco='grep --color=none'
alias grep='grep --color=always'
# systeme
alias reboot='sudo reboot'
alias vigrub='sudo vim /boot/grub/grub.cfg'
alias vix='sudo vim /etc/X11/xorg.conf'
alias viinit='sudo vim /etc/inittab'
alias gedit='geany'
alias mydiff='diff -a -b -B -w -y -i --suppress-common-lines '
alias mydiffb='diff -a -b -B -w -y -i '
alias mywget='wget -r -l5 -k -E '
alias df='df -hT |egrep -i "file|^/"'
alias duf='du --max-depth=1 -h '
alias R='R --no-save'
alias RR='R --no-init-file'
#
function ff {
grep -Inrsi $1 ./*
}
#
alias f=ff
# tracker
alias asearch='tracker-search '
alias tsearch='tracker-search -t '
alias msearch='tracker-search -m '
alias vsearch='tracker-search -v '
alias isearch='tracker-search -i '
alias lhm='xmodmap -e "pointer = 3 2 1 4 5 7 6 8 9"'
alias rhm='xmodmap -e "pointer = 1 2 3 4 5 6 7 8 9"'
#Aptitude
alias update='sudo aptitude update;sudo aptitude safe-upgrade'
alias api='sudo aptitude install '
alias aps='aptitude search '
alias apss='aptitude show '
alias apc='apt-cache policy '
#########################################################
# Vim Editing mode in Bash
#########################################################
set -o vi
# ^p check for partial match in history
bind -m vi-insert "\C-p":dynamic-complete-history
# ^n cycle through the list of partial matches
bind -m vi-insert "\C-n":menu-complete
# ^l clear screen
bind -m vi-insert "\C-l":clear-screen
#########################################################
# GVIM SINGLE INSTANCE
function gv {
if [ "$#" -eq "0" ]; then
/usr/bin/gvim --servername GVIMLOCAL
else
if echo "$*" | grep -q -- "--servername" ; then
# echo "Command already has --servername use it"
/usr/bin/gvim $*
else
#echo "Use default VIM server VIMLOCAL"
/usr/bin/gvim --servername GVIMLOCAL --remote-tab-silent $*
fi
fi
}
#alias gvim=gv
# alias gvim='gvim -p --remote-tab-silent'
# 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 [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
#gpg --keyserver keyserver.ubuntu.com --recv 778978B00F7992B0
#gpg --export --armor 778978B00F7992B0 | sudo apt-key add -
echo "--------------------------------------------------------------------"
echo "----------------------- BASH PROFILE -------------------------------"
echo "--------------------------------------------------------------------"
#if [ `tty` = "/dev/tty1" ]; then
# startx&
#fi
# Load X11
#if [ -z "$DISPLAY" ]; then
#export PS1='\[\033[1m\]\[\033[1;33m\]\u:\[\e[32;1m\]\w \[\e[33;1m\]\$\[\033[m\] '
#source .bashrc
PATH=$PATH:/home/manu/Config/scripts/
PATH=$PATH:/opt/cuda/bin/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib/
#For your .xinit you may want to use 'exec ck-launch-session dbus-launch --sh-syntax --exit-with-session startxfce4', it's what I have found to work better.
# if [ "$(tty)" = "/dev/tty1" ] ; then
if [ `ps -le|grep xinit|wc -l` == 0 ]; then
exec ck-launch-session startxfce4 ;
#xinit;
echo "";
echo "Bye Bye";
echo ""
source .bashrc
fi
# fi
# && [ $(tty) == /dev/tty1 ]; then
# startx&
#fi
echo "--------------------------------------------------------------------" echo "----------------------- BEGIN XINITRC ------------------------------" echo "--------------------------------------------------------------------" ############################# # This file is not used by nodm, see .xsession ############################# #if [ -x /usr/bin/numlockx ] #then # /usr/bin/numlockx on #fi #/usr/bin/xsetnumlock& #xterm config xrdb ~/.Xdefaults #if which dbus-launch > /dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS" ; then # eval "$(dbus-launch --sh-syntax --exit-with-session)" #fi #/home/manu/Config/scripts/ScreenConf.sh #exec ck-launch-session startxfce4 #setxkbmap -option terminate:ctrl_alt_bksp setxkbmap -option compose:ralt #bootchart # exec xfce4-session exec ck-launch-session xfce4-session; setxkbmap -option compose:ralt #exec startxfce4 #fluxbox #blackbox #icewm #sawfish # echo "--------------------------------------------------------------------" echo "------------------------- END XINITRC ------------------------------" echo "--------------------------------------------------------------------"
echo "--------------------------------------------------------------------" echo "----------------------- BEGIN XSESSION ---------------------------" echo "--------------------------------------------------------------------" ############################# # This file is not used by nodm, see .xsession ############################# #if [ -x /usr/bin/numlockx ] #then # /usr/bin/numlockx on #fi #/usr/bin/keytouchd& # /home/share/Config/_MyScripts/cnx-vjk.sh #/etc/init.d/init-cnx-vjk.sh& #/usr/bin/xsetnumlock& #xterm config #xrdb ~/.Xdefaults #if which dbus-launch > /dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS" ; then # eval "$(dbus-launch --sh-syntax --exit-with-session)" #fi #exec ck-launch-session startxfce4 #exec startxfce4 #setxkbmap -option compose:ralt
! xterm ---------------------------------------------------------------------- xterm*faceName: monospace:pixelsize=14 !xterm*dynamicColors: true !xterm*utf8: 2 !xterm*eightBitInput: true xterm*scrollTtyKeypress: true xterm*scrollTtyOutput: false xterm*scrollBar: true xterm*rightScrollBar: true xterm*jumpScroll: true xterm*multiScroll: true xterm*background: black xterm*foreground: green xterm*title : xterm xterm*vt100.geometry : 80x28 XTerm*reverseVideo : on XTerm*SaveLines: 1000 !xterm*iconPixmap: /home/share/Config/_Apparence/xapp.xbm !xterm*iconMask: /home/share/Config/_Apparence/xapp-mask.xbm ! Xcursor -------------------------------------------------------------------- Xcursor*theme: Vanilla-DMZ-AA Xcursor.size: 22 ! VIM stuffs Vim*foreground: Black Vim.background: white
set nocompatible
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Indent
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"'autoindent' uses the indent from the previous line.
"'smartindent' is like 'autoindent' but also recognizes some C syntax to
" increase/reduce the indent where appropriate.
"'cindent' Works more cleverly than the other two and is configurable to
" different indenting styles.
"'indentexpr' The most flexible of all: Evaluates an expression to compute
" the indent of a line. When non-empty this method overrides
" the other ones. See |indent-expression|.
set smartindent
set cindent
set tabstop=4
set shiftwidth=4 " 4 characters for indenting
set et " expand tab
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" From vimrc example
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" allow backspacing over everything in insert mode
set backspace=indent,eol,start whichwrap+=<,>,[,]
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set mouse=a
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" 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).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
" Detect filetype nd use syntax highlighting syntax enable
syntax on " syntax highlighing
filetype on
if has("gui_running")
set guifont=Monospace\ 10 " use this font
set background=light " adapt colors for background
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions+=b "add horizontal bar
colorscheme ManuWhite
set nospell
else
colorscheme ManuGreen " use this color scheme
set background=dark " adapt colors for background
set nospell
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Editor general
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" line numbering
set number
nnoremap \tn :set invnumber number?<CR>
" spell check
nnoremap \ts :set invspell spell?<CR>
" Sessions
set ssop=blank,buffers,curdir,folds,tabpages,winsize,resize,winpos
" used by CTRL-U and CTRL-D ? well, well well...
set scroll=4
set scrolloff=3
" always in the file directory
"set autochdir
"autocmd BufEnter * silent! lcd %:p:h
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Keywords
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set isk=a-z,A-Z,48-57,_,128-167,224-235
"set isk+=: " for latex in the ftplugin dir
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Wrapping and horizontal bar
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function ToggleHorizontalScrollbar()
"set guioptions+=b
if &go =~# "b"
set go-=b
else
set go+=b
endif
endfunc
set lbr " line break
noremap <F10> :set nowrap! <CR>
"~ map <F9> :set guioptions+=b <CR>
noremap <F11> :call ToggleHorizontalScrollbar()<CR>
noremap <F6> :set guioptions+=m <CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Search
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Press F3 to toggle highlighting on/off, and show current value.
noremap <F3> :set hlsearch! hlsearch?<CR>
set hlsearch
set incsearch " do incremental searching
set ignorecase " ignore case
set smartcase " but don't ignore it, when search string contains uppercase letters
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Completion
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set completeopt=menu,longest,preview
set showcmd " display incomplete commands at the bottom of the screen
set wildchar=<Tab> wildmenu wildmode=longest,list,full
set wildcharm=<C-Z>
set wildignore=*.o,*~,*.cmo,*.cmi,*.a,*.cmx,*.cmxa,*.aux,*.dvi,*.aut,*.bbl,*.blg,*.dvi,*.fff,*.ps,*.toc,*.ttt
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Foldinpeg
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"highlight Folded ctermfg=yellow ctermbg=NONE
"set foldtext=getline(v:foldstart)
set foldmethod=indent " fold indented regions
set foldminlines=1
set foldnestmax=2
set nofoldenable
set foldlevel=1 " fold from the beginning
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Tabs
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"tab firefox-like
nmap <C-t> :tabnew<CR>
nmap <C-S-tab> :tabprevious<CR>
nmap <C-tab> :tabnext<CR>
map <C-S-tab> :tabprevious<CR>
map <C-tab> :tabnext<CR>
imap <C-S-tab> <Esc>:tabprevious<CR>
imap <C-tab> <Esc>:tabnext<CR>
set showtabline=2 " always tabs visible
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Buffers
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Buffer explorer \be
" Bluid in features
" smart buffer switching pressing :b tab of F10
"nnoremap <F10> :b <C-Z>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Comment / Toggle comment
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Commenting blocks of code.
let b:comment_leader ='// '
autocmd FileType c,cpp,java,scala,php let b:comment_leader = '// '
autocmd FileType sh,ruby,python let b:comment_leader = '# '
autocmd FileType fortran let b:comment_leader = '! '
autocmd FileType conf,fstab let b:comment_leader = '# '
autocmd FileType tex,matlab let b:comment_leader = '% '
autocmd FileType mail let b:comment_leader = '> '
autocmd FileType vim let b:comment_leader = '" '
" mapping
noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
noremap <silent> ,ct :call ToggleComment(&ft)<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Windows like
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set winaltkeys=no
" CTRL-X are Cut
"vnoremap <C-X> "+x
"inoremap <C-x> <C-o>x
"noremap <C-x> x
" CTRL-C
" vnoremap <C-C> "+y
" CTRL-V
" map <C-V> "+gP
" cmap <C-V> <C-R>+
" Pasting blockwise and linewise selections is not possible in Insert and
" Visual mode without the +virtualedit feature. They are pasted as if they
" were characterwise instead.
" Uses the paste.vim autoload script.
exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
" Use CTRL-S for saving, also in Insert mode
noremap <C-S> :update<CR>
vnoremap <C-S> <C-C>:update<CR>
inoremap <C-S> <C-O>:update<CR>
" CTRL-Z is Undo; not in cmdline though
" noremap <C-Z> u
" inoremap <C-Z> <C-O>u
" CTRL-A is Select all
noremap <C-A> gggH<C-O>G
" noremap <C-A> ggVG
" inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
" cnoremap <C-A> <C-C>gggH<C-O>G
" onoremap <C-A> <C-C>gggH<C-O>G
" snoremap <C-A> <C-C>gggH<C-O>G
" xnoremap <C-A> <C-C>ggVG
" CTRL-Tab is Next window
"noremap <C-Tab> <C-W>w
"inoremap <C-Tab> <C-O><C-W>w
"cnoremap <C-Tab> <C-C><C-W>w
"onoremap <C-Tab> <C-C><C-W>w
"""
" CTRL-Tab is Next window
"noremap <C-Tab> <C-W>w
"inoremap <C-Tab> <C-O><C-W>w
"cnoremap <C-Tab> <C-C><C-W>w
"onoremap <C-Tab> <C-C><C-W>w
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Windows
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" resize in horizontal mode
map - <C-W>-
map + <C-W>+
" resize in vertical mode ALT-SHIFT-[<>]:
map <M-<> <C-W><
map <M->> <C-W>>
imap <M-<> <C-W><
imap <M->> <C-W>>
imap <C-w> <C-o><C-w>
" min win height to 0, 1 default
set wmh=0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" INSERT MODE TWEAKS and COPY PASTE TWEAKS
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Dealing with long lines automaticaly...
nmap k g<Up>
nmap j g<Down>
" navigate without lifting hand off of keys
" imap <C-space> <Plug>IMAP_JumpForward
" imap <C-H> <Left>
" imap <C-J> <C-o>g<Down>
" imap <C-K> <C-o>g<Up>
" imap <C-L> <Right>
" imap <A-4> <C-o><End>
" imap <A-0> <C-o><Home>
" duplicate line
inoremap <A-d> <C-o>yy<C-o>P<Down>
noremap <A-d> yyp
"inoremap <M-D> <C-o>yy<C-o>P<Down>
"inoremap <M-D> <C-o>yy<C-o>P<Down>
"noremap <M-D> yyp
set clipboard=unnamed
set sessionoptions+=resize
" insert only one character, enabling repetitions as '5s '
function! RepeatChar(char, count)
return repeat(a:char, a:count)
endfunction
nnoremap s :<C-U>exec "normal i".RepeatChar(nr2char(getchar()), v:count1) <CR>
" Ctrl-j/k deletes blank line below/above, and Alt-j/k inserts.
" nnoremap <silent><A-J> m`:silent +g/\m^\s*$/d<CR>``:noh<CR>
" nnoremap <silent><A-K> m`:silent -g/\m^\s*$/d<CR>``:noh<CR>
" nnoremap <silent><A-j> :set paste<CR>m`o<Esc>``:set nopaste<CR>
" nnoremap <silent><A-k> :set paste<CR>m`O<Esc>``:set nopaste<CR>
" Eclipse-like parenthesis handling
" imap ( ()<Left>
" imap { {}<Left>
" imap (* (* *)<Left><Left><Left>
" Same for quotes, except in vim files (where " is comment, obviously)
" au BufRead if &ft != 'vim' | inoremap " ""<Left> | endif
" 'Escapes' for the above
" imap (( (
" imap () ()
" imap {{ {
" imap "" ""
" imap {} {}
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VIM-LATEX
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on
" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
let g:Tex_Menus=0
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Latex compilation
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_MultipleCompileFormats=''
let g:Tex_FormatDependency_pdf = ''
let g:Tex_CompileRule_pdf = 'pdflatex -interaction=nonstopmode $*;'
let g:Tex_CompileRule_dvi = 'latex --interaction=nonstopmode $*;'
let g:Tex_CompileRule_ps = 'dvips -Ppdf -o $*.ps $*.dvi;'
let g:Tex_UseMakeFile = 1
let g:Tex_GotoError=0 " if set to 1 then after \ll then vim will go to the next error
" Inverse search
"let g:Tex_ViewRule_pdf = '"C:\bin\SumatraPDF\SumatraPDF.exe" -inverse-search "gvim -c \":RemoteOpen +\%l \%f\""'
"remember command for dynamicly changing warning level :TCLevel 3
let g:Tex_IgnoredWarnings =
\'/usr/share'."\n".
\'/texmf'."\n".
\'Underfull'."\n".
\'Overfull'."\n".
\'specifier changed to'."\n".
\'You have requested'."\n".
\'Missing number, treated as zero.'."\n".
\'There were undefined references'."\n".
\'Citation %.%# undefined'."\n".
\'Label'."\n".
\'Warning'
let g:Tex_IgnoreLevel = 11
"Latex Folding
let g:Tex_FoldedSections='part,chapter,section'
let g:Tex_FoldedEnvironments=''
let g:Tex_FoldedCommands=''
let g:Tex_FoldedMisc=''
let g:Tex_AutoFolding=1
let g:Tex_Folding=1
"To put in a *.latexmain to override for a project
"let Tex_DefaultTargetFormat = 'pdf'
"let g:Tex_MultipleCompileFormats='pdf'
"let Tex_FormatDependency_pdf = 'dvi,ps,pdf'
"let Tex_CompileRule_dvi = 'latex --interaction=nonstopmode $*'
"let Tex_CompileRule_ps = 'dvips -Ppdf -o $*.ps $*.dvi ;echo "Rule DVI>PS defined in Main"; read A'
"let Tex_CompileRule_pdf = 'ps2pdf $*.ps ;echo "Rule PS>PDF defined in Main"; read A'
"let g:Tex_ProjectSourceFiles ='bib/*.bib,tex/*.tex'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sessions
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"~ function! SaveSession()
"~ if v:this_session != ""
"~ echo "Saving."
"~ exe 'mksession! ' . '"' . v:this_session . '"'
"~ else
"~ echo "No Session."
"~ endif
"~ endfunction
"~
"~ au VimLeave * :call SaveSession()
"~
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Matlab
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
source $VIMRUNTIME/macros/matchit.vim
autocmd BufEnter *.m compiler mlint
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SpellCheck
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set mousemodel=popup_setpos
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" OmniCpp
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" omnicppcomplete options
set tags+=~/.vim/tags/tags_cpp
map <F12> :!ctags -R --c++-kinds=+pl --fields=+iaS --extra=+q .<CR><CR>
" add current directory's generated tags file to available tags
set tags+=./tags
" --- OmniCppComplete ---
" -- required --
set nocp " non vi compatible mode
filetype plugin on " enable plugins
" -- configs --
let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype (i.e. parameters) in popup window
let OmniCpp_MayCompleteDot = 1 " autocomplete with .
let OmniCpp_MayCompleteArrow = 1 " autocomplete with ->
let OmniCpp_MayCompleteScope = 1 " autocomplete with ::
let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert)
let OmniCpp_LocalSearchDecl = 1 " don't require special style of function opening braces
" automatically open and close the popup menu / preview window
" au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
" set completeopt=menuone,menu,longest,preview
" auto close options when exiting insert mode or moving away
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
set completeopt=menu,menuone
" Setup the tab key to do autocompletion
function! CompleteTab()
let prec = strpart( getline('.'), 0, col('.')-1 )
if prec =~ '^\s*$' || prec =~ '\s$'
return "\<tab>"
else
return "\<c-x>\<c-o>"
endif
endfunction
inoremap <tab> <c-r>=CompleteTab()<cr>