Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.89 KB | None | 0 0
  1. " neovim init file
  2. "
  3. let mapleader = ","
  4. if has('unnamedplus')
  5. set clipboard^=unnamed
  6. set clipboard^=unnamedplus
  7. endif
  8. if has('persistent_undo')
  9. set undofile
  10. set undodir=~/.config/vim/tmp/undo//
  11. endif
  12. set shortmess=atIsAoc
  13. set ignorecase
  14. set visualbell
  15. set wildignore=.svn,CVS,.git,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif
  16. set completeopt=menu,noinsert,noselect
  17.  
  18. " allow neovim to change cursor shape
  19. "let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
  20. "let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  21.  
  22. " formatting options and tabs/spaces
  23. " set formatoptions=tcqro
  24. set formatoptions=qrn1
  25. set expandtab
  26. set tabstop=2
  27. set shiftwidth=2
  28. set softtabstop=2
  29. set textwidth=80
  30.  
  31. set title
  32. set list
  33. set listchars=tab:>.,trail:.,extends:#,nbsp:.
  34.  
  35. " basic indentation
  36. au Filetype ruby,python,bash,go set cindent
  37.  
  38. " manage external plugins
  39. call plug#begin('~/.config/nvim/plugged')
  40. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  41. Plug 'vim-syntastic/syntastic'
  42. Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
  43. Plug 'fatih/molokai'
  44. Plug 'tpope/vim-fugitive'
  45. Plug 'jlanzarotta/bufexplorer'
  46. Plug 'dgryski/vim-godef'
  47. Plug 'ctrlpvim/ctrlp.vim'
  48. Plug 'itchyny/lightline.vim'
  49. "Plug 'mattn/webapi-vim'
  50. Plug 'mileszs/ack.vim'
  51. Plug 'airblade/vim-gitgutter'
  52. Plug 'mattn/webapi-vim'
  53. Plug 'mattn/gist-vim', {'depends': 'mattn/webapi-vim'}
  54. Plug 'AndrewRadev/splitjoin.vim'
  55. Plug 'nsf/gocode', { 'rtp': 'nvim', 'do': '~/.config/nvim/plugged/gocode/nvim/symlink.sh' }
  56. Plug 'roxma/nvim-completion-manager'
  57. Plug 'tpope/vim-rhubarb'
  58. call plug#end()
  59.  
  60. " colors
  61. " allow neovim to use the original terminal colors
  62. set termguicolors
  63. set t_Co=256
  64. colorscheme molokai
  65. let g:rehash256 = 1
  66. set scrolloff=5
  67. set scrolljump=8
  68. set nocursorline
  69. set lazyredraw
  70. set noshowmatch
  71. set nocursorcolumn
  72. set mouse=n
  73.  
  74. " gitgutter
  75. let g:gitgutter_map_keys = 0
  76. nmap <Leader>ad <Plug>GitGutterStageHunk
  77. nmap <Leader>aD <Plug>GitGutterUndoHunk
  78.  
  79. " vim-go settings
  80. let g:go_fmt_command = "goimports"
  81. let g:go_bin_path = $HOME."/go/bin"
  82. let g:go_gotags_bin = $HOME."/go/bin/gotags"
  83. let g:go_highlight_space_tab_error = 0
  84. let g:go_highlight_trailing_whitespace_error = 0
  85. let g:go_highlight_functions = 1
  86. let g:go_highlight_methods = 0
  87. let g:go_list_type = "quickfix"
  88. let g:go_fmt_fail_silently = 1
  89.  
  90.  
  91. " syntastic settings
  92. let g:syntastic_go_checkers = ['govet', 'errcheck']
  93. let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
  94.  
  95. " gist settings
  96. let g:gist_clip_command = 'pbcopy'
  97. let g:gist_detect_filetype = 1
  98. let g:gist_open_browser_after_post = 1
  99.  
  100. " ctrlp
  101. let g:ctrlp_by_filename = 1
  102. let g:ctrlp_use_caching = 1
  103. let g:ctrlp_clear_cache_on_exit = 0
  104. let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
  105.  
  106. " Syntastic
  107. let g:syntastic_enable_signs=1
  108. let g:syntastic_always_populate_loc_list = 0
  109. let g:syntastic_auto_loc_list = 0
  110. let g:syntastic_check_on_open = 0
  111. let g:syntastic_check_on_wq = 0
  112. let g:syntastic_error_symbol='✗'
  113. let g:syntastic_warning_symbol='⚠'
  114. let g:syntastic_style_error_symbol = '✗'
  115. let g:syntastic_style_warning_symbol = '⚠'
  116. let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
  117. let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
  118. nmap <silent> <F10> :SyntasticCheck<CR>
  119.  
  120. " custom key bindings
  121. map <leader>d :NERDTreeToggle<CR>
  122. map <leader>s :BufExplorer<CR>
  123.  
  124. au FileType go nmap <Leader>gd <Plug>(go-doc)
  125. au FileType go nmap <Leader>i <Plug>(go-info)
  126.  
  127. " do not try to colorize huge json files
  128. au FileType json let g:vim_json_syntax_conceal = 0
  129. " let vim-go deal with tabs
  130. au FileType go set listchars-=tab:>. nolist
  131.  
  132. " statusline
  133. let g:lightline = {
  134. \ 'colorscheme': 'wombat',
  135. \ 'active': {
  136. \ 'left': [ [ 'mode', 'paste' ],
  137. \ [ 'fugitive', 'syntastic', 'readonly', 'absolutepath', 'modified' ] ]
  138. \ },
  139. \ 'component': {
  140. \ 'readonly': '%{&filetype=="help"?"":&readonly?"RO":""}',
  141. \ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}',
  142. \ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
  143. \ },
  144. \ 'component_visible_condition': {
  145. \ 'readonly': '(&filetype!="help"&& &readonly)',
  146. \ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
  147. \ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
  148. \ },
  149. \ 'component_expand': {
  150. \ 'syntastic': 'SyntasticStatuslineFlag',
  151. \ },
  152. \ 'component_type': {
  153. \ 'syntastic': 'error',
  154. \ },
  155. \ 'separator': { 'left': '', 'right': '' },
  156. \ 'subseparator': { 'left': '|', 'right': '|' }
  157. \ }
  158.  
  159. " enable syntastic in status line
  160. augroup AutoSyntastic
  161. autocmd!
  162. autocmd BufWritePost *.c,*.cpp,*.go call s:syntastic()
  163. augroup END
  164.  
  165. function! s:syntastic()
  166. SyntasticCheck
  167. call lightline#update()
  168. endfunction
  169.  
  170. noremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
  171. noremap <c-c> <ESC>
  172. noremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
  173. inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
  174.  
  175. au VimLeave * set guicursor=a:ver30
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement