diff options
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/go/config.vim | 8 | ||||
-rw-r--r-- | autoload/jsx_pretty/indent.vim | 31 | ||||
-rw-r--r-- | autoload/terraform.vim | 68 |
3 files changed, 84 insertions, 23 deletions
diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 4eff6f6f..787c4e2a 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -18,10 +18,6 @@ function! go#config#VersionWarning() abort return get(g:, 'go_version_warning', 1) endfunction -function! go#config#NullModuleWarning() abort - return get(g:, 'go_null_module_warning', 1) -endfunction - function! go#config#BuildTags() abort return get(g:, 'go_build_tags', '') endfunction @@ -279,10 +275,6 @@ function! go#config#MetalinterEnabled() abort return get(g:, "go_metalinter_enabled", default_enabled) endfunction -function! go#config#MetalinterDisabled() abort - return get(g:, "go_metalinter_disabled", []) -endfunction - function! go#config#GolintBin() abort return get(g:, "go_golint_bin", "golint") endfunction diff --git a/autoload/jsx_pretty/indent.vim b/autoload/jsx_pretty/indent.vim index d37d3990..428c366d 100644 --- a/autoload/jsx_pretty/indent.vim +++ b/autoload/jsx_pretty/indent.vim @@ -73,17 +73,27 @@ function! jsx_pretty#indent#get(js_indent) let line = substitute(getline(lnum), '^\s*\|\s*$', '', 'g') let current_syn = s:syn_sol(lnum) let current_syn_eol = s:syn_eol(lnum) - let prev_syn_sol = s:syn_sol(lnum - 1) - let prev_syn_eol = s:syn_eol(lnum - 1) + let prev_line_num = prevnonblank(lnum - 1) + let prev_syn_sol = s:syn_sol(prev_line_num) + let prev_syn_eol = s:syn_eol(prev_line_num) let prev_line = s:prev_line(lnum) let prev_ind = s:prev_indent(lnum) if s:syn_xmlish(current_syn) + if !s:syn_xmlish(prev_syn_sol) + \ && !s:syn_jsx_escapejs(prev_syn_sol) + \ && !s:syn_jsx_escapejs(prev_syn_eol) + \ && !s:syn_js_comment(prev_syn_sol) + if line =~ '^/\s*>' || line =~ '^<\s*' . s:end_tag + return prev_ind + else + return prev_ind + s:sw() + endif " { " <div></div> " ##} <-- - if s:syn_jsx_element(current_syn) && line =~ '}$' + elseif s:syn_jsx_element(current_syn) && line =~ '}$' let pair_line = searchpair('{', '', '}', 'b') return indent(pair_line) elseif line =~ '^-->$' @@ -143,16 +153,6 @@ function! jsx_pretty#indent#get(js_indent) else return prev_ind endif - elseif !s:syn_xmlish(prev_syn_sol) - if prev_line =~ '^\<\(return\|default\|await\|yield\)' - if line !~ '^/\s*>' || line !~ '^<\s*' . s:end_tag - return prev_ind + s:sw() - else - return prev_ind - endif - else - return prev_ind - endif else return prev_ind endif @@ -193,9 +193,10 @@ function! jsx_pretty#indent#get(js_indent) " Issue #68 " return (<div> " |<div>) - if prev_line =~ '^\<return' && line =~ '^<\s*' . s:end_tag + if (line =~ '^/\s*>' || line =~ '^<\s*' . s:end_tag) + \ && !s:syn_xmlish(prev_syn_sol) return prev_ind - endif + endif " If current syntax is not a jsx syntax group if s:syn_xmlish(prev_syn_eol) && line !~ '^[)\]}]' diff --git a/autoload/terraform.vim b/autoload/terraform.vim index 210ee59f..db1e3934 100644 --- a/autoload/terraform.vim +++ b/autoload/terraform.vim @@ -23,3 +23,71 @@ function! terraform#fmt() endif call winrestview(l:curw) endfunction + +function! terraform#folds() + let thisline = getline(v:lnum) + if match(thisline, '^resource') >= 0 + return '>1' + elseif match(thisline, '^provider') >= 0 + return '>1' + elseif match(thisline, '^module') >= 0 + return '>1' + elseif match(thisline, '^variable') >= 0 + return '>1' + elseif match(thisline, '^output') >= 0 + return '>1' + elseif match(thisline, '^data') >= 0 + return '>1' + elseif match(thisline, '^terraform') >= 0 + return '>1' + elseif match(thisline, '^locals') >= 0 + return '>1' + else + return '=' + endif +endfunction + +function! terraform#foldText() + let foldsize = (v:foldend-v:foldstart) + return getline(v:foldstart).' ('.foldsize.' lines)' +endfunction + +function! terraform#align() + let p = '^.*=[^>]*$' + if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) + let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g')) + let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*')) + Tabularize/=/l1 + normal! 0 + call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) + endif +endfunction + +function! terraform#commands(A, L, P) + return [ + \ 'apply', + \ 'console', + \ 'destroy', + \ 'env', + \ 'fmt', + \ 'get', + \ 'graph', + \ 'import', + \ 'init', + \ 'output', + \ 'plan', + \ 'providers', + \ 'push', + \ 'refresh', + \ 'show', + \ 'taint', + \ 'untaint', + \ 'validate', + \ 'version', + \ 'workspace', + \ '0.12checklist', + \ 'debug', + \ 'force-unlock', + \ 'state' + \ ] +endfunction |