2018-03-10 04:04:29 +00:00
|
|
|
|
set nocompatible
|
|
|
|
|
" Syntax highlighting
|
|
|
|
|
syntax on
|
|
|
|
|
" Line numbering
|
|
|
|
|
set number
|
2018-07-04 15:54:15 +00:00
|
|
|
|
" Always show the signcolumn
|
|
|
|
|
set signcolumn=yes
|
2018-03-10 04:04:29 +00:00
|
|
|
|
" highlight
|
|
|
|
|
set cursorline
|
2018-07-04 13:40:42 +00:00
|
|
|
|
" Encoding
|
|
|
|
|
set encoding=UTF-8
|
2018-03-10 04:04:29 +00:00
|
|
|
|
" Auto-indentation
|
|
|
|
|
set ai
|
|
|
|
|
set tabstop=4
|
|
|
|
|
set shiftwidth=4
|
|
|
|
|
set expandtab
|
|
|
|
|
" Matching paren highlighting
|
|
|
|
|
set showmatch
|
|
|
|
|
" Sane colors
|
|
|
|
|
set background=dark
|
|
|
|
|
" Show cursor pos
|
|
|
|
|
set ruler
|
|
|
|
|
" Make the status line always show up
|
|
|
|
|
set laststatus=2
|
|
|
|
|
set ttimeoutlen=50
|
|
|
|
|
" Shut the annoying bell
|
|
|
|
|
set novisualbell
|
|
|
|
|
" Set the updatetime
|
2018-07-04 15:54:15 +00:00
|
|
|
|
set updatetime=500
|
2019-03-06 04:15:35 +00:00
|
|
|
|
" Case insensitive when all lowercase
|
|
|
|
|
set ignorecase
|
2018-03-10 04:04:29 +00:00
|
|
|
|
set smartcase
|
|
|
|
|
|
|
|
|
|
" Remap arrow keys
|
|
|
|
|
noremap <Up> <NOP>
|
|
|
|
|
noremap <Down> <NOP>
|
|
|
|
|
nnoremap <Left> :bprev<CR>
|
|
|
|
|
nnoremap <Right> :bnext<CR>
|
|
|
|
|
|
2018-07-04 13:40:42 +00:00
|
|
|
|
" write the file when you accidentally opened it without the right (root) privileges
|
2018-03-10 04:04:29 +00:00
|
|
|
|
cmap w!! w !sudo tee % > /dev/null
|
|
|
|
|
|
|
|
|
|
" Remember mouse cursor position
|
|
|
|
|
augroup resCur
|
2018-07-04 15:54:15 +00:00
|
|
|
|
autocmd!
|
|
|
|
|
autocmd BufReadPost * call setpos(".", getpos("'\""))
|
2018-03-10 04:04:29 +00:00
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
" Plugins
|
2018-07-04 14:19:07 +00:00
|
|
|
|
let deinpath=$HOME.'/.vim/bundle/repos/github.com/Shougo/dein.vim'
|
|
|
|
|
let pluginpath=$HOME.'/.vim/bundle'
|
|
|
|
|
let &rtp.=','.deinpath
|
2018-03-10 04:04:29 +00:00
|
|
|
|
|
|
|
|
|
if dein#load_state(pluginpath)
|
2018-07-04 15:54:15 +00:00
|
|
|
|
call dein#begin(pluginpath)
|
|
|
|
|
|
|
|
|
|
"call dein#add(deinpath)
|
2018-11-22 20:27:56 +00:00
|
|
|
|
call dein#add('tpope/vim-sensible')
|
2018-07-04 15:54:15 +00:00
|
|
|
|
|
|
|
|
|
" Colorscheme
|
2024-07-11 17:07:31 +00:00
|
|
|
|
" call dein#add('ajh17/Spacegray.vim.git')
|
2018-07-04 15:54:15 +00:00
|
|
|
|
|
|
|
|
|
" Interface
|
|
|
|
|
call dein#add('itchyny/lightline.vim')
|
|
|
|
|
call dein#add('mgee/lightline-bufferline')
|
|
|
|
|
call dein#add('ryanoasis/vim-devicons')
|
|
|
|
|
call dein#add('airblade/vim-gitgutter')
|
|
|
|
|
call dein#add('scrooloose/nerdtree')
|
|
|
|
|
call dein#add('Yggdroot/indentLine')
|
|
|
|
|
|
2020-02-16 21:49:42 +00:00
|
|
|
|
" Movement
|
|
|
|
|
call dein#add('christoomey/vim-tmux-navigator')
|
|
|
|
|
"call dein#add('easymotion/vim-easymotion')
|
|
|
|
|
call dein#add('unblevable/quick-scope')
|
|
|
|
|
|
2018-07-04 15:54:15 +00:00
|
|
|
|
" Tools / Commands
|
|
|
|
|
call dein#add('tpope/vim-surround')
|
|
|
|
|
call dein#add('jiangmiao/auto-pairs')
|
|
|
|
|
call dein#add('tpope/vim-endwise')
|
2018-11-22 17:27:37 +00:00
|
|
|
|
"call dein#add('chrisbra/unicode.vim')
|
2020-02-16 21:49:42 +00:00
|
|
|
|
call dein#add('ctrlpvim/ctrlp.vim')
|
|
|
|
|
"call dein#add('junegunn/fzf.vim')
|
2018-11-22 19:58:46 +00:00
|
|
|
|
call dein#add('tpope/vim-obsession')
|
2018-07-04 15:54:15 +00:00
|
|
|
|
|
|
|
|
|
" Linting / Completion
|
|
|
|
|
call dein#add('w0rp/ale')
|
2020-02-16 21:49:42 +00:00
|
|
|
|
call dein#add('Shougo/deoplete.nvim')
|
|
|
|
|
call dein#add('ervandew/supertab')
|
|
|
|
|
call dein#add('autozimu/LanguageClient-neovim', { 'rev': 'next', 'build': 'bash install.sh'})
|
2018-07-04 15:54:15 +00:00
|
|
|
|
|
|
|
|
|
" Language
|
|
|
|
|
call dein#add('sheerun/vim-polyglot')
|
|
|
|
|
|
|
|
|
|
call dein#end()
|
|
|
|
|
call dein#save_state()
|
2018-03-10 04:04:29 +00:00
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
filetype plugin indent on
|
|
|
|
|
syntax enable
|
|
|
|
|
|
|
|
|
|
" Automatically install plugins
|
|
|
|
|
if dein#check_install()
|
|
|
|
|
call dein#install()
|
|
|
|
|
endif
|
|
|
|
|
|
2019-03-06 04:15:35 +00:00
|
|
|
|
" Color scheme
|
2024-07-11 17:07:31 +00:00
|
|
|
|
" colorscheme spacegray
|
2019-03-06 04:15:35 +00:00
|
|
|
|
" 16 millions colors
|
|
|
|
|
"set termguicolors
|
|
|
|
|
" Disable background in terminal
|
|
|
|
|
hi Normal ctermbg=NONE
|
|
|
|
|
|
|
|
|
|
" Italic comments
|
|
|
|
|
highlight Comment cterm=italic
|
|
|
|
|
set t_ZH=[3m
|
|
|
|
|
set t_ZR=[23m
|
|
|
|
|
|
2020-02-16 21:49:42 +00:00
|
|
|
|
" deoplete
|
|
|
|
|
let g:deoplete#enable_at_startup = 1
|
|
|
|
|
|
|
|
|
|
" LanguageClient
|
|
|
|
|
set hidden
|
|
|
|
|
let g:LanguageClient_serverCommands = {
|
|
|
|
|
\ 'python': ['/usr/bin/pyls'],
|
|
|
|
|
\ 'sh': ['bash-language-server', 'start'],
|
|
|
|
|
\ 'terraform': ['/usr/bin/terraform-lsp'],
|
|
|
|
|
\ 'yaml': ['/usr/bin/yaml-language-server'],
|
|
|
|
|
\ }
|
|
|
|
|
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
|
|
|
|
|
nnoremap <silent> <F12> :call LanguageClient#textDocument_definition()<CR>
|
|
|
|
|
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
|
|
|
|
|
|
|
|
|
|
" supertab
|
|
|
|
|
let g:SuperTabDefaultCompletionType = "<c-n>"
|
2018-03-10 04:04:29 +00:00
|
|
|
|
|
|
|
|
|
" ALE
|
|
|
|
|
let g:ale_sign_error = ''
|
2019-03-06 04:15:35 +00:00
|
|
|
|
let g:ale_sign_warning = ''
|
|
|
|
|
highlight ALEErrorSign ctermfg=Red
|
|
|
|
|
highlight ALEWarningSign ctermfg=Blue
|
|
|
|
|
highlight ALEError ctermfg=Red ctermbg=None cterm=underline
|
|
|
|
|
highlight ALEWarning ctermfg=Blue ctermbg=None cterm=underline
|
2018-03-10 04:04:29 +00:00
|
|
|
|
|
|
|
|
|
" nerdtree
|
|
|
|
|
map <C-n> :NERDTreeToggle<CR>
|
|
|
|
|
|
2020-02-16 21:49:42 +00:00
|
|
|
|
" ctrlp
|
|
|
|
|
let g:ctrlp_map = '<c-p>'
|
|
|
|
|
let g:ctrlp_cmd = 'CtrlP'
|
2018-07-04 15:54:15 +00:00
|
|
|
|
|
2018-03-10 04:04:29 +00:00
|
|
|
|
" gitgutter
|
|
|
|
|
let g:gitgutter_realtime = 1
|
|
|
|
|
let g:gitgutter_eager = 0
|
2019-03-08 03:45:23 +00:00
|
|
|
|
let g:gitgutter_override_sign_column_highlight = 0
|
2018-07-04 15:54:15 +00:00
|
|
|
|
let g:gitgutter_grep = 'rg'
|
|
|
|
|
let g:gitgutter_sign_added = '+▐'
|
2018-09-19 15:25:10 +00:00
|
|
|
|
let g:gitgutter_sign_modified = '~▐'
|
2018-07-04 15:54:15 +00:00
|
|
|
|
let g:gitgutter_sign_removed = '-▐'
|
|
|
|
|
let g:gitgutter_sign_removed_first_line = '-▐'
|
2018-09-19 15:25:10 +00:00
|
|
|
|
let g:gitgutter_sign_modified_removed = '~▐'
|
2019-03-08 03:45:23 +00:00
|
|
|
|
highlight SignColumn ctermbg=None
|
|
|
|
|
highlight GitGutterAdd ctermfg=green
|
|
|
|
|
highlight GitGutterChange ctermfg=yellow
|
|
|
|
|
highlight GitGutterDelete ctermfg=red
|
|
|
|
|
highlight GitGutterChangeDelete ctermfg=red
|
2018-07-04 15:54:15 +00:00
|
|
|
|
|
|
|
|
|
" indentLine
|
|
|
|
|
let g:indentLine_faster = 1
|
|
|
|
|
let g:indentLine_color_term = 237
|
|
|
|
|
let g:indentLine_leadingSpaceEnabled = 1
|
|
|
|
|
let g:indentLine_char = '┆'
|
|
|
|
|
let g:indentLine_leadingSpaceChar = '·'
|
2018-03-10 04:04:29 +00:00
|
|
|
|
|
|
|
|
|
" lightline
|
|
|
|
|
set noshowmode
|
|
|
|
|
set showtabline=2
|
|
|
|
|
let g:lightline = {
|
|
|
|
|
\ 'colorscheme': 'wombat',
|
|
|
|
|
\ 'active': {
|
|
|
|
|
\ 'left': [ [ 'mode', 'paste' ],
|
|
|
|
|
\ [ 'readonly', 'filename' ],
|
|
|
|
|
\ [ 'ctrlpmark' ] ],
|
|
|
|
|
\ 'right': [ [ 'lineinfo' ],
|
|
|
|
|
\ [ 'percent' ],
|
|
|
|
|
\ [ 'linter_errors' ],
|
|
|
|
|
\ [ 'fileformat', 'fileencoding', 'filetype', 'linter_ok', 'linter_warnings' ] ],
|
|
|
|
|
\ },
|
|
|
|
|
\ 'component_expand': {
|
|
|
|
|
\ 'linter_warnings': 'LightlineLinterWarnings',
|
|
|
|
|
\ 'linter_errors': 'LightlineLinterErrors',
|
|
|
|
|
\ 'linter_ok': 'LightlineLinterOK'
|
|
|
|
|
\ },
|
|
|
|
|
\ 'component_type': {
|
|
|
|
|
\ 'readonly': 'error',
|
|
|
|
|
\ 'linter_errors': 'error',
|
|
|
|
|
\ 'linter_warning': 'warning',
|
|
|
|
|
\ },
|
|
|
|
|
\ 'component_function': {
|
|
|
|
|
\ 'filename': 'LightlineFilename',
|
|
|
|
|
\ },
|
|
|
|
|
\ }
|
|
|
|
|
|
2018-07-04 13:40:42 +00:00
|
|
|
|
"lightline-bufferline
|
|
|
|
|
let g:lightline#bufferline#show_number=2
|
|
|
|
|
let g:lightline#bufferline#number_map = {
|
|
|
|
|
\ 0: '⁰', 1: '¹', 2: '²', 3: '³', 4: '⁴',
|
|
|
|
|
\ 5: '⁵', 6: '⁶', 7: '⁷', 8: '⁸', 9: '⁹'
|
|
|
|
|
\ }
|
|
|
|
|
let g:lightline#bufferline#enable_devicons=1
|
|
|
|
|
let g:lightline#bufferline#min_buffer_count=2
|
|
|
|
|
let g:lightline.tabline = {'left': [['buffers']], 'right': []}
|
|
|
|
|
let g:lightline.component_expand = {'buffers': 'lightline#bufferline#buffers'}
|
|
|
|
|
let g:lightline.component_type = {'buffers': 'tabsel'}
|
|
|
|
|
|
2018-03-10 04:04:29 +00:00
|
|
|
|
function! LightlineFilename()
|
2018-07-04 15:54:15 +00:00
|
|
|
|
let filename = expand('%:t') !=# '' ? expand('%:t') : '[No Name]'
|
|
|
|
|
let modified = &modified ? ' +' : ''
|
|
|
|
|
return filename . modified
|
2018-03-10 04:04:29 +00:00
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
function! LightlineLinterWarnings() abort
|
2018-07-04 15:54:15 +00:00
|
|
|
|
let l:counts = ale#statusline#Count(bufnr(''))
|
|
|
|
|
let l:all_errors = l:counts.error + l:counts.style_error
|
|
|
|
|
let l:all_non_errors = l:counts.total - l:all_errors
|
|
|
|
|
return l:counts.total == 0 ? '' : printf('%d ', all_non_errors)
|
2018-03-10 04:04:29 +00:00
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
function! LightlineLinterErrors() abort
|
2018-07-04 15:54:15 +00:00
|
|
|
|
let l:counts = ale#statusline#Count(bufnr(''))
|
|
|
|
|
let l:all_errors = l:counts.error + l:counts.style_error
|
|
|
|
|
let l:all_non_errors = l:counts.total - l:all_errors
|
|
|
|
|
return l:counts.total == 0 ? '' : printf('%d ', all_errors)
|
2018-03-10 04:04:29 +00:00
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
function! LightlineLinterOK() abort
|
2018-07-04 15:54:15 +00:00
|
|
|
|
let l:counts = ale#statusline#Count(bufnr(''))
|
|
|
|
|
let l:all_errors = l:counts.error + l:counts.style_error
|
|
|
|
|
let l:all_non_errors = l:counts.total - l:all_errors
|
|
|
|
|
return l:counts.total == 0 ? '0 ' : ''
|
2018-03-10 04:04:29 +00:00
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
autocmd User ALELint call s:MaybeUpdateLightline()
|
|
|
|
|
|
|
|
|
|
" Update and show lightline but only if it's visible (e.g., not in Goyo)
|
|
|
|
|
function! s:MaybeUpdateLightline()
|
2018-07-04 15:54:15 +00:00
|
|
|
|
if exists('#lightline')
|
|
|
|
|
call lightline#update()
|
|
|
|
|
end
|
2018-03-10 04:04:29 +00:00
|
|
|
|
endfunction
|
|
|
|
|
|