Browse Source

bump local setup.

jackyalcine 3 months ago
parent
commit
0833039c09
Signed by: Jacky Alciné <yo@jacky.wtf> GPG Key ID: 537A4F904B15268D
4 changed files with 204 additions and 194 deletions
  1. 53
    45
      home/.config/nvim/autoload/plug.vim
  2. 2
    2
      home/.config/nvim/ginit.vim
  3. 147
    145
      home/.config/nvim/init.vim
  4. 2
    2
      home/.vimrc_background

+ 53
- 45
home/.config/nvim/autoload/plug.vim View File

@@ -350,6 +350,23 @@ if s:is_win
350 350
   function! s:is_local_plug(repo)
351 351
     return a:repo =~? '^[a-z]:\|^[%~]'
352 352
   endfunction
353
+
354
+  " Copied from fzf
355
+  function! s:wrap_cmds(cmds)
356
+    return map(['@echo off', 'for /f "tokens=4" %%a in (''chcp'') do set origchcp=%%a', 'chcp 65001 > nul'] +
357
+    \ (type(a:cmds) == type([]) ? a:cmds : [a:cmds]) +
358
+    \ ['chcp %origchcp% > nul'], 'v:val."\r"')
359
+  endfunction
360
+
361
+  function! s:batchfile(cmd)
362
+    let batchfile = tempname().'.bat'
363
+    call writefile(s:wrap_cmds(a:cmd), batchfile)
364
+    let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 1})
365
+    if &shell =~# 'powershell\.exe$'
366
+      let cmd = '& ' . cmd
367
+    endif
368
+    return [batchfile, cmd]
369
+  endfunction
353 370
 else
354 371
   function! s:rtp(spec)
355 372
     return s:dirpath(a:spec.dir . get(a:spec, 'rtp', ''))
@@ -434,8 +451,8 @@ endfunction
434 451
 
435 452
 function! s:dobufread(names)
436 453
   for name in a:names
437
-    let path = s:rtp(g:plugs[name]).'/**'
438
-    for dir in ['ftdetect', 'ftplugin']
454
+    let path = s:rtp(g:plugs[name])
455
+    for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
439 456
       if len(finddir(dir, path))
440 457
         if exists('#BufRead')
441 458
           doautocmd BufRead
@@ -794,9 +811,7 @@ endfunction
794 811
 
795 812
 function! s:chsh(swap)
796 813
   let prev = [&shell, &shellcmdflag, &shellredir]
797
-  if s:is_win
798
-    set shell=cmd.exe shellcmdflag=/c shellredir=>%s\ 2>&1
799
-  elseif a:swap
814
+  if !s:is_win && a:swap
800 815
     set shell=sh shellredir=>%s\ 2>&1
801 816
   endif
802 817
   return prev
@@ -809,9 +824,7 @@ function! s:bang(cmd, ...)
809 824
     "        but it won't work on Windows.
810 825
     let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd
811 826
     if s:is_win
812
-      let batchfile = tempname().'.bat'
813
-      call writefile(["@echo off\r", cmd . "\r"], batchfile)
814
-      let cmd = batchfile
827
+      let [batchfile, cmd] = s:batchfile(cmd)
815 828
     endif
816 829
     let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
817 830
     execute "normal! :execute g:_plug_bang\<cr>\<cr>"
@@ -1094,7 +1107,7 @@ function! s:update_finish()
1094 1107
       elseif has_key(spec, 'tag')
1095 1108
         let tag = spec.tag
1096 1109
         if tag =~ '\*'
1097
-          let tags = s:lines(s:system('git tag --list '.s:shellesc(tag).' --sort -version:refname 2>&1', spec.dir))
1110
+          let tags = s:lines(s:system('git tag --list '.plug#shellescape(tag).' --sort -version:refname 2>&1', spec.dir))
1098 1111
           if !v:shell_error && !empty(tags)
1099 1112
             let tag = tags[0]
1100 1113
             call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag))
@@ -1151,7 +1164,7 @@ function! s:job_abort()
1151 1164
       silent! call job_stop(j.jobid)
1152 1165
     endif
1153 1166
     if j.new
1154
-      call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir))
1167
+      call s:system('rm -rf ' . plug#shellescape(g:plugs[name].dir))
1155 1168
     endif
1156 1169
   endfor
1157 1170
   let s:jobs = {}
@@ -1204,15 +1217,10 @@ endfunction
1204 1217
 
1205 1218
 function! s:spawn(name, cmd, opts)
1206 1219
   let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
1207
-            \ 'batchfile': (s:is_win && (s:nvim || s:vim8)) ? tempname().'.bat' : '',
1208 1220
             \ 'new': get(a:opts, 'new', 0) }
1209 1221
   let s:jobs[a:name] = job
