aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Braendli <matthias.braendli@u-blox.com>2013-12-09 16:27:55 +0100
committerMatthias Braendli <matthias.braendli@u-blox.com>2013-12-09 16:56:13 +0100
commit353533ad264500ab00f990303751dd4b2819cc34 (patch)
tree01462458ad9e736b9f01cc45022e89a79d95419d
parent8e8f67761759c3d9891643c47d9a5d2b454b090b (diff)
downloadvimrc-353533ad264500ab00f990303751dd4b2819cc34.tar.gz
vimrc-353533ad264500ab00f990303751dd4b2819cc34.tar.bz2
vimrc-353533ad264500ab00f990303751dd4b2819cc34.zip
add .vimrc
-rw-r--r--dotvimrc199
1 files changed, 199 insertions, 0 deletions
diff --git a/dotvimrc b/dotvimrc
new file mode 100644
index 0000000..9cb9c16
--- /dev/null
+++ b/dotvimrc
@@ -0,0 +1,199 @@
+syn on
+set ignorecase
+set smartcase
+set modeline
+set modelines=5
+set nocompatible
+set wildmode=longest:full
+set wildmenu
+set hlsearch
+set pastetoggle=<F10>
+set tw=0
+set backspace=eol,indent,start
+set number
+"set mouse=a "Disabled
+set grepprg=grep\ -nH\ $*
+let g:tex_flavor = "latex"
+set path=$PWD/**
+
+set runtimepath+=~/.vim/bundle/neobundle.vim/
+
+"if has("autocmd") && exists("+omnifunc")
+ "autocmd Filetype *
+ "\ if &omnifunc == "" |
+ "\ setlocal omnifunc=syntaxcomplete#Complete |
+ "\ endif
+"endif
+
+call neobundle#rc(expand('~/.vim/bundle/'))
+
+" Let NeoBundle manage NeoBundle
+NeoBundleFetch 'Shougo/neobundle.vim'
+
+" Recommended to install
+" After install, turn shell ~/.vim/bundle/vimproc, (n,g)make -f your_machines_makefile
+NeoBundle 'Shougo/vimproc'
+
+NeoBundle 'mileszs/ack.vim.git'
+NeoBundle 'motemen/git-vim.git'
+NeoBundle 'https://bitbucket.org/abudden/taghighlight'
+NeoBundle 'git-time-lapse'
+NeoBundle 'textobj-user'
+NeoBundle 'lucapette/vim-textobj-underscore.git'
+NeoBundle 'Rip-Rip/clang_complete.git'
+NeoBundle 'tpope/vim-surround.git'
+NeoBundle 'taglist.vim'
+NeoBundle 'ifdef-highlighting'
+NeoBundle 'tpope/vim-speeddating' " can do C-A and C-X on dates!
+
+filetype plugin on
+filetype indent on
+
+if has("gui_running")
+ colorscheme bramwombat
+
+ if has("gui_gtk2")
+ set guifont=Inconsolata\ Medium\ 12
+ elseif has("gui_win32")
+ set guifont=Lucida_Console:h10:cANSI
+ endif
+
+else
+ colorscheme desert
+endif
+
+hi scalaNew gui=underline
+hi scalaMethodCall gui=italic
+hi scalaValName gui=underline
+hi scalaVarName gui=underline
+"folding
+set foldcolumn=2
+set foldmethod=marker
+
+" tabs are 4 space by default
+set shiftwidth=4
+set tabstop=4
+set expandtab
+
+"Nice statusbar
+set laststatus=2
+set statusline=
+set statusline+=%-3.3n\ " buffer number
+set statusline+=%f\ " file name
+set statusline+=%h%m%r%w " flags
+set statusline+=\[%{strlen(&ft)?&ft:'none'}, " filetype
+set statusline+=%{&fileencoding}, " encoding
+set statusline+=%{&fileformat}]\ " file format
+set statusline+=%{strftime('%a\ %b\ %e\ %H:%M')} " hour
+set statusline+=%= " right align
+set statusline+=0x%-8B\ " current char
+set statusline+=%-14.(%l,%c%V%)\ %<%P " offset
+
+"tags
+set tags=tags,./tags,../tags,../../tags
+
+"C syntax for ellisys files
+autocmd BufNewFile,BufRead *.usbs set filetype=c
+
+"C syntax for ARM Scatterfiles
+autocmd BufNewFile,BufRead *.scat set filetype=c
+
+"ARM Assembler for .s files
+autocmd BufNewFile,BufRead *.s set filetype=armasm
+
+"Markdown, not modula2
+autocmd BufNewFile,BufRead *.md set filetype=markdown
+
+set nostartofline
+
+"F4 switches from C source .c to header .h file
+function! MPB_LoadFile(filename)
+ let s:bufname = bufname(a:filename)
+ if (strlen(s:bufname)) > 0
+ " File already in a buffer
+ exe ":buffer" s:bufname
+ else
+ " Must open file first
+ exe ":e " a:filename
+ endif
+endfun
+
+
+function! MPB_Flip_Ext()
+ " Switch editing between .c(XYZ) and .h(XYZ) files.
+ if match(expand("%"),'\.c') > 0
+ let s:flipname = substitute(expand("%"),'\.c\(.*\)','.h\1',"")
+ exe ":call MPB_LoadFile(s:flipname)"
+ elseif match(expand("%"),'\.h') > 0
+ let s:flipname = substitute(expand("%"),'\.h\(.*\)','.c\1',"")
+ exe ":call MPB_LoadFile(s:flipname)"
+ endif
+endfun
+
+function! MPB_Flip_Cpp_H()
+ " Switch editing between .c(XYZ) and .h(XYZ) files.
+ if match(expand("%"),'\.cpp') > 0
+ let s:flipname = substitute(expand("%"),'\.cpp','.h',"")
+ exe ":call MPB_LoadFile(s:flipname)"
+ elseif match(expand("%"),'\.h') > 0
+ let s:flipname = substitute(expand("%"),'\.h','.cpp',"")
+ exe ":call MPB_LoadFile(s:flipname)"
+ endif
+endfun
+
+map <F4> :call MPB_Flip_Ext()<CR>
+map <F3> :call MPB_Flip_Cpp_H()<CR>
+
+"Show trailing whitespace
+highlight ExtraWhitespace ctermbg=darkgreen guibg=#344011
+autocmd BufEnter * exe ':2match ExtraWhitespace /\s\+$\| \+\ze\t\|\t\+\ze /'
+
+" F5 sets the search register to the word under cursor, without moving
+" the cursor
+map <F5> :let @/ = expand('<cword>')<CR>:3match none<CR>
+
+" F6: Highlight the word under cursor in darkcyan
+highlight ManualHighlight ctermbg=darkcyan guibg=darkcyan
+map <F6> :exe printf('match ManualHighlight /%s/', escape(expand('<cword>'), '/\'))<CR>
+
+"if has("gui_running")
+" " auto highlight word under cursor
+" highlight WordUnderCursor ctermbg=darkred guibg=#552211
+" autocmd CursorMoved * exe printf('3match WordUnderCursor /\V\<%s\>/', escape(expand('<cword>'), '/\'))
+"endif
+
+"Show tabs
+set listchars=tab:›\ ,trail:␣
+set list
+
+"clang_complete options
+set completeopt=menu,menuone,longest
+"let g:clang_complete_copen=1
+
+"some CScope maps
+map <Leader>fs :cscope f s <cword><Enter>
+
+if has("cscope")
+ " add any database in current directory
+ if filereadable("cscope.out")
+ cs add cscope.out
+ " else add database pointed to by environment
+ elseif $CSCOPE_DB != ""
+ cs add $CSCOPE_DB
+ endif
+endif
+
+"short tag and tselect
+map <Leader>[ :tselect <C-r><C-w><CR>
+map <Leader>] :tag <C-r><C-w><CR>
+
+"GIT timelapse
+map <Leader>gt :call TimeLapse()<cr>
+
+"very magic search
+map <Leader>/ /\v
+
+"remove adding stars in comments
+set formatoptions-=ro
+
+NeoBundleCheck