Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. if has("gui_running")
  2. if has("gui_gtk2")
  3. set guifont=Inconsolata\ 12
  4. elseif has("gui_macvim")
  5. set guifont=Menlo\ Regular:h14
  6. elseif has("gui_win32")
  7. set guifont=Consolas:h12
  8. endif
  9. endif
  10.  
  11. if &compatible
  12. set nocompatible
  13. endif
  14. " Add the dein installation directory into runtimepath
  15. set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim
  16.  
  17. if dein#load_state('~/.cache/dein')
  18. call dein#begin('~/.cache/dein')
  19.  
  20. call dein#add('~/.cache/dein/repos/github.com/Shougo/dein.vim')
  21. call dein#add('Shougo/deoplete.nvim')
  22. call dein#add('Shougo/denite.nvim')
  23. if !has('nvim')
  24. call dein#add('roxma/nvim-yarp')
  25. call dein#add('roxma/vim-hug-neovim-rpc')
  26. endif
  27.  
  28. call dein#add('kien/ctrlp.vim')
  29. call dein#add('nyrkovalex/vim-aldmeris')
  30. call dein#add('sheerun/vim-polyglot')
  31. call dein#add('w0rp/ale')
  32. call dein#add('mhartington/nvim-typescript', {'build': './install.sh'})
  33. call dein#add('tpope/vim-fugitive')
  34. call dein#add('airblade/vim-gitgutter')
  35. call dein#add('ap/vim-buftabline')
  36. call dein#add('altercation/vim-colors-solarized')
  37. call dein#add('mileszs/ack.vim')
  38.  
  39. call dein#end()
  40. call dein#save_state()
  41. endif
  42.  
  43. filetype plugin indent on
  44. syntax enable
  45.  
  46. set smartindent
  47. set shiftwidth=2
  48. set softtabstop=2
  49. set tabstop=2
  50. set virtualedit=all
  51. set linespace=2
  52. set laststatus=2
  53. set foldmethod=syntax
  54. set foldlevel=20
  55. set expandtab
  56. set splitright
  57. set backspace=2
  58. set hls
  59. set mouse=a
  60. set diffopt+=vertical
  61. set clipboard=unnamedplus
  62. set backupcopy=yes
  63. set noswapfile
  64. set completeopt=menu
  65.  
  66. set directory^=$HOME/.vim/tmp//
  67.  
  68. " Look & feel
  69. set termguicolors
  70. set bg=dark
  71. colorscheme solarized
  72.  
  73. set listchars=tab:»\ ,trail:·,space:·
  74. set list
  75. set cursorline
  76. set nowrap
  77. set number
  78. set ruler
  79. set guioptions-=m "menu bar
  80. set guioptions-=T "toolbar
  81. set guioptions-=r "scrollbar
  82.  
  83. " Strip trailing whitespaces
  84. autocmd BufWritePre * :%s/\s\+$//e
  85.  
  86. " Statusline
  87. function! LinterOk() abort
  88. let l:counts = ale#statusline#Count(bufnr(''))
  89. return l:counts.total == 0 ? ' ✓ ' : ''
  90. endfunction
  91.  
  92. function! LinterErrors() abort
  93. let l:counts = ale#statusline#Count(bufnr(''))
  94.  
  95. let l:all_errors = l:counts.error + l:counts.style_error
  96.  
  97. return all_errors > 0 ? printf(' %d× ', all_errors) : ''
  98. endfunction
  99.  
  100. function! LinterWarnings() abort
  101. let l:counts = ale#statusline#Count(bufnr(''))
  102.  
  103. let l:all_errors = l:counts.error + l:counts.style_error
  104. let l:all_non_errors = l:counts.total - l:all_errors
  105.  
  106. return all_non_errors > 0 ? printf(' %d⚠ ', all_non_errors) : ''
  107. endfunction
  108.  
  109. function! StatusLine() abort
  110. let l:lintermsg = '%#CheckedStatus#%{LinterOk()}' . '%#ErrorMsg#%{LinterErrors()}' . '%#WarningStatus#%{LinterWarnings()}%*'
  111. return '%t %m ' . l:lintermsg . '%= %#GitStatus#|%{fugitive#head(8)}|%* %l:%v'
  112. endfunction
  113.  
  114. set statusline=%!StatusLine()
  115.  
  116. " Split navigation
  117. nmap <silent> <C-k> :wincmd k<CR>
  118. nmap <silent> <C-J> :wincmd j<CR>
  119. nmap <silent> <C-h> :wincmd h<CR>
  120. nmap <silent> <C-l> :wincmd l<CR>
  121. tnoremap <C-h> <C-\><C-n><C-w>h
  122. tnoremap <C-j> <C-\><C-n><C-w>j
  123. tnoremap <C-k> <C-\><C-n><C-w>k
  124. tnoremap <C-l> <C-\><C-n><C-w>l
  125.  
  126. " Move lines
  127. nnoremap <A-j> :m .+1<CR>==
  128. nnoremap <A-k> :m .-2<CR>==
  129. inoremap <A-j> <Esc>:m .+1<CR>==gi
  130. inoremap <A-k> <Esc>:m .-2<CR>==gi
  131. vnoremap <A-j> :m '>+1<CR>gv=gv
  132. vnoremap <A-k> :m '<-2<CR>gv=gv
  133.  
  134. " Completion
  135. inoremap <C-Space> <C-x><C-o>
  136. inoremap <C-@> <C-x><C-o>
  137. let g:deoplete#enable_at_startup = 1
  138.  
  139. " Ack grep
  140. let g:ackprg = 'ag --vimgrep'
  141.  
  142. " Buftabline
  143. set hidden
  144. nnoremap <silent> <C-N> :bnext<CR>
  145. nnoremap <silent> <C-P> :bprev<CR>
  146. nnoremap <silent> <C-Q> :bd<CR>
  147.  
  148. let g:buftabline_indicators = 1
  149. let g:buftabline_show = 1
  150.  
  151. " Ale
  152. let g:ale_sign_column_always = 1
  153.  
  154. let g:ale_sign_column_always = 1
  155. let g:ale_sign_warning = '⚠'
  156. let g:ale_sign_error = '×'
  157. let g:ale_lint_delay = 500
  158.  
  159. nmap <leader>e :ALENextWrap<cr>
  160. nmap <leader>E :ALEPreviousWrap<cr>
  161.  
  162. " Ctrl-p
  163. let g:ctrlp_working_path_mode = ''
  164. let g:ctrlp_show_hidden = 1
  165. let g:ctrlp_match_current_file = 1
  166. " exclude gitignore files
  167. let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
  168.  
  169. " TypeScript
  170. autocmd FileType typescript nmap <buffer> <leader>F :ALEFix<CR>
  171. autocmd FileType typescript nmap <buffer> <leader>f :TSGetCodeFix<CR>
  172. let g:ale_fixers = { 'typescript': ['tslint'] }
  173.  
  174. " HTML
  175. let g:ale_linters = { 'html': [] }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement