init.vim 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. """""""""" HOUSEKEEPING """"""""""
  2. syntax on
  3. set nowrap
  4. set encoding=utf8
  5. set mouse=a
  6. set splitbelow
  7. set splitright
  8. set t_Co=256
  9. set autochdir
  10. " escape can blow me
  11. nnoremap <C-c> <Esc>
  12. " Set Proper Tabs
  13. set tabstop=4
  14. set shiftwidth=4
  15. set smarttab
  16. set expandtab
  17. " Always display the status line
  18. set laststatus=2
  19. " Gets rid of highlights after search
  20. nnoremap <silent> <F7> :nohlsearch<CR><F7>
  21. " Line numbers
  22. set number
  23. " Toggle line numbers
  24. nnoremap <F6> :set nonumber!<CR>
  25. nnoremap <F9> :vsplit<CR>
  26. nnoremap <F10> :split<CR>
  27. nnoremap <F12> :only<CR>
  28. nnoremap <F2> :BuffergatorToggle<CR>
  29. nnoremap <F3> :Files<CR>
  30. nnoremap <F1> :10split term://bash<CR>
  31. " Be iMproved
  32. if &compatible
  33. set nocompatible
  34. endif
  35. " Remap window switch
  36. nnoremap <C-h> <C-w>h
  37. nnoremap <C-j> <C-w>j
  38. nnoremap <C-k> <C-w>k
  39. nnoremap <C-l> <C-w>l
  40. " Remap terminal switch
  41. tnoremap <C-[> <C-\><C-n>
  42. tnoremap <C-c><Esc> <Esc>
  43. tnoremap <C-h> <C-\><C-n><C-w>h
  44. tnoremap <C-j> <C-\><C-n><C-w>j
  45. tnoremap <C-k> <C-\><C-n><C-w>k
  46. tnoremap <C-l> <C-\><C-n><C-w>l
  47. " <TAB>: completion.
  48. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  49. " Enable Elite mode, No ARRRROWWS!!!!
  50. let g:elite_mode=1
  51. " Disable arrow movement, resize splits instead.
  52. if get(g:, 'elite_mode')
  53. nnoremap <Up> :resize -2<CR>
  54. nnoremap <Down> :resize +2<CR>
  55. nnoremap <Left> :vertical resize -2<CR>
  56. nnoremap <Right> :vertical resize +2<CR>
  57. endif
  58. nnoremap <TAB> :bnext<CR>
  59. nnoremap <S-TAB> :bprevious<CR>
  60. let mapleader = ","
  61. """""""""" END HOUSEKEEPING """"""""""
  62. """""""""" PLUGINS """"""""""
  63. " Required:
  64. set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim
  65. " Required:
  66. if dein#load_state('~/chris/.cache/dein')
  67. call dein#begin('~/.cache/dein')
  68. " Let dein manage dein
  69. " Required:
  70. call dein#add('~/.cache/dein/repos/github.com/Shougo/dein.vim')
  71. " Start Screen
  72. call dein#add('mhinz/vim-startify')
  73. " Search Index shows how many instances of searched term
  74. call dein#add('google/vim-searchindex')
  75. " line indents
  76. "call dein#add('Yggdroot/indentLine')
  77. " Gutentags
  78. call dein#add('ludovicchabant/vim-gutentags')
  79. "call dein#add('steffanc/cscopemaps.vim')
  80. "call dein#add('brookhong/cscope.vim')
  81. "call dein#add('vim-scripts/autoload_cscope.vim')
  82. " Tagbar
  83. call dein#add('majutsushi/tagbar')
  84. " Add or remove your plugins here: TODO
  85. call dein#add('Shougo/neosnippet.vim')
  86. call dein#add('Shougo/neosnippet-snippets')
  87. " Themes
  88. call dein#add('liuchengxu/space-vim-dark')
  89. call dein#add('nightsense/stellarized')
  90. call dein#add('vim-airline/vim-airline')
  91. "call dein#add('itchyny/lightline.vim')
  92. call dein#add('vim-airline/vim-airline-themes')
  93. call dein#add('chriskempson/base16-vim')
  94. " Auto Pairs
  95. call dein#add('jiangmiao/auto-pairs')
  96. " Buffergator use \b
  97. call dein#add('jeetsukumaran/vim-buffergator')
  98. " Ctrlp
  99. call dein#add('ctrlpvim/ctrlp.vim')
  100. " Searchtasks searches for TODO, FIXME, XXX and such run :SearchTasks .
  101. call dein#add('gilsondev/searchtasks.vim')
  102. "Syntax
  103. call dein#add('w0rp/ale')
  104. call dein#add('arakashic/chromatica.nvim')
  105. "Git
  106. call dein#add('airblade/vim-gitgutter')
  107. call dein#add('tpope/vim-fugitive')
  108. " Multiple Cursors
  109. call dein#add('terryma/vim-multiple-cursors')
  110. " NERDTree
  111. call dein#add('scrooloose/nerdtree')
  112. call dein#add('scrooloose/nerdcommenter')
  113. " FZF
  114. call dein#add('junegunn/fzf.vim', { 'dir': '~/.fzf', 'do': './install --all' })
  115. "call dein#add('junegunn/fzf')
  116. " BufOnly use :BufOnly to unload all or pass it a single buffer
  117. call dein#add('vim-scripts/BufOnly.vim')
  118. " For autocomplete
  119. call dein#add('zchee/deoplete-jedi')
  120. call dein#add('Shougo/deoplete.nvim')
  121. " Auto flow
  122. call dein#add('wokalski/autocomplete-flow')
  123. " For vim 8+
  124. if !has('nvim')
  125. call dein#add('roxma/nvim-yarp')
  126. call dein#add('roxma/vim-hug-neovim-rpc')
  127. endif
  128. " You can specify revision/branch/tag.
  129. call dein#add('Shougo/deol.nvim', { 'rev': '01203d4c9' })
  130. " Required:
  131. call dein#end()
  132. call dein#save_state()
  133. endif
  134. " Required:
  135. filetype plugin indent on
  136. syntax enable
  137. " If you want to install not installed plugins on startup.
  138. if dein#check_install()
  139. call dein#install()
  140. endif
  141. """""""""" END PLUGINS """"""""""
  142. """""""""" SPACEVIM THEME """"""""""
  143. " Set theme
  144. if strftime('%H') >= 7 && strftime('%H') < 8
  145. set background=light
  146. colorscheme stellarized
  147. else
  148. set background=dark
  149. colorscheme space-vim-dark
  150. " Range: 233 (darkest) ~ 238 (lightest)
  151. " Default: 235
  152. let g:space_vim_dark_background = 233
  153. color space-vim-dark
  154. hi Comment guifg=#5C6370 ctermfg=59
  155. let base16colorspace=256 " Access colors present in 256 colorspace
  156. if !empty(glob("/usr/lib/rpm/redhat"))
  157. "Lightline
  158. if !exists('g:airline_symbols')
  159. let g:airline_symbols = {}
  160. endif
  161. " unicode symbols
  162. let g:airline_left_sep = '»'
  163. let g:airline_left_sep = '▶'
  164. let g:airline_right_sep = '«'
  165. let g:airline_right_sep = '◀'
  166. let g:airline_symbols.crypt = '🔒'
  167. let g:airline_symbols.linenr = '☰'
  168. let g:airline_symbols.linenr = '␊'
  169. let g:airline_symbols.linenr = '␤'
  170. let g:airline_symbols.linenr = '¶'
  171. let g:airline_symbols.maxlinenr = ''
  172. let g:airline_symbols.maxlinenr = '㏑'
  173. let g:airline_symbols.branch = '⎇'
  174. let g:airline_symbols.paste = 'ρ'
  175. let g:airline_symbols.paste = 'Þ'
  176. let g:airline_symbols.paste = '∥'
  177. let g:airline_symbols.spell = 'Ꞩ'
  178. let g:airline_symbols.notexists = 'Ɇ'
  179. let g:airline_symbols.whitespace = 'Ξ'
  180. " powerline symbols
  181. let g:airline_left_sep = ''
  182. let g:airline_left_alt_sep = ''
  183. let g:airline_right_sep = ''
  184. let g:airline_right_alt_sep = ''
  185. let g:airline_symbols.branch = ''
  186. let g:airline_symbols.readonly = ''
  187. let g:airline_symbols.linenr = '☰'
  188. let g:airline_symbols.maxlinenr = ''
  189. " old vim-powerline symbols
  190. let g:airline_left_sep = '⮀'
  191. let g:airline_left_alt_sep = '⮁'
  192. let g:airline_right_sep = '⮂'
  193. let g:airline_right_alt_sep = '⮃'
  194. let g:airline_symbols.branch = '⭠'
  195. let g:airline_symbols.readonly = '⭤'
  196. let g:airline_symbols.linenr = '⭡'
  197. "let g:loaded_airline = 1
  198. "set showtabline=2
  199. "set noshowmode
  200. "let g:lightline = {
  201. " \ 'colorscheme': 'jellybeans',
  202. " \ 'active': {
  203. " \ 'left': [['mode', 'paste'],
  204. " \ ['gitbranch', 'readonly', 'filename', 'modified'] ]
  205. " \ },
  206. " \ 'component_function': {
  207. " \ 'gitbranch': 'fugitive#head'
  208. " \ },
  209. " \ }
  210. else
  211. "Airline
  212. set noshowmode
  213. let g:airline_theme='violet'
  214. let g:airline#extensions#tabline#enabled = 1
  215. let g:airline_powerline_fonts = 1
  216. let g:hybrid_custom_term_colors = 1
  217. if !exists('g:airline_symbols')
  218. let g:airline_symbols = {}
  219. let g:airline_symbols.space = "\ua0"
  220. endif
  221. endif
  222. endif
  223. " Enable highlighting of the current line
  224. set cursorline
  225. """""""""" END THEME """"""""""
  226. """""""""" BEGIN CONFIGS """"""""""
  227. " Deoplete
  228. let g:deoplete#enable_at_startup = 1
  229. " NeoSnippet
  230. let g:neosnippet#enable_completed_snippet = 1
  231. imap <C-k> <Plug>(neosnippet_expand_or_jump)
  232. smap <C-k> <Plug>(neosnippet_expand_or_jump)
  233. xmap <C-k> <Plug>(neosnippet_expand_target)
  234. " Startify
  235. let g:startify_custom_header = [
  236. \ ' _ __ _ ',
  237. \ ' / | / /__ ____ _ __(_)___ ___ ',
  238. \ ' / |/ / _ \/ __ \ | / / / __ `__ \',
  239. \ ' / /| / __/ /_/ / |/ / / / / / / /',
  240. \ ' /_/ |_/\___/\____/|___/_/_/ /_/ /_/ ']
  241. " Tagbar
  242. nmap <F8> :TagbarToggle<CR>
  243. " NERDTree
  244. nmap <F5> :NERDTreeToggle<CR>
  245. let NERDTreeShowHidden = 1
  246. " SearchTasks
  247. nmap <F4> :SearchTasks *<CR>
  248. """""""""" END CONFIGS """"""""""
  249. " Ctrlp
  250. let g:ctrlp_map = '<c-p>'
  251. let g:ctrlp_cmd = 'CtrlP'
  252. " MULTI CURSOR
  253. let g:multi_cursor_use_default_mapping=0
  254. " Default mapping
  255. let g:multi_cursor_start_word_key = '<C-n>'
  256. let g:multi_cursor_select_all_word_key = '<A-n>'
  257. let g:multi_cursor_start_key = 'g<C-n>'
  258. let g:multi_cursor_select_all_key = 'g<A-n>'
  259. let g:multi_cursor_next_key = '<C-n>'
  260. let g:multi_cursor_prev_key = '<C-p>'
  261. let g:multi_cursor_skip_key = '<C-x>'
  262. let g:multi_cursor_quit_key = '<Esc>'
  263. " ALE
  264. let g:ale_linters = {
  265. \ 'cpp' : ['gcc'],
  266. \ 'c' : ['gcc'],
  267. \ 'vim' : ['vint']
  268. \}
  269. let g:ale_cpp_gcc_options='-Wall -Wextra'
  270. let g:ale_c_gcc_options='-Wall -Wextra'
  271. let g:ale_vim_vint_executable = 'vint'
  272. let g:ale_vim_vint_show_style_issues = 1
  273. map <leader>a :ALEToggle<CR>
  274. " Python
  275. if !empty(glob("/usr/lib/rpm/redhat"))
  276. " For RHEL
  277. let g:chromatica#libclang_path='/usr/lib64/llvm'
  278. let g:python3_host_prog = '/bin/python3.6'
  279. else
  280. " For Debian based
  281. let g:chromatica#libclang_path='/usr/lib/llvm-6.0/lib'
  282. let g:python3_host_prog = '/usr/bin/python3.6'
  283. endif
  284. " Chromatica
  285. let g:chromatica#enable_at_startup=1
  286. let g:chromatica#responsive_mode=1
  287. " FZF
  288. if !empty((glob("~/.fzf")))
  289. set rtp+=~/.fzf
  290. endif
  291. """"""""""" FUNCTION KEYS """"""""""""""
  292. "TODO figure out cscope
  293. "TODO create function key section
  294. "TODO figure out virtualenv for neovim