configs/init.vim
init.vimRaw
1call plug#begin(expand('~/.config/nvim/plugged'))
2
3" NERDTree
4Plug 'scrooloose/nerdtree'
5Plug 'jistr/vim-nerdtree-tabs'
6Plug 'scrooloose/nerdcommenter'
7
8" vim-airline
9Plug 'vim-airline/vim-airline'
10Plug 'vim-airline/vim-airline-themes'
11
12" syntastic
13Plug 'scrooloose/syntastic'
14
15Plug 'airblade/vim-gitgutter'
16Plug 'Raimondi/delimitMate'
17Plug 'majutsushi/tagbar'
18
19" rainbow parentheses
20Plug 'kien/rainbow_parentheses.vim'
21
22" go
23Plug 'fatih/vim-go' " Amazing combination of features.
24Plug 'godoctor/godoctor.vim' " Some refactoring tools
25
26" rust
27"" will need to install https://github.com/racer-rust/racer
28Plug 'racer-rust/vim-racer'
29Plug 'rust-lang/rust.vim'
30set hidden
31let g:racer_cmd = "/home/user/.cargo/bin/racer"
32let g:racer_experimental_completer = 1
33
34
35" javascript
36Plug 'jelera/vim-javascript-syntax'
37
38" python
39Plug 'davidhalter/jedi-vim'
40Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
41
42" deoplete
43Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
44Plug 'zchee/deoplete-go', {'build': {'unix': 'make'}}
45" neosnippet with deoplete
46Plug 'Shougo/neosnippet.vim'
47Plug 'Shougo/neosnippet-snippets'
48let g:deoplete#enable_at_startup = 1
49" Plugin deoplete neosnippet key-mappings.
50" Note: It must be "imap" and "smap". It uses <Plug> mappings.
51imap <C-k> <Plug>(neosnippet_expand_or_jump)
52smap <C-k> <Plug>(neosnippet_expand_or_jump)
53xmap <C-k> <Plug>(neosnippet_expand_target)
54
55
56" colors
57Plug 'tomasr/molokai'
58Plug 'srcery-colors/srcery-vim'
59Plug 'rakr/vim-one'
60Plug 'morhetz/gruvbox'
61let g:srcery_italic = 1
62
63
64call plug#end()
65
66" visual
67syntax on
68set ruler
69set number
70set title
71set titlestring=nvim-%F
72set t_Co=256
73set cursorline
74set background=dark " for the dark version
75
76"Credit joshdick
77"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
78"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
79"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
80if (empty($TMUX))
81 if (has("nvim"))
82 "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
83 let $NVIM_TUI_ENABLE_TRUE_COLOR=1
84 endif
85 "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
86 "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
87 " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
88 if (has("termguicolors"))
89 set termguicolors
90 endif
91endif
92
93if $COLORTERM == 'gnome-terminal'
94 set term=gnome-256color
95else
96 if $TERM == 'xterm'
97 set term=xterm-256color
98 endif
99endif
100
101set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
102
103
104" go
105let g:go_auto_sameids = 1
106
107"" go config
108function! s:build_go_files()
109 let l:file = expand('%')
110 if l:file =~# '^\f\+\.go$'
111 call go#cmd#Build(0)
112 endif
113endfunction
114
115
116let g:go_list_type = "quickfix"
117let g:go_fmt_command = "goimports"
118let g:go_fmt_fail_silently = 1
119let g:go_highlight_types = 1
120let g:go_highlight_fields = 1
121let g:go_highlight_functions = 1
122let g:go_highlight_methods = 1
123let g:go_highlight_operators = 1
124let g:go_highlight_build_constraints = 1
125let g:go_highlight_structs = 1
126let g:go_highlight_generate_tags = 1
127let g:go_highlight_space_tab_error = 0
128let g:go_highlight_array_whitespace_error = 0
129let g:go_highlight_trailing_whitespace_error = 0
130let g:go_highlight_extra_types = 1
131
132" NERDTree
133let NERDTreeShowHidden=1
134autocmd vimenter * NERDTree
135map <C-n> :NERDTreeToggle<CR>
136" NERDCommenter
137let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default
138let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation
139let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region)
140
141
142" vim-airline
143"" let g:airline_theme = 'powerlineish'
144let g:airline_theme='one'
145let g:airline#extensions#syntastic#enabled = 1
146let g:airline#extensions#branch#enabled = 1
147let g:airline#extensions#tabline#enabled = 1
148let g:airline#extensions#tabline#buffer_nr_show = 1
149let g:airline#extensions#tagbar#enabled = 1
150let g:airline_skip_empty_sections = 1
151
152
153" syntastic
154let g:syntastic_always_populate_loc_list=1
155let g:syntastic_error_symbol='✗'
156let g:syntastic_warning_symbol='⚠'
157let g:syntastic_style_error_symbol = '✗'
158let g:syntastic_style_warning_symbol = '⚠'
159let g:syntastic_auto_loc_list=1
160let g:syntastic_aggregate_errors = 1
161let g:syntastic_go_checkers = ['golint', 'govet']
162let g:syntastic_python_checkers = []
163let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
164
165" rainbowparentheses
166let g:rbpt_colorpairs = [
167 \ ['brown', 'RoyalBlue3'],
168 \ ['Darkblue', 'SeaGreen3'],
169 \ ['darkgray', 'DarkOrchid3'],
170 \ ['darkgreen', 'firebrick3'],
171 \ ['darkcyan', 'RoyalBlue3'],
172 \ ['darkred', 'SeaGreen3'],
173 \ ['darkmagenta', 'DarkOrchid3'],
174 \ ['brown', 'firebrick3'],
175 \ ['gray', 'RoyalBlue3'],
176 \ ['black', 'SeaGreen3'],
177 \ ['darkmagenta', 'DarkOrchid3'],
178 \ ['Darkblue', 'firebrick3'],
179 \ ['darkgreen', 'RoyalBlue3'],
180 \ ['darkcyan', 'SeaGreen3'],
181 \ ['darkred', 'DarkOrchid3'],
182 \ ['red', 'firebrick3'],
183 \ ]
184let g:rbt_max = 16
185let g:rbpt_loadcmd_toggle = 0
186au VimEnter * RainbowParenthesesToggle
187au Syntax * RainbowParenthesesLoadRound
188au Syntax * RainbowParenthesesLoadSquare
189au Syntax * RainbowParenthesesLoadBraces
190
191" abbreviations
192cnoreabbrev W! w!
193cnoreabbrev Q! q!
194cnoreabbrev Qall! qall!
195cnoreabbrev Wq wq
196cnoreabbrev Wa wa
197cnoreabbrev wQ wq
198cnoreabbrev WQ wq
199cnoreabbrev W w
200cnoreabbrev Q q
201cnoreabbrev Qall qall
202
203"" Switching windows
204noremap <C-j> <C-w>j
205noremap <C-k> <C-w>k
206noremap <C-l> <C-w>l
207noremap <C-h> <C-w>h
208
209"" esc mapping
210inoremap jk <ESC>
211tnoremap jk <C-\><C-n>
212
213" scroll
214set scrolloff=5 " keep at least 5 lines above/below
215set sidescrolloff=5 " keep at least 5 lines left/right
216
217
218colorscheme molokai