migrate vim configuration files

This commit is contained in:
Ray Elliott 2020-03-19 15:47:31 +00:00
commit b4ae067792
59 changed files with 10296 additions and 0 deletions

1
after/ftplugin/help.vim Normal file
View file

@ -0,0 +1 @@
nmap <buffer> q :q<CR>

2
after/ftplugin/html.vim Normal file
View file

@ -0,0 +1,2 @@
set foldlevelstart=2
set foldnestmax=5

View file

@ -0,0 +1,107 @@
" https://gist.github.com/romainl/1f50c55b0ee92e5420de51e6c4b38491
nnoremap <silent> <space>cF :call CocAction('runCommand', 'eslint.executeAutofix')<CR>
setlocal includeexpr=RESOLVE(v:fname)
function! RESOLVE(module) abort
let built_ins = [
\ "assert",
\ "async_hooks",
\ "child_process",
\ "cluster",
\ "crypto",
\ "dns",
\ "domain",
\ "events",
\ "fs",
\ "http",
\ "http2",
\ "https",
\ "inspector",
\ "net",
\ "os",
\ "path",
\ "perf_hooks",
\ "punycode",
\ "querystring",
\ "readline",
\ "stream",
\ "string_decoder",
\ "tls",
\ "tty",
\ "dgram",
\ "url",
\ "util",
\ "v8",
\ "vm",
\ "zlib" ]
" There's no source file for built-in node modules.
" Example: var http = require('http');
if index(built_ins, a:module) != -1
return 0
endif
" Handling absolute and relative paths.
" Example: var foo = require('./foo.js');
if a:module =~ '^\/' || a:module =~ '^\.\{1,2}\/'
let root = fnamemodify(substitute(finddir("node_modules", ".;"), '/node_modules', '', ''), ':p:h:h')
if a:module =~ '^\.\{1,2}\/'
let module = substitute(a:module, '^\.\{1,2}\/', '', '')
endif
let filename = 0
try
let filename = findfile(module, root)
catch
try
let filename = findfile(module . ".js", root)
catch
try
let filename = findfile(module . "/index.js", root)
catch
let filename = 0
endtry
endtry
endtry
return filename
endif
" Handling vendored-in modules.
" Example: var _ = require('lodash');
for dir in NODE_MODULES_PATHS()
" require('module') => node_modules/module/package.json#main => node_modules/module/**/...
if filereadable(dir . "/" . a:module . "/package.json")
let package = json_decode(join(readfile(dir . "/" . a:module . "/package.json")))
return dir . "/" . a:module . "/" . substitute(get(package, "main", "index.js"), '^\.\{1,2}\/', '', '')
endif
" require('module') => node_modules/module/index.js
if filereadable(dir . "/" . a:module . "/index.js")
return dir . "/" . a:module . "/index.js"
endif
" require('module') => node_modules/module.js
if filereadable(dir . "/" . a:module . ".js")
return dir . "/" . a:module . ".js"
endif
endfor
" well, well, well
return 0
endfunction
function! NODE_MODULES_PATHS() abort
" node_modules/
let node_modules = finddir("node_modules", ".;")
" node_modules/foo/node_modules/
let basic_dirs = extend([node_modules], globpath(node_modules, "*/node_modules", 1, 1))
" node_modules/@foo/bar/node_modules/
let all_dirs = extend(basic_dirs, globpath(node_modules, "@*/*/node_modules", 1, 1))
return all_dirs
endfunction

4
after/ftplugin/netrw.vim Normal file
View file

@ -0,0 +1,4 @@
nmap <buffer> o <CR>
nmap <buffer><silent> q <CR>:call CloseNetrw(1)<CR>
nmap <buffer><silent> Q :call CloseNetrw(0)<CR>
setl bufhidden=wipe

19
after/ftplugin/python.vim Normal file
View file

@ -0,0 +1,19 @@
set tabstop=4
set softtabstop=0
set shiftwidth=4
set noexpandtab
" set softtabstop=8
" set tabstop=4
" set shiftwidth=4
set textwidth=88
set foldmethod=indent
set foldnestmax=1
set colorcolumn=88
noremap <F4> :w<CR>:silent !clear;python %<CR> :redraw!<CR>
nnoremap <silent> <buffer> <F5> :call SaveAndExecute('python')<CR>
command! CTagsPython !ctags -R --fields=+l --languages=python --python-kinds=-iv -f ./.tags-py $(python -c "import os, sys; print(' '.join('{}'.format(d) for d in sys.path if os.path.isdir(d)))")

2
after/ftplugin/qf.vim Normal file
View file

@ -0,0 +1,2 @@
nmap <buffer> o <CR>
nmap <buffer> q :q<CR>

2
after/ftplugin/sass.vim Normal file
View file

@ -0,0 +1,2 @@
set includeexpr=substitute(substitute(substitute(v:fname,'\%(.*/\|^\)\zs','_',''),'^[\\~@]\/','./',''),'^[\\~@]','./node_modules/','')

2
after/ftplugin/vim.vim Normal file
View file

@ -0,0 +1,2 @@
set foldmethod=marker