1210
-  let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
1211
-  if !empty(job.batchfile)
1212
-    call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
1213
-    let cmd = job.batchfile
1214
-  endif
1215
-  let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)
1222
+  let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir, 0) : a:cmd
1223
+  let argv = s:is_win ? ['cmd', '/s', '/c', '"'.cmd.'"'] : ['sh', '-c', cmd]
1216 1224
 
1217 1225
   if s:nvim
1218 1226
     call extend(job, {
@@ -1262,9 +1270,6 @@ function! s:reap(name)
1262 1270
   call s:log(bullet, a:name, empty(result) ? 'OK' : result)
1263 1271
   call s:bar()
1264 1272
 
1265
-  if has_key(job, 'batchfile') && !empty(job.batchfile)
1266
-    call delete(job.batchfile)
1267
-  endif
1268 1273
   call remove(s:jobs, a:name)
1269 1274
 endfunction
1270 1275
 
@@ -1354,8 +1359,8 @@ while 1 " Without TCO, Vim stack is bound to explode
1354 1359
           \ printf('git clone %s %s %s %s 2>&1',
1355 1360
           \ has_tag ? '' : s:clone_opt,
1356 1361
           \ prog,
1357
-          \ s:shellesc(spec.uri),
1358
-          \ s:shellesc(s:trim(spec.dir))), { 'new': 1 })
1362
+          \ plug#shellescape(spec.uri, {'script': 0}),
1363
+          \ plug#shellescape(s:trim(spec.dir), {'script': 0})), { 'new': 1 })
1359 1364
   endif
1360 1365
 
1361 1366
   if !s:jobs[name].running
@@ -1982,17 +1987,23 @@ function! s:update_ruby()
1982 1987
 EOF
1983 1988
 endfunction
1984 1989
 
1985
-function! s:shellesc_cmd(arg)
1986
-  let escaped = substitute(a:arg, '[&|<>()@^]', '^&', 'g')
1987
-  let escaped = substitute(escaped, '%', '%%', 'g')
1988
-  let escaped = substitute(escaped, '"', '\\^&', 'g')
1989
-  let escaped = substitute(escaped, '\(\\\+\)\(\\^\)', '\1\1\2', 'g')
1990
-  return '^"'.substitute(escaped, '\(\\\+\)$', '\1\1', '').'^"'
1990
+function! s:shellesc_cmd(arg, script)
1991
+  let escaped = substitute('"'.a:arg.'"', '[&|<>()@^!"]', '^&', 'g')
1992
+  return substitute(escaped, '%', (a:script ? '%' : '^') . '&', 'g')
1993
+endfunction
1994
+
1995
+function! s:shellesc_ps1(arg)
1996
+  return "'".substitute(escape(a:arg, '\"'), "'", "''", 'g')."'"
1991 1997
 endfunction
1992 1998
 
1993
-function! s:shellesc(arg)
1994
-  if &shell =~# 'cmd.exe$'
1995
-    return s:shellesc_cmd(a:arg)
1999
+function! plug#shellescape(arg, ...)
2000
+  let opts = a:0 > 0 && type(a:1) == s:TYPE.dict ? a:1 : {}
2001
+  let shell = get(opts, 'shell', s:is_win ? 'cmd.exe' : 'sh')
2002
+  let script = get(opts, 'script', 1)
2003
+  if shell =~# 'cmd\.exe$'
2004
+    return s:shellesc_cmd(a:arg, script)
2005
+  elseif shell =~# 'powershell\.exe$' || shell =~# 'pwsh$'
2006
+    return s:shellesc_ps1(a:arg)
1996 2007
   endif
1997 2008
   return shellescape(a:arg)
1998 2009
 endfunction
@@ -2026,8 +2037,9 @@ function! s:format_message(bullet, name, message)
2026 2037
   endif
2027 2038
 endfunction
2028 2039
 
2029
-function! s:with_cd(cmd, dir)
2030
-  return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd)
2040
+function! s:with_cd(cmd, dir, ...)
2041
+  let script = a:0 > 0 ? a:1 : 1
2042
+  return printf('cd%s %s && %s', s:is_win ? ' /d' : '', plug#shellescape(a:dir, {'script': script}), a:cmd)
2031 2043
 endfunction
2032 2044
 
2033 2045
 function! s:system(cmd, ...)
@@ -2035,11 +2047,9 @@ function! s:system(cmd, ...)
2035 2047
     let [sh, shellcmdflag, shrd] = s:chsh(1)
2036 2048
     let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
2037 2049
     if s:is_win
2038
-      let batchfile = tempname().'.bat'
2039
-      call writefile(["@echo off\r", cmd . "\r"], batchfile)
2040
-      let cmd = batchfile
2050
+      let [batchfile, cmd] = s:batchfile(cmd)
2041 2051
     endif
2042
-    return system(s:is_win ? '('.cmd.')' : cmd)
2052
+    return system(cmd)
2043 2053
   finally
2044 2054
     let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
2045 2055
     if s:is_win
@@ -2115,7 +2125,7 @@ endfunction
2115 2125
 
2116 2126
 function! s:rm_rf(dir)
2117 2127
   if isdirectory(a:dir)
2118
-    call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir))
2128
+    call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . plug#shellescape(a:dir))
2119 2129
   endif
2120 2130
 endfunction
2121 2131
 
@@ -2224,7 +2234,7 @@ function! s:upgrade()
2224 2234
   let new = tmp . '/plug.vim'
2225 2235
 
2226 2236
   try
2227
-    let out = s:system(printf('git clone --depth 1 %s %s', s:shellesc(s:plug_src), s:shellesc(tmp)))
2237
+    let out = s:system(printf('git clone --depth 1 %s %s', plug#shellescape(s:plug_src), plug#shellescape(tmp)))
2228 2238
     if v:shell_error
2229 2239
       return s:err('Error upgrading vim-plug: '. out)
2230 2240
     endif
@@ -2367,11 +2377,9 @@ function! s:preview_commit()
2367 2377
   setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
2368 2378
   try
2369 2379
     let [sh, shellcmdflag, shrd] = s:chsh(1)
2370
-    let cmd = 'cd '.s:shellesc(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
2380
+    let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
2371 2381
     if s:is_win
2372
-      let batchfile = tempname().'.bat'
2373
-      call writefile(["@echo off\r", cmd . "\r"], batchfile)
2374
-      let cmd = batchfile
2382
+      let [batchfile, cmd] = s:batchfile(cmd)
2375 2383
     endif
2376 2384
     execute 'silent %!' cmd
2377 2385
   finally
@@ -2420,9 +2428,9 @@ function! s:diff()
2420 2428
     call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
2421 2429
     for [k, v] in plugs
2422 2430
       let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..'
2423
-      let cmd = 'git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)'))
2431
+      let cmd = 'git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 'plug#shellescape(v:val)'))
2424 2432
       if has_key(v, 'rtp')
2425
-        let cmd .= ' -- '.s:shellesc(v.rtp)
2433
+        let cmd .= ' -- '.plug#shellescape(v.rtp)
2426 2434
       endif
2427 2435
       let diff = s:system_chomp(cmd, v.dir)
2428 2436
       if !empty(diff)

+ 2
- 2
home/.config/nvim/ginit.vim View File

@@ -1,6 +1,6 @@
1 1
 " File:          ginit.vim
2 2
 " Author:        Jacky Alcine <yo@jacky.wtf>
3 3
 " Description:   GUI specific tweaks.
4
-" Last Modified: 2018-01-03
4
+" Last Modified: 2019-07-31 23:56:01 PDT
5 5
 
6
-set guifont=Fira\ Code:h9
6
+set guifont=Fira\ Code:h10

+ 147
- 145
home/.config/nvim/init.vim View File

@@ -1,4 +1,4 @@
1
-" File:          init.vim
1
+" File:          init.vim
2 2
 " Author:        Jacky Alcine <yo@jacky.wtf>
3 3
 " Description:   Entry point of all of my configuration.
4 4
 " Last Modified: August 08, 2017
@@ -6,87 +6,15 @@
6 6
 " This is where I tell Neovim to do my bidding. Yes, I have over
7 7
 " 100+ plugins. No, Neovim does not run slow.
8 8
 "
9
-" vim: set fdm=marker foldlevel=0 :
9
+" vim: set fdm=syntax foldlevel=0 :
10 10
 
11 11
 set encoding=UTF-8 fileencoding=UTF-8
12
+set hidden
12 13
 scriptencoding UTF-8
13 14
 
14 15
 let vimrc_root = fnamemodify($MYVIMRC, ':p:h')
15 16
 exec "let $PATH=\"" . vimrc_root . "/node_modules/.bin:\" . $PATH"
16 17
 
17
-" {{{ settings
18
-" These are core options for Neovim. A lot of these help me use Neovim in a
19
-" semi-intuitive fashion for me.
20
-"
21
-if has('termguicolors') " {{{2 Improve terminal colors
22
-  set t_8f=\[[38;2;%lu;%lu;%lum
23
-  set t_8b=\[[48;2;%lu;%lu;%lum
24
-  set termguicolors
25
-endif " 2}}}
26
-
27
-" Always show a statusline.
28
-set laststatus=2
29
-"
30
-" Allow myself to count what line I'm on; optimized for scanning and jumping
31
-" over multiple lines quickly.
32
-set number numberwidth=3 relativenumber
33
-set sidescrolloff=1 sidescroll=1
34
-set conceallevel=3 concealcursor=nivc
35
-
36
-" Fold options {{{2
37
-set foldenable
38
-set foldminlines=10
39
-set foldmethod=syntax
40
-set foldlevel=3
41
-" 2}}}
42
-set wrap wrapmargin=2
43
-set linebreak
44
-set shortmess+=c
45
-set hidden
46
-set pumheight=5
47
-set showmode showmatch
48
-set lazyredraw
49
-set spelllang=en_us
50
-set inccommand=nosplit
51
-set maxmempattern=8196
52
-
53
-set completeopt=menu,menuone,preview,noselect,noinsert
54
-
55
-set fillchars+=diff:⣿
56
-set fillchars+=vert:│
57
-set fillchars+=fold:-
58
-set showbreak=↪
59
-set listchars+=eol:¬
60
-set listchars+=extends:❯
61
-set listchars+=precedes:❮
62
-set listchars+=trail:⋅
63
-set listchars+=nbsp:⋅
64
-set listchars+=tab:\|\
65
-
66
-set regexpengine=1
67
-
68
-set undofile
69
-set backup writebackup
70
-set undodir=$HOME/.config/nvim/undo
71
-set backupdir=$HOME/.config/nvim/backup
72
-set noswapfile
73
-
74
-set tabstop=2 softtabstop=2
75
-set shiftwidth=2 textwidth=80
76
-set smarttab expandtab
77
-set shiftround
78
-
79
-set ignorecase smartcase
80
-set laststatus=2 cmdheight=2
81
-set incsearch hlsearch
82
-
83
-set tags+=./tags,./.tags,./.vimtags
84
-set tags+=tags,.tags,.vimtags
85
-set tags+=$HOME/.config/nvim/tags/*
86
-set nocscopetag
87
-set showfulltag showmatch
88
-" }}}
89
-
90 18
 iabbrev myemail yo@jacky.wtf
91 19
 iabbrev myname Jacky Alciné
92 20
 iabbrev me_fname Jacky
@@ -146,7 +74,7 @@ endfunc " }}}
146 74
 "
147 75
 " Plugins {{{
148 76
 filetype off
149
-call plug#begin(expand('$HOME/.config/nvim/plugins'))
77
+call plug#begin(expand('$HOME/.config/nvim/plugged'))
150 78
 
151 79
 Plug 'tpope/vim-sensible'
152 80
 Plug 'tpope/vim-surround'
@@ -158,6 +86,7 @@ Plug 'tpope/vim-vinegar'
158 86
 Plug 'tpope/vim-scriptease'
159 87
 Plug 'janko-m/vim-test'
160 88
 Plug 'wsdjeg/vim-fetch'
89
+Plug 'mattn/webapi-vim'
161 90
 Plug 'tpope/vim-dotenv'
162 91
       \ | Plug 'direnv/direnv.vim'
163 92
       \ | Plug 'wincent/terminus'
@@ -169,9 +98,8 @@ Plug 'tpope/vim-fugitive'
169 98
       \ | Plug 'int3/vim-extradite'
170 99
       \ | Plug 'tommcdo/vim-fubitive'
171 100
       \ | Plug 'tommcdo/vim-fugitive-blame-ext'
172
-Plug 'bfrg/vim-cpp-modern', { 'for': 'c++,c' }
173 101
 Plug 'junkblocker/patchreview-vim'
174
-Plug 'codegram/vim-codereview'
102
+      \ | Plug 'codegram/vim-codereview'
175 103
 Plug 'chiel92/vim-autoformat'
176 104
 Plug 'editorconfig/editorconfig-vim'
177 105
 Plug 'embear/vim-localvimrc'
@@ -186,57 +114,124 @@ Plug 'vim-airline/vim-airline' |
186 114
       \ Plug 'vim-airline/vim-airline-themes'
187 115
 Plug 'ludovicchabant/vim-gutentags'
188 116
 Plug 'airblade/vim-rooter'
117
+Plug 'mhinz/vim-startify'
189 118
 Plug 'sheerun/vim-polyglot'
190 119
 Plug 'joonty/vdebug'
191 120
 Plug 'sirver/ultisnips'
192 121
       \ |  Plug 'honza/vim-snippets'
193 122
 Plug 'vim-scripts/dbext.vim'
194 123
 Plug 'terryma/vim-multiple-cursors'
195
-Plug 'mhinz/vim-startify'
196 124
 Plug 'ryanoasis/vim-devicons'
197 125
 Plug 'chriskempson/base16-vim'
198 126
 Plug 'mattesgroeger/vim-bookmarks'
199 127
 Plug 'sodapopcan/vim-twiggy'
200 128
 Plug 'junegunn/gv.vim'
129
+Plug 'rhysd/git-messenger.vim'
201 130
 Plug 'vrybas/vim-flayouts'
202
-Plug 'ekalinin/dockerfile.vim'
203 131
 Plug 'meain/vim-package-info', { 'do': 'npm install' }
132
+Plug 'brooth/far.vim'
204 133
 
205 134
 Plug 'ncm2/ncm2'
206 135
       \ | Plug 'roxma/nvim-yarp'
207 136
       \ | Plug 'ncm2/ncm2-bufword'
208 137
       \ | Plug 'ncm2/ncm2-path'
209 138
       \ | Plug 'ncm2/ncm2-tmux'
210
-      \ | Plug 'ncm2/ncm2-cssomni'
139
+      \ | Plug 'ncm2/ncm2-cssomni', {'for': 'css,scss'}
211 140
       \ | Plug 'ncm2/ncm2-syntax' | Plug 'Shougo/neco-syntax'
212 141
       \ | Plug 'ncm2/ncm2-tagprefix'
213
-      \ | Plug 'ncm2/ncm2-racer'
214 142
       \ | Plug 'ncm2/ncm2-vim' | Plug 'Shougo/neco-vim'
215
-      \ | Plug 'pbogut/ncm2-alchemist' | Plug 'slashmili/alchemist.vim'
143
+      \ | Plug 'pbogut/ncm2-alchemist', {'for': 'elixir,eex'} | Plug 'slashmili/alchemist.vim,' {'for': 'elixir,eex'}
216 144
       \ | Plug 'ncm2/ncm2-ultisnips'
145
+      \ | Plug 'ncm2/ncm2-racer', { 'do': 'cargo +nightly install racer && rustup component add rls rust-analysis rust-src' }
217 146
       \ | Plug 'roxma/LanguageServer-php-neovim',  {'do': 'composer install && composer run-script parse-stubs'}
218 147
       \ | Plug 'JakeBecker/elixir-ls', {'do': 'mix deps.get && mix compile && mix elixir_ls.release -o ' . vimrc_root . '/bin'}
219
-      \ | Plug 'autozimu/LanguageClient-neovim', {
220
-      \ 'branch': 'next',
221
-      \ 'do': 'bash install.sh',
222
-      \ }
148
+      \ | Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' }
149
+      \ | Plug 'bfrg/vim-cpp-modern', { 'for': 'c++,c' }
150
+      \ | Plug 'ekalinin/dockerfile.vim', {'for': 'dockerfile'}
151
+      \ | Plug 'ap/vim-css-color', {'for': 'css,scss'}
223 152
 
153
+call plug#end()
154
+" }}}
224 155
 
225
-Plug 'severin-lemaignan/vim-minimap'
226
-Plug 'brooth/far.vim'
156
+" {{{ settings
157
+" These are core options for Neovim. A lot of these help me use Neovim in a
158
+" semi-intuitive fashion for me.
159
+"
160
+if has('termguicolors') " {{{2 Improve terminal colors
161
+  set t_8f=\[[38;2;%lu;%lu;%lum
162
+  set t_8b=\[[48;2;%lu;%lu;%lum
163
+  set termguicolors
164
+endif " 2}}}
227 165
 
228
-call plug#end()
166
+" Always show a statusline.
167
+set laststatus=2
168
+"
169
+" Allow myself to count what line I'm on; optimized for scanning and jumping
170
+" over multiple lines quickly.
171
+set number numberwidth=3
172
+set relativenumber
173
+set sidescrolloff=1 sidescroll=1
174
+set conceallevel=3 concealcursor=nivc
175
+
176
+" Fold options {{{2
177
+set foldenable foldmethod=syntax
178
+set foldlevel=3 foldcolumn=2 foldminlines=5
179
+" 2}}}
180
+set wrap wrapmargin=2
181
+set linebreak
182
+set pumheight=5
183
+set showmode showmatch
184
+set lazyredraw
185
+set spelllang=en_us
186
+set inccommand=nosplit
187
+set maxmempattern=8196
188
+
189
+set completeopt=menu,menuone,preview,noselect,noinsert
190
+
191
+set fillchars+=diff:⣿
192
+set fillchars+=vert:│
193
+set fillchars+=fold:-
194
+set showbreak=↪
195
+set listchars+=eol:¬
196
+set listchars+=extends:❯
197
+set listchars+=precedes:❮
198
+set listchars+=trail:⋅
199
+set listchars+=nbsp:⋅
200
+set listchars+=tab:\|\
201
+
202
+set regexpengine=1
203
+
204
+set undofile
205
+set backup writebackup
206
+set undodir=$HOME/.config/nvim/undo
207
+set backupdir=$HOME/.config/nvim/backup
208
+set noswapfile
209
+
210
+set tabstop=2 softtabstop=2
211
+set shiftwidth=2 textwidth=80
212
+set smarttab expandtab
213
+set shiftround
214
+
215
+set ignorecase smartcase
216
+set laststatus=2 cmdheight=2
217
+set incsearch hlsearch
218
+
219
+set tags+=./tags,./.tags,./.vimtags
220
+set tags+=tags,.tags,.vimtags
221
+set tags+=$HOME/.config/nvim/tags/*
222
+set showfulltag noshowmatch
229 223
 " }}}
230 224
 
225
+
231 226
 " {{{ Options
232 227
 " {{{2 vim-bookmarks
233 228
 let g:bookmark_sign = '♥'
234
-let g:bookmark_highlight_lines = 0
229
+let g:bookmark_highlight_lines = 1
235 230
 " }}}
236 231
 "
237 232
 " {{{2 signify
238 233
 let g:signify_vcs_list = [ 'git', 'hg', 'bzr' ]
239
-let g:signify_realtime = 1
234
+let g:signify_realtime = 0
240 235
 let g:signify_sign_show_count = 1
241 236
 let g:signify_line_highlight = 0
242 237
 " 2}}}
@@ -245,38 +240,42 @@ let g:twiggy_enable_remote_delete = 1
245 240
 " 2}}}
246 241
 
247 242
 if executable('ripgrep')
248
-  let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""'
249
-  set grepprg=ag\ --nogroup\ --column\ --smart-case\ --nocolor\ --follow
243
+  let $FZF_DEFAULT_COMMAND = 'ag --silent --hidden'
244
+  set grepprg=ag\ --nogroup\ --column\ --smart-case\ --nocolor\ --follow\ --vimgrep
250 245
   set grepformat=%f:%l:%c:%m
251 246
 endif
252 247
 " }}}
248
+" {{{2
249
+" }}}
253 250
 "
254 251
 let g:autoformat_remove_trailing_spaces = 1
255 252
 " {{{2 ale
256
-let g:ale_command_wrapper = 'nice -n4'
253
+let g:ale_command_wrapper = 'nice -n5'
257 254
 let g:ale_set_ballons = 1
255
+let g:ale_rust_cargo_use_clippy = executable('cargo-clippy')
256
+let g:ale_rust_cargo_check_tests = 1
257
+let g:ale_virtualtext_cursor = 1
258 258
 let g:ale_completion_enabled = 0
259 259
 let g:ale_use_global_executables = 0
260 260
 let g:ale_fix_on_save = 1
261 261
 let g:ale_fixers = {
262 262
       \ '*' : ['remove_trailing_lines', 'trim_whitespace'],
263
-      \ 'javascript': ['eslint', 'prettier'],
264
-      \ 'typescript': ['tslint', 'eslint', 'prettier'],
265
-      \ 'vue': ['prettier', 'eslint'],
263
+      \ 'javascript': ['eslint'],
264
+      \ 'typescript': ['eslint'],
265
+      \ 'vue': ['eslint'],
266 266
       \ 'scss': ['stylelint'],
267 267
       \ 'html': ['stylelint', 'prettier', 'tidy'],
268 268
       \ 'rust': ['rustfmt'],
269 269
       \ 'elixir': ['mix_format'],
270 270
       \ }
271
+let g:ale_linters = {
272
+      \ 'rust': ['rustc', 'clippy', 'cargo'],
273
+      \ }
271 274
 " 2}}}
272 275
 "
273
-" {{{2 minimap
274
-let g:minimap_show='<leader>Ms'
275
-let g:minimap_update='<leader>Mu'
276
-let g:minimap_close='<leader>Mc'
277
-let g:minimap_toggle='<leader>Mt'
278
-" }}}
279
-"
276
+let g:racer_experimental_completer = 0
277
+let g:racer_insert_paren = 1
278
+
280 279
 " {{{2 vim-test
281 280
 let g:test#custom_transformations = {
282 281
       \ 'vagrant': function('<SID>VagrantTransform'),
@@ -288,7 +287,7 @@ let g:test#preserve_screen = 1
288 287
 "
289 288
 " {{{2 Zeavim
290 289
 let g:zv_file_types = {
291
-      \ 'eelixir': 'html,elixir',
290
+      \ 'eelixir': 'html,elixir,erlang',
292 291
       \ 'elixir': 'elixir,erlang',
293 292
       \ 'sass': 'scss,css',
294 293
       \ 'typescript': 'typescript,javascript,html'
@@ -330,35 +329,7 @@ let g:fzf_colors = {
330 329
 " 2}}}
331 330
 "
332 331
 let g:rooter_use_lcd = 1
333
-" {{{2 startify
334
-let g:startify_list_order = ['commands', 'sessions', 'bookmarks', 'files', 'dir']
335
-let g:startify_files_number = 15
336
-let g:startify_change_to_dir = 0
337
-let g:startify_fortune_use_unicode = 1
338
-let g:startify_session_delete_buffers = 1
339
-let g:startify_session_autoload = 1
340
-let g:startify_session_persistence = 1
341
-
342
-function! s:list_commits()
343
-  let git = 'git -C ~/.homesick/repos/vimrc'
344
-  let commits = systemlist(git .' log --oneline | head -n10')
345
-  let git = 'G'. git[1:]
346
-  return map(commits, '{"line": matchstr(v:val, "\\s\\zs.*"), "cmd": "'. git .' show ". matchstr(v:val, "^\\x\\+") }')
347
-endfunction
348 332
 
349
-let g:startify_lists = [
350
-      \ { 'header': ['   Sessions'],       'type': 'sessions' },
351
-      \ { 'header': ['   Bookmarks'],      'type': 'bookmarks' },
352
-      \ { 'header': ['   Commands'],       'type': 'commands' },
353
-      \ { 'header': ['   MRU '. getcwd()], 'type': 'dir' },
354
-      \ { 'header': ['   MRU'],            'type': 'files' },
355
-      \ { 'header': ['   Vim Config Edits'],        'type': function('s:list_commits') },
356
-      \ ]
357
-let g:startify_session_before_save = [
358
-      \ 'silent! s:terminal_kill_extra_buffers()'
359
-      \ ]
360
-" 2}}}
361
-"
362 333
 let g:UltiSnipsJumpForwardTrigger = "<c-j>"
363 334
 let g:UltiSnipsJumpBackwardTrigger  = "<c-k>"
364 335
 let g:UltiSnipsRemoveSelectModeMappings = 0
@@ -372,14 +343,13 @@ let g:test#neovim#term_position = "leftabove"
372 343
 " }}}
373 344
 "
374 345
 " {{{2 localvimrc
375
-let g:localvimrc_sandbox = 0
346
+let g:localvimrc_sandbox = 1
376 347
 let g:localvimrc_persistent = 1
377 348
 let g:localvimrc_persistent_file = expand('$HOME/.config/nvim/localvimrc_persistent')
378 349
 let g:localvimrc_whitelist = [expand('$HOME/.lvimrc')]
379 350
 " 2}}}
380 351
 "
381 352
 " {{{2
382
-let g:far#source = "agnvim"
383 353
 let g:far#collapse_result = 1
384 354
 let g:far#auto_write_replaced_buffers = 1
385 355
 let g:far#auto_delete_replaced_buffers = 1
@@ -429,15 +399,18 @@ let g:airline_mode_map = {
429 399
 " }}}
430 400
 "
431 401
 " {{{2 langserver
402
+let g:LanguageClient_loggingLevel = 'ERROR'
432 403
 let g:LanguageClient_serverCommands = {
433
-      \ 'typescript': ['asdf', 'exec', 'javascript-typescript-stdio'],
434
-      \ 'javascript': ['asdf', 'exec', 'javascript-typescript-stdio'],
435
-      \ 'python': ['asdf', 'exec', 'pyls'],
436
-      \ 'rust': ['asdf', 'exec', 'rls'],
404
+      \ 'javascript': ['javascript-typescript-stdio'],
405
+      \ 'javascript.jsx': ['javascript-typescript-stdio'],
406
+      \ 'typescript': ['javascript-typescript-stdio'],
407
+      \ 'python': ['pyls'],
408
+      \ 'rust': ['rls'],
437 409
       \ 'elixir': [vimrc_root . '/bin/language_server.sh']
438 410
       \ }
439 411
 let g:LanguageClient_rootMarkers = {
440 412
       \ 'javascript': ['package.json'],
413
+      \ 'typescript': ['tslint.json'],
441 414
       \ 'elixir': ['mix.exs'],
442 415
       \ 'rust': ['Cargo.toml']
443 416
       \ }
@@ -465,6 +438,7 @@ call <SID>apply_bulk_mappings([
465 438
       \ ['i', ':Make install<CR>'],
466 439
       \ ['b', ':Make build<CR>'],
467 440
       \ ['c', ':Make clean<CR>'],
441
+      \ ['<space>', ':Make!<space>'],
468 442
       \ ], { 'prefix' : 'm' })
469 443
 
470 444
 
@@ -472,7 +446,8 @@ call <SID>apply_bulk_mappings([
472 446
       \ ['b', ':Buffers<cr>'],
473 447
       \ ['c', ':Commits<cr>'],
474 448
       \ ['f', ':Files<cr>'],
475
-      \ ['fg', ':GFiles?<cr>'],
449
+      \ ['fg?', ':GFiles?<cr>'],
450
+      \ ['fg', ':GFiles<cr>'],
476 451
       \ ['h', ':History<cr>'],
477 452
       \ ['H', ':Helptags<cr>'],
478 453
       \ ['mc', ':call fzf#vim#maps("c", 1)<cr>'],
@@ -482,7 +457,7 @@ call <SID>apply_bulk_mappings([
482 457
       \ ['mv', ':call fzf#vim#maps("v", 1)<cr>'],
483 458
       \ ['s', ':Snippets<cr>'],
484 459
       \ ['t', ':Tags<cr>'],
485
-      \ ['w', ':Windows<cr>'],
460
+      \ ['w', ':Windows<cr>']
486 461
       \ ], { 'prefix': 's' })
487 462
 
488 463
 call <SID>apply_bulk_mappings([
@@ -491,14 +466,19 @@ call <SID>apply_bulk_mappings([
491 466
       \ ['S', ':Glc<CR>'],
492 467
       \ ['b', ':Gbrowse<CR>'],
493 468
       \ ['c', ':Gcommit<CR>'],
469
+      \ ['C', ':Glc<CR>'],
494 470
       \ ['cO', ':Git checkout HEAD -- %<CR>'],
495 471
       \ ['co', ':Git checkout<space>'],
496 472
       \ ['e', ':Extradite<CR>'],
497 473
       \ ['f', ':Git fetch<space>'],
498 474
       \ ['fa', ':Git fetch --all<CR>'],
475
+      \ ['d', ':Git diff --cached<CR>'],
476
+      \ ['d!', ':Git diff<CR>'],
499 477
       \ ['l', ':Gpull<CR>'],
500 478
       \ ['mr', ':GlpullRequestSummaryTab'],
501 479
       \ ['p', ':Gpush<space>'],
480
+      \ ['r', ':Gpush dokku HEAD:master --no-verify'],
481
+      \ ['R', ':Gpush dokku HEAD:master --no-verify --force-with-lease'],
502 482
       \ ['rc', ':GlresolveConflictTab'],
503 483
       \ ['rm', ':Gremove %<CR>'],
504 484
       \ ['rmc', ':Gremove --cached %<CR>'],
@@ -510,6 +490,7 @@ call <SID>apply_bulk_mappings([
510 490
       \ ['st', ':SignifyToggle<CR>'],
511 491
       \ ['t', ':Twiggy<CR>'],
512 492
       \ ['x', ':Glabort<CR>'],
493
+      \ ['w', ':Glwrite<CR>'],
513 494
       \ ], { 'prefix': 'g' })
514 495
 
515 496
 call <SID>apply_bulk_mappings([
@@ -524,14 +505,34 @@ call <SID>apply_bulk_mappings([
524 505
 
525 506
 call <SID>apply_bulk_mappings([
526 507
       \ ['c', ':call LanguageClient_contextMenu()<CR>'],
527
-      \ ['d', ':call LanguageClient#textDocument_definition()<CR>'],
528 508
       \ ['D', ':call LanguageClient#textDocument_typeDefinition()<CR>'],
529 509
       \ ['i', ':call LanguageClient#textDocument_implementation()<CR>'],
530
-      \ ['r', ':call LanguageClient#textDocument_rename()<CR>'],
531 510
       \ ['f', ':call LanguageClient#textDocument_references()<CR>'],
532 511
       \ ['a', ':call LanguageClient#textDocument_codeAction()<CR>'],
533 512
       \ ], { 'prefix': 'lc'})
534 513
 
514
+function! s:LC_maps() abort
515
+  if has_key(g:LanguageClient_serverCommands, &filetype)
516
+    nnoremap <buffer> <silent> K :call LanguageClient#textDocument_hover()<cr>
517
+    nnoremap <buffer> <silent> gd :call LanguageClient#textDocument_definition()<CR>
518
+    nnoremap <buffer> <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
519
+    nnoremap <buffer> <silent> <Space><Space> :call <SID>LC_restart()<CR>
520
+  endif
521
+endfunction
522
+
523
+function! s:LC_restart() abort
524
+  :call LanguageClient#exit()
525
+  :call LanguageClient#startServer()
526
+endfunction
527
+
528
+autocmd FileType * call s:LC_maps()
529
+
530
+nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
531
+nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
532
+nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
533
+nnoremap <silent> ;; @:
534
+
535
+
535 536
 call <SID>apply_bulk_mappings([
536 537
       \ ['e', '<ESC>:cnext<CR>'],
537 538
       \ ['f', '<ESC>:cfirst<CR>'],
@@ -594,7 +595,7 @@ if filereadable(expand("~/.vimrc_background"))
594 595
   source ~/.vimrc_background
595 596
 endif
596 597
 
597
-filetype plugin indent on
598
+" filetype plugin indent on
598 599
 syntax on
599 600
 
600 601
 autocmd FileType gitcommit set bufhidden=delete
@@ -625,5 +626,6 @@ command! -bang -nargs=* Ag
625 626
       \                 <bang>0 ? fzf#vim#with_preview('up:60%')
626 627
       \                         : fzf#vim#with_preview('right:50%:hidden', '?'),
627 628
       \                 <bang>0)
629
+
628 630
 command! -bang -nargs=? -complete=dir Files
629 631
       \ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)

+ 2
- 2
home/.vimrc_background View File

@@ -1,3 +1,3 @@
1
-if !exists('g:colors_name') || g:colors_name != 'base16-tomorrow-night'
2
-  colorscheme base16-tomorrow-night
1
+if !exists('g:colors_name') || g:colors_name != 'base16-irblack'
2
+  colorscheme base16-irblack
3 3
 endif

Loading…
Cancel
Save