1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
let mapleader ='\'
set bg=dark
set go=a
set mouse=a
set nohlsearch
set clipboard+=unnamedplus
let g:python_host_prog = '/usr/bin/python2'
let g:python3_host_prog = '/usr/bin/python3'
" Some basics:
nnoremap c "_c
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
" Automatically deletes all trailing whitespace on save.
autocmd BufWritePre * %s/\s\+$//e
" Run xrdb whenever Xdefaults or Xresources are updated.
autocmd BufWritePost *Xresources,*Xdefaults !xrdb %
call plug#begin("~/.vim/plugged")
Plug 'Shougo/deoplete.nvim'
Plug 'artur-shaik/vim-javacomplete2' , { 'for': 'java'}
Plug 'majutsushi/tagbar', { 'on': 'TagbarToggle' }
Plug 'SirVer/ultisnips'
Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
Plug 'w0rp/ale'
Plug 'ctrlpvim/ctrlp.vim'
" Bottom line
Plug 'itchyny/lightline.vim'
call plug#end()
"Ctrlp Settings {{{
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'ctrlp'
let g:ctrlp_dont_split = 'nerd'
let g:ctrlp_working_path_mode = 'rw'
set wildignore+=*/.git/*,*/tmp/*,*.swp/*,*/node_modules/*,*/temp/*,*/Builds/*,*/ProjectSettings/*
" Set no max file limit
let g:ctrlp_max_files = 0
" Search from current directory instead of project root
function! CtrlPCommand()
let c = 0
let wincount = winnr('$')
" Don't open it here if current buffer is not writable (e.g. NERDTree)
while !empty(getbufvar(+expand("<abuf>"), "&buftype")) && c < wincount
exec 'wincmd w'
let c = c + 1
endwhile
exec 'CtrlP'
endfunction
let g:ctrlp_cmd = 'call CtrlPCommand()'
"RipGrep
if executable('rg')
set grepprg=rg\ --color=never
let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
let g:ctrlp_use_caching = 0
endif
let g:ctrlp_custom_ignore = {
\ 'dir': '',
\ 'file': '\.so$\|\.dat$|\.DS_Store$|\.meta|\.zip|\.rar|\.ipa|\.apk',
\ }
" }}}
"Ale Settings {{{
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_sign_error = '✘✘'
let g:ale_sign_warning = '⚠⚠'
let g:ale_open_list = 0
let g:ale_loclist = 0
"g:ale_javascript_eslint_use_global = 1
let g:ale_linters = {
\ 'cs':['syntax', 'semantic', 'issues'],
\ 'python': ['pylint'],
\ 'java': ['javac']
\ }
" }}}
" Deoplete {{{
let g:deoplete#enable_at_startup = 1
let g:deoplete#custom#auto_complete_start_length = 2
let g:deoplete#custom#sources = {}
let g:deoplete#custom#sources._=['buffer', 'ultisnips', 'file', 'dictionary']
let g:deoplete#custom#sources.javascript = ['tern', 'omni', 'file', 'buffer', 'ultisnips']
" Use smartcase.
let g:deoplete#custom#enable_smart_case = 1
"set completeopt-=preview
""use TAB as the mapping
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ deoplete#mappings#manual_complete()
function! s:check_back_space() abort "" {{{
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction "" }}}
" }}}
" UltiSnips {{{
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsSnippetDirectories = ['~/.vim/UltiSnips', 'UltiSnips']
let g:UltiSnipsSnippetsDir="~/.vim/UltiSnips"
" }}}
" Java {{{
" Easy compile java in vim
autocmd FileType java set makeprg=javac\ %
set errorformat=%A%f:%l:\ %m,%-Z%p^,%-C.%#
" Java completion
autocmd FileType java setlocal omnifunc=javacomplete#Complete
autocmd FileType java JCEnable
" }}}
|