Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " set UTF-8 encoding
- set enc=utf-8
- set fenc=utf-8
- set termencoding=utf-8
- " disable vi compatibility (emulation of old bugs)
- set nocompatible
- " use indentation of previous line
- set autoindent
- " use intelligent indentation for C
- set smartindent
- " set automatically in cpp files
- " set cindent
- " configure tabwidth and insert spaces instead of tabs
- set tabstop=4 " tab width is 4 spaces
- set shiftwidth=4 " indent also with 4 spaces
- set expandtab " expand tabs to spaces
- " wrap lines at 120 chars. 80 is somewaht antiquated with nowadays displays.
- set textwidth=120
- " set the working directory to wherever the open file lives
- autocmd BufEnter * silent! lcd %:p:h
- " turn syntax highlighting on
- syntax on
- " show eol
- set list
- " turn line numbers on
- set number
- " highlight matching braces
- set showmatch
- " intelligent comments
- set comments=sl:/*,mb:\ *,elx:\ */
- " set folding based on syntax
- " set foldenable
- set foldmethod=indent
- set foldnestmax=10
- set nofoldenable
- set foldlevel=2
- " ignore case on autocomplete
- set ignorecase
- set infercase
- set smartcase
- set sessionoptions=blank,buffers,curdir,folds,globals,options,resize,tabpages,winsize
- " Automatically save the session when leaving Vim
- autocmd! VimLeave * mksession! ~/.vim/default_session.vim
- " Automatically load the session when entering vim
- autocmd! VimEnter * source ~/.vim/default_session.vim
- " tags for C++
- set tags+=~/.vim/tags/cpp
- set tags+=~/.vim/tags/gl
- set tags+=~/.vim/tags/sdl
- set tags+=~/.vim/tags/qt4
- set tags+=~/.vim/tags/qt5
- set tags+=~/.vim/commontags
- " autocompletion options
- set wildmenu
- set wildmode=longest:list,full
- " set wildcharm=<tab>.
- if has("gui_running")
- set guioptions=icpM
- if has('win32') || has('win64')
- if (v:version == 704 && has("patch393")) || v:version > 704
- set renderoptions=type:directx,level:0.5,gamma:1.5,contrast:0.25,geom:1,renmode:5,taamode:1
- set guifont=Consolas:h11
- endif
- endif
- endif
- let mapleader = ","
- nmap <Leader>f :GFiles<CR>
- nmap <Leader>F :Files<CR>
- nmap <Leader>b :Buffers<CR>
- nmap <Leader>h :History<CR>
- nmap <Leader>t :BTags<CR>
- nmap <Leader>T :Tags<CR>
- nmap <Leader>l :BLines<CR>
- nmap <Leader>L :Lines<CR>
- nmap <Leader>a :Ag<Space>
- nmap <Leader>H :Helptags!<CR>
- nmap <Leader>C :Commands<CR>
- nmap <Leader>: :History:<CR>
- nmap <Leader>/ :History/<CR>
- nmap <Leader>s :Filetypes<CR>
- " `gf` opens file under cursor in a new vertical split
- nnoremap gf :vertical wincmd f<CR>
- " switch between header/source with F4
- map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
- " goto definition with F12
- map <F12> <g]>
- map <Leader>q :bp<bar>sp<bar>bn<bar>bd<CR>
- " Specify a directory for plugins
- " - For Neovim: ~/.local/share/nvim/plugged
- " - Avoid using standard Vim directory names like 'plugin'
- call plug#begin('~/.vim/plugged')
- " On-demand loading
- Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeFind' }
- " Plugin outside ~/.vim/plugged with post-update hook
- Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
- Plug 'junegunn/fzf.vim'
- Plug 'tomasr/molokai'
- Plug 'vim-airline/vim-airline'
- Plug 'vim-airline/vim-airline-themes'
- Plug 'FromtonRouge/OmniCppComplete'
- Plug 'octol/vim-cpp-enhanced-highlight'
- " Initialize plugin system
- call plug#end()
- colorscheme molokai
- let g:airline_theme='molokai'
- map <F8> :NERDTree<Space>%<CR>
- " OmniCppComplete
- au BufNewFile,BufRead,BufEnter *.cpp,*.hpp,*.c,*.h set omnifunc=omni#cpp#complete#Main
- let OmniCpp_NamespaceSearch = 1
- let OmniCpp_GlobalScopeSearch = 1
- let OmniCpp_ShowAccess = 1
- let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
- let OmniCpp_MayCompleteDot = 0 " autocomplete after .
- let OmniCpp_MayCompleteArrow = 0 " autocomplete after ->
- let OmniCpp_MayCompleteScope = 0 " autocomplete after ::
- let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
- " automatically open and close the popup menu / preview window
- au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
- set completeopt=menuone,menu,longest,preview
- inoremap <C-Space> <C-x><C-o>
- " C++ highlighting
- let g:cpp_member_variable_highlight = 1
- let g:cpp_class_decl_highlight = 1
- let c_no_curly_error=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement