Advertisement
Guest User

Untitled

a guest
May 13th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 4.20 KB | None | 0 0
  1. " set UTF-8 encoding
  2. set enc=utf-8
  3. set fenc=utf-8
  4. set termencoding=utf-8
  5. " disable vi compatibility (emulation of old bugs)
  6. set nocompatible
  7. " use indentation of previous line
  8. set autoindent
  9. " use intelligent indentation for C
  10. set smartindent
  11. " set automatically in cpp files
  12. " set cindent
  13. " configure tabwidth and insert spaces instead of tabs
  14. set tabstop=4        " tab width is 4 spaces
  15. set shiftwidth=4     " indent also with 4 spaces
  16. set expandtab        " expand tabs to spaces
  17. " wrap lines at 120 chars. 80 is somewaht antiquated with nowadays displays.
  18. set textwidth=120
  19. " set the working directory to wherever the open file lives
  20. autocmd BufEnter * silent! lcd %:p:h
  21. " turn syntax highlighting on
  22. syntax on
  23. " show eol
  24. set list
  25. " turn line numbers on
  26. set number
  27. " highlight matching braces
  28. set showmatch
  29. " intelligent comments
  30. set comments=sl:/*,mb:\ *,elx:\ */
  31. " set folding based on syntax
  32. " set foldenable
  33. set foldmethod=indent  
  34. set foldnestmax=10
  35. set nofoldenable
  36. set foldlevel=2
  37. " ignore case on autocomplete
  38. set ignorecase
  39. set infercase
  40. set smartcase
  41.  
  42. set sessionoptions=blank,buffers,curdir,folds,globals,options,resize,tabpages,winsize
  43. " Automatically save the session when leaving Vim
  44. autocmd! VimLeave * mksession! ~/.vim/default_session.vim
  45. " Automatically load the session when entering vim
  46. autocmd! VimEnter * source ~/.vim/default_session.vim
  47.  
  48. " tags for C++
  49. set tags+=~/.vim/tags/cpp
  50. set tags+=~/.vim/tags/gl
  51. set tags+=~/.vim/tags/sdl
  52. set tags+=~/.vim/tags/qt4
  53. set tags+=~/.vim/tags/qt5
  54. set tags+=~/.vim/commontags
  55.  
  56. " autocompletion options
  57. set wildmenu
  58. set wildmode=longest:list,full
  59. " set wildcharm=<tab>.
  60.  
  61. if has("gui_running")
  62.     set guioptions=icpM
  63.     if has('win32') || has('win64')
  64.         if (v:version == 704 && has("patch393")) || v:version > 704
  65.             set renderoptions=type:directx,level:0.5,gamma:1.5,contrast:0.25,geom:1,renmode:5,taamode:1
  66.             set guifont=Consolas:h11
  67.         endif
  68.     endif    
  69. endif
  70.  
  71. let mapleader = ","
  72.  
  73. nmap <Leader>f :GFiles<CR>
  74. nmap <Leader>F :Files<CR>
  75. nmap <Leader>b :Buffers<CR>
  76. nmap <Leader>h :History<CR>
  77. nmap <Leader>t :BTags<CR>
  78. nmap <Leader>T :Tags<CR>
  79. nmap <Leader>l :BLines<CR>
  80. nmap <Leader>L :Lines<CR>
  81. nmap <Leader>a :Ag<Space>
  82. nmap <Leader>H :Helptags!<CR>
  83. nmap <Leader>C :Commands<CR>
  84. nmap <Leader>: :History:<CR>
  85. nmap <Leader>/ :History/<CR>
  86. nmap <Leader>s :Filetypes<CR>
  87.  
  88. " `gf` opens file under cursor in a new vertical split
  89. nnoremap gf :vertical wincmd f<CR>
  90.  
  91. " switch between header/source with F4
  92. map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
  93.  
  94. " goto definition with F12
  95. map <F12> <g]>
  96.  
  97. map <Leader>q :bp<bar>sp<bar>bn<bar>bd<CR>
  98.  
  99. " Specify a directory for plugins
  100. " - For Neovim: ~/.local/share/nvim/plugged
  101. " - Avoid using standard Vim directory names like 'plugin'
  102. call plug#begin('~/.vim/plugged')
  103.  
  104. " On-demand loading
  105. Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeFind' }
  106.  
  107. " Plugin outside ~/.vim/plugged with post-update hook
  108. Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
  109. Plug 'junegunn/fzf.vim'
  110.  
  111. Plug 'tomasr/molokai'
  112.  
  113. Plug 'vim-airline/vim-airline'
  114. Plug 'vim-airline/vim-airline-themes'
  115.  
  116. Plug 'FromtonRouge/OmniCppComplete'
  117.  
  118. Plug 'octol/vim-cpp-enhanced-highlight'
  119.  
  120. " Initialize plugin system
  121. call plug#end()
  122.  
  123. colorscheme molokai
  124. let g:airline_theme='molokai'
  125.  
  126. map <F8> :NERDTree<Space>%<CR>
  127.  
  128. " OmniCppComplete
  129. au BufNewFile,BufRead,BufEnter *.cpp,*.hpp,*.c,*.h set omnifunc=omni#cpp#complete#Main
  130. let OmniCpp_NamespaceSearch = 1
  131. let OmniCpp_GlobalScopeSearch = 1
  132. let OmniCpp_ShowAccess = 1
  133. let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
  134. let OmniCpp_MayCompleteDot = 0 " autocomplete after .
  135. let OmniCpp_MayCompleteArrow = 0 " autocomplete after ->
  136. let OmniCpp_MayCompleteScope = 0 " autocomplete after ::
  137. let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
  138. " automatically open and close the popup menu / preview window
  139. au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
  140. set completeopt=menuone,menu,longest,preview
  141. inoremap <C-Space> <C-x><C-o>
  142.  
  143. " C++ highlighting
  144. let g:cpp_member_variable_highlight = 1
  145. let g:cpp_class_decl_highlight = 1
  146. let c_no_curly_error=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement