init.vim 10 KB

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