Skip to content

Instantly share code, notes, and snippets.

@aruhier
Created January 22, 2014 15:56
Show Gist options
  • Save aruhier/8561274 to your computer and use it in GitHub Desktop.
Save aruhier/8561274 to your computer and use it in GitHub Desktop.
My .vimrc
" All system-wide defaults are set in $VIMRUNTIME/archlinux.vim (usually just
" /usr/share/vim/vimfiles/archlinux.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vimrc), since archlinux.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing archlinux.vim since it alters the value of the
" 'compatible' option.
set runtimepath=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""" VUNDLE """"""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'davidhalter/jedi-vim'
Bundle 'LaTeX-Box'
Bundle 'git://vim-latex.git.sourceforge.net/gitroot/vim-latex/vim-latex'
Bundle 'gvim-pdfsync'
Bundle 'xolox/vim-easytags'
Bundle 'xolox/vim-misc'
Bundle 'AutoClose'
Bundle 'Tagbar'
"" Print syntax errors
Bundle 'Syntastic'
"""" Autocomplete code tricks
Bundle 'Shougo/neosnippet'
Bundle 'honza/vim-snippets'
""""
"" Multiple cursors, with ctrl+n
Bundle 'terryma/vim-multiple-cursors'
"" Autocomplete
Bundle 'Shougo/neocomplete'
Bundle 'SuperTab'
Bundle 'git://github.com/altercation/vim-colors-solarized.git'
"" Airline
Bundle 'bling/vim-airline'
"""" Git support
Bundle 'airblade/vim-gitgutter'
Bundle 'tpope/vim-fugitive'
""""
"""" Depends
Bundle 'vim-addon-mw-utils'
Bundle 'tlib'
""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""" GENERAL CONFIGURATION """""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages.
runtime! archlinux.vim
" If you prefer the old-style vim functionalty, add 'runtime! vimrc_example.vim'
" Or better yet, read /usr/share/vim/vim72/vimrc_example.vim or the vim manual
" and configure vim to your own liking!
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" filetype plugin indent on
"endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
set mouse=a " Enable mouse usage (all modes)
set nu " Line numbers
set laststatus=2 " Enable status
set statusline=%<%f%h%m%r%=%l,%c\ %P
set noerrorbells " No beep
autocmd BufWritePre * :%s/\s\+$//e " Delete whitespace at the endline
set tabstop=4 " Ident of 4 whitespaces
set shiftwidth=4
set expandtab
set autoindent " Text indenting
set softtabstop=4
set scrolloff=10 " 10 lines before and after the cursor position
set hlsearch " Highlight of results
set t_Co=256 " 256 colors mode
" set t_Co=16
"set textwidth=80 " Make lines width to 80 characters
set colorcolumn=80
autocmd BufEnter {*.c,*.cpp,*.java,*.py,*.sh,*.tex} set textwidth=79
set encoding=utf-8
" Remapping
noremap tt :tabprevious<CR>
noremap ty :tabnext<CR>
noremap \al :set textwidth=79 <Bar> normal gggqG<CR>
" Syntax
syntax on
syntax sync fromstart
" Color
":colorscheme xoria256
":colorscheme zenburn
colorscheme solarized
"AUTOCOMPLETION
set wildmenu
set wildmode=list:longest,full
set wildignore+=*.pyc,*.o,*.aux,*.toc,*.dvi " ignored on autocomplete
set completeopt=longest,menu,menuone,preview " cool completion view
set complete=.,w,b,u,U,t,i " mega tab completion
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" OmniCppComplete
set nocp
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_MayCompleteDot = 1
let OmniCpp_MayCompleteArrow = 1
let OmniCpp_MayCompleteScope = 1
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
" automatically open and close the popup menu / preview window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
"SYNTAX/LAYOUT
filetype plugin indent on " automatic recognition of filetype
filetype plugin on
""set nowrap " no wrap
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
" Python
autocmd BufRead *.py nmap <F5> :!python %<CR>
" Makefile
"Make vim turn *off* expandtab for files named Makefile or makefile
"We need the tab literal
"
autocmd BufNewFile,BufRead [Mm]akefile* set noexpandtab
" Spell Check
set spelllang=fr
" Spell Check for *.txt and *.tex :
autocmd BufEnter {*.txt,*.tex} set spell spelllang=fr
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""" EXTENSIONS """"""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Airline
""""""""""
"" Need to install ttf-powerline-fonts-git in AUR
let g:airline_powerline_fonts = 1
" Eclim
""""""""
let g:EclimCompletionMethod = 'omnifunc'
" LatexSuite
"""""""""""""
let g:tex_flavor = "latex"
let g:Tex_DefaultTargetFormat = "pdf"
let g:Tex_SmartKeyQuote = 0
let g:Tex_CompileRule_pdf = 'pdflatex -synctex=1 -interaction=nonstopmode $*'
"let g:tex_conceal = ""
""""" Latexsuite, french caracters (éàè, etc...)
""""" CREATE OR EDIT THE FILE ~/.vim/bundle/vim-latex/ftplugin/tex.vim, and
""""" add :
"" imap <C-b> <Plug>Tex_MathBF
"" imap <C-c> <Plug>Tex_MathCal
"" imap <C-l> <Plug>Tex_LeftRight
"" imap <buffer> <leader>it <Plug>Tex_InsertItemOnThisLine
" Neocomplete
""""""""""""""
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#enable_auto_close_preview = 1
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
let g:neocomplete#disable_auto_complete = 1
" Disable popup menu when navigating in insert mode
let g:neocomplete#enable_insert_char_pre = 1
let g:neocomplete#sources#syntax#min_keyword_length = 2
" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup()
"""" Compatibility with jedi-vim
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
autocmd FileType python setlocal omnifunc=jedi#completions
let g:jedi#auto_vim_configuration = 0
let g:jedi#popup_on_dot = 0
let g:neocomplete#force_omni_input_patterns.python = '[^. \t]\.\w*'
""""
autocmd BufEnter {*.c,*.cpp,*.html,*.js,*.java,*.php,*.py,*.sh,*.tex}
\ let g:neocomplete#disable_auto_complete = 0
" Neosnippet
"""""""""""""
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
"For snippet_complete marker.
" if has('conceal')
" set conceallevel=2 concealcursor=i
" endif
" Syntastic
""""""""""""
let g:syntastic_check_on_open = 1
let g:syntastic_c_compiler = 'gcc'
let g:syntastic_cpp_compiler = 'gcc'
let g:syntastic_c_compiler_options = ' -Wall -Wextra -Werror -pedantic'
let g:syntastic_cpp_compiler_options = ' -Wall -Wextra -Werror'
noremap <F7> :Errors<CR>
" Tagbar
"""""""""
let g:tagbar_left = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment