guest@dotshare [~/groups/vim/rc] $ ls Awesome-vimrc/ | cat

Awesome vimrc (scrot, raw, dl)

KolesnichenkoDS May 20, 2017 (vim/rc)

SCROT

  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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"         _             _                                                      "
"        (_)           (_)                                                     "
"  __   ___ _ __ ___    _ ___    __ ___      _____  ___  ___  _ __ ___   ___   "
"  \ \ / / | '_ ` _ \  | / __|  / _` \ \ /\ / / _ \/ __|/ _ \| '_ ` _ \ / _ \  "
"   \ V /| | | | | | | | \__ \ | (_| |\ V  V /  __/\__ \ (_) | | | | | |  __/  "
"    \_/ |_|_| |_| |_| |_|___/  \__,_| \_/\_/ \___||___/\___/|_| |_| |_|\___|  "
"                                                                              "
"                                                                              "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

set nocompatible

set runtimepath+=~/.config/nvim/repos/github.com/Shougo/dein.vim
let s:bundle_dir = expand('~/.config/nvim')
let s:plugin_dir = s:bundle_dir . '/repos/github.com'

if dein#load_state(s:bundle_dir)
    call dein#begin(s:bundle_dir)

    " --- Dein ---
    call dein#add(s:plugin_dir . '/Shougo/dein.vim')

    " --- Appearance ---
    call dein#add('chriskempson/base16-vim')
    call dein#add('itchyny/lightline.vim')
    call dein#add('daviesjamie/vim-base16-lightline')

    " --- Autocomplete & Snippets ---
    if has('nvim')
        call dein#add('Shougo/deoplete.nvim')
    else
        call dein#add('Shougo/neocomplete.vim')
    endif
    call dein#add('Shougo/neosnippet')
    call dein#add('Shougo/neosnippet-snippets')

    " --- Code style ---
    call dein#add('KolesnichenkoDS/editorconfig.vim')

    " --- Build & Run ---
    call dein#add('neomake/neomake')

    " --- Localization ---
    call dein#add('lyokha/vim-xkbswitch')

    " --- Navigation ---
    call dein#add('ctrlpvim/ctrlp.vim')
    call dein#add('derekwyatt/vim-fswitch')
    call dein#add('scrooloose/nerdtree')

    " --- Misc ---
    call dein#add('LucHermitte/lh-vim-lib')
    call dein#add('easymotion/vim-easymotion')
    call dein#add('kassio/neoterm')
    call dein#add('mattn/webapi-vim')
    call dein#add('tpope/vim-commentary')
    call dein#add('tpope/vim-surround')
    call dein#add('wakatime/vim-wakatime')

    " --- Language-specific ---
    " {{{
        """ C/C++
        call dein#add('Rip-Rip/clang_complete')

        """ Elm
        call dein#add('ElmCast/elm-vim')

        """ Haskell
        call dein#add('eagletmt/neco-ghc')

        """ Hex
        call dein#add('Shougo/vinarise.vim')

        """ JavaScript/TypeScript
        call dein#add('pangloss/vim-javascript')
        call dein#add('leafgarland/typescript-vim')

        """ Rust
        call dein#add('racer-rust/vim-racer')
        call dein#add('rust-lang/rust.vim')

        """ TOML
        call dein#add('cespare/vim-toml')
    " }}}

    call dein#end()
    call dein#save_state()
endif


" === General ===
" {{{
    " --- General mappings ---
    map ; :
    let g:mapleader=" "
    noremap j gj
    noremap k gk

    " --- Filetype plugins ---
    filetype plugin on
    filetype indent on

    " --- Indentation ---
    set expandtab
    set tabstop=4
    set shiftwidth=4
    set autoindent
    set smartindent

    " --- Line numbers ---
    set relativenumber
    augroup line_numbers
        autocmd!
        autocmd InsertEnter * :set number norelativenumber
        autocmd InsertLeave * :set nonumber relativenumber
    augroup END

    " --- Line wrap ---
    set wrap
    set linebreak

    " --- Local vimrc ---
    autocmd BufEnter * silent! source local.vim
    autocmd BufEnter * silent! source .local.vim

    " --- Misc ---
    set ruler
    set cursorline

    set noswapfile

    " --- Mouse ---
    set mouse=a

    " --- Search ---
    set hlsearch
    set ignorecase
    set smartcase
    map <Leader>h :noh<CR>

    " --- Splitting ---
    set splitright
    set splitbelow

    " --- Tab navigation ---
    map <Leader>[ :tabprevious<CR>
    map <Leader>] :tabnext<CR>

    " --- Whitespaces ---
    set list
    set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:·
" }}}


" === Appearance ===
" {{{
    set background=dark
    if filereadable(expand("~/.vimrc_background"))
        let base16colorspace=256
        source ~/.vimrc_background
    endif
    syntax enable

    let g:lightline = {
    \   'colorscheme': 'base16'
    \ }
" }}}


" === Autocomplete & Snippets ===
" {{{
    set completeopt-=preview
    let g:deoplete#enable_at_startup = 1
    let g:neocomplete#enable_at_startup = 1

    imap <C-Space> <Plug>(neosnippet_expand_or_jump)
    smap <C-Space> <Plug>(neosnippet_expand_or_jump)
    xmap <C-Space> <Plug>(neosnippet_expand_target)

    if (!exists('g:deoplete#omni#input_patterns'))
        let g:deoplete#omni#input_patterns = {}
    endif
" }}}


" === Build & Run ===
" {{{
    function! PreBuild() abort
        if exists('g:prebuildcmd')
            exec 'Texec ' . g:prebuildcmd
        endif
    endfunction

    function! Build() abort
        if exists('g:buildcmd')
            exec 'Texec ' . g:buildcmd
        elseif &ft =~# '^\%(rust\)$'
            Texec cargo build
        elseif &ft =~# '^\%(javascript\|typescript\)$'
            Texec npm run build
        else
            Texec make
        endif
    endfunction

    function! Run() abort
        if exists('g:runcmd')
            exec 'Texec ' . g:runcmd
        elseif &ft =~# '^\%(rust\)$'
            Texec cargo run
        endif
    endfunction

    function! Test() abort
        if exists('g:testcmd')
            exec 'Texec ' . g:testcmd
        elseif &ft =~# '^\%(rust\)$'
            Texec cargo test
        elseif &ft =~# '^\%(javascript\|typescript\)$'
            Texec npm run test
        else
            Texec make test
        endif
    endfunction

    function! EmitAsm() abort
        if &ft =~# '^\%(rust\)$'
            RustEmitAsm
        endif
    endfunction

    map <F4> :call PreBuild()<CR>
    imap <F4> <C-o>:call PreBuild()<CR>
    map <F5> :call Build()<CR>
    imap <F5> <C-o>:call Build()<CR>
    map <F6> :call Run()<CR>
    imap <F6> <C-o>:call Run()<CR>
    map <F7> :call Test()<CR>
    imap <F7> <C-o>:call Test()<CR>
    map <F8> :call Check()<CR>
    imap <F8> <C-o>:call Check()<CR>
    " F9-F12 are reserved for debug hotkeys
" }}}


" === Code style ===
" {{{
    " --- Auto formatting ---
    " {{{
        map <Leader>f :call AutoFormat()<cr>

        let g:autoformat_on_save_default = 0

        if !exists('g:autoformat_on_save')
            let g:autoformat_on_save = g:autoformat_on_save_default
        endif

        autocmd! BufWritePre * if g:autoformat_on_save | call AutoFormat() | endif

        """ ClangFormat
        let g:clang_format_fallback_style = 'LLVM'

        """ RustFmt
        let g:rustfmt_fail_silently=1

        function! AutoFormat() abort
            if &ft =~# '^\%(c\|cpp\|objc\|java\|javascript\|typescript\|proto\)$'
                ClangFormat
            elseif &ft =~# '^\%(rust\)$'
                RustFmt
            endif
        endfunction
    " }}}

    " --- Linting ---
    " {{{
        let g:check_on_save_default = 0

        if !exists('g:check_on_save')
            let g:check_on_save = g:check_on_save_default
        endif

        function! Check() abort
            if exists('g:checkmaker')
                exec 'Neomake! ' . g:checkmaker
            elseif exists('g:checkcmd')
                exec 'Texec ' . g:checkcmd
            else
                Neomake
            endif
        endfunction

        let g:neomake_error_sign   = { 'text': '*', 'texthl': 'NeomakeErrorSign'   }
        let g:neomake_warning_sign = { 'text': '*', 'texthl': 'NeomakeWarningSign' }
        let g:neomake_message_sign = { 'text': '*', 'texthl': 'NeomakeMessageSign' }
        let g:neomake_info_sign    = { 'text': '*', 'texthl': 'NeomakeInfoSign'    }

        autocmd! BufWritePost * if g:check_on_save | call Check() | endif
    " }}}
" }}}


" === Localization ===
" {{{
    set enc=utf-8

    let g:XkbSwitchEnabled = 1
    let g:XkbSwitchNLayout = 'us'
" }}}


" === Navigation ===
" {{{
    map <F1> :NERDTreeToggle<CR>
    imap <F1> <C-o>:NERDTreeToggle<CR>

    augroup nerdtree
        autocmd!
        autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
    augroup END

    map <F2> :FSHere<CR>
    imap <F2> <C-o>:FSHere<CR>
" }}}


" === Performance ===
" {{{
    set lazyredraw
    syntax sync maxlines=256
" }}}


" === Terminal ===
" {{{
    if has('nvim')
        map <F3> :TREPLSendLine<CR>
        imap <F3> <C-o>:TREPLSendLine<CR>
        vmap <F3> :TREPLSendSelection<CR>
    endif

    let g:neoterm_keep_term_open = 0
    let g:neoterm_size = 15

    if has('nvim')
        command! -nargs=+ Texec :T <args>
    else
        command! -nargs=+ Texec :! <args>
    endif

    command! -nargs=+ Git :Texec git <args>
    command! -nargs=* Make :Texec make <args>

    if has('nvim')
        tnoremap <Esc> <C-\><C-n>
        tnoremap <C-w>h <C-\><C-n><C-w>h
        tnoremap <C-w>j <C-\><C-n><C-w>j
        tnoremap <C-w>k <C-\><C-n><C-w>k
        tnoremap <C-w>l <C-\><C-n><C-w>l

        nnoremap <silent> <Leader>tn :Tnew<cr>
        nnoremap <silent> <Leader>tq :call neoterm#close()<cr>
        nnoremap <silent> <Leader>tc :call neoterm#clear()<cr>
        nnoremap <silent> <Leader>tk :call neoterm#kill()<cr>
    endif
" }}}


" === Language-specific ===
" {{{
    " --- C/C++ ---
    command! -nargs=0 ClangFormat :silent! pyf /usr/share/clang/clang-format.py
    let g:neomake_c_enabled_makers = ['clang']
    autocmd FileType c,cpp setlocal omnifunc=ClangComplete

    " --- Haskell ---
    let g:neomake_haskell_enabled_makers = []
    autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc

    " --- JavaScript/TypeScript ---
    let g:neomake_typescript_tslint_maker = {
        \ 'args': ['%:p'],
        \ 'errorformat': 'ERROR: %f[%l\, %c]: %m',
        \ }

    let g:neomake_typescript_tsc_maker = {
        \ 'args': ['--project', neomake#utils#FindGlobFile(expand('%:p:h'), 'tsconfig.json'), '--noEmit'],
        \ 'append_file': 0,
        \ 'errorformat': '%f(%l\,%c): %m'
        \ }

    let g:neomake_javascript_enabled_makers = ['eslint']
    let g:neomake_typescript_enabled_makers = ['tsc', 'tslint']

    " --- Rust ---
    command! -nargs=+ Cargo :Texec cargo <args>
    let g:neomake_rust_enabled_makers = ['rustc']
" }}}

CLICK TO VIEW

x