diff options
Diffstat (limited to 'autoload')
| -rw-r--r-- | autoload/LaTeXtoUnicode.vim | 49 | ||||
| -rw-r--r-- | autoload/cargo.vim | 28 | ||||
| -rw-r--r-- | autoload/cargo/quickfix.vim | 2 | ||||
| -rw-r--r-- | autoload/elm.vim | 11 | ||||
| -rw-r--r-- | autoload/go/config.vim | 28 | ||||
| -rw-r--r-- | autoload/julia_latex_symbols.vim | 2 | ||||
| -rw-r--r-- | autoload/rust.vim | 39 | ||||
| -rw-r--r-- | autoload/rust/debugging.vim | 6 | ||||
| -rw-r--r-- | autoload/rustfmt.vim | 26 | ||||
| -rw-r--r-- | autoload/vifm/globals.vim | 6 | 
10 files changed, 153 insertions, 44 deletions
| diff --git a/autoload/LaTeXtoUnicode.vim b/autoload/LaTeXtoUnicode.vim index 581dec1e..75fa4f82 100644 --- a/autoload/LaTeXtoUnicode.vim +++ b/autoload/LaTeXtoUnicode.vim @@ -21,6 +21,9 @@ function! s:L2U_Setup()    if !has_key(b:, "l2u_cmdtab_set")      let b:l2u_cmdtab_set = 0    endif +  if !has_key(b:, "l2u_keymap_set") +    let b:l2u_keymap_set = 0 +  endif    " Did we activate the L2U as-you-type substitutions?    if !has_key(b:, "l2u_autosub_set") @@ -76,11 +79,7 @@ function! s:L2U_SetupGlobal()    " A hack to forcibly get out of completion mode: feed    " this string with feedkeys()    if has("win32") || has("win64") -    if has("gui_running") -      let s:l2u_esc_sequence = "\u0006" -    else -      let s:l2u_esc_sequence = "\u0006\b" -    endif +    let s:l2u_esc_sequence = "\u0006"    else      let s:l2u_esc_sequence = "\u0091\b"    end @@ -409,8 +408,8 @@ function! LaTeXtoUnicode#FallbackCallback()    return  endfunction -" This is the function which is mapped to <S-Tab> in command-line mode -function! LaTeXtoUnicode#CmdTab() +" This is the function that performs the substitution in command-line mode +function! LaTeXtoUnicode#CmdTab(triggeredbytab)    " first stage    " analyse command line    let col1 = getcmdpos() - 1 @@ -419,6 +418,9 @@ function! LaTeXtoUnicode#CmdTab()    let b:l2u_singlebslash = (match(l[0:col1-1], '\\$') >= 0)    " completion not found    if col0 == -1 +    if a:triggeredbytab +      call feedkeys("\<Tab>", 'nt') " fall-back to the default <Tab> +    endif      return l    endif    let base = l[col0 : col1-1] @@ -434,6 +436,9 @@ function! LaTeXtoUnicode#CmdTab()      endif    endfor    if len(partmatches) == 0 +    if a:triggeredbytab +      call feedkeys("\<Tab>", 'nt') " fall-back to the default <Tab> +    endif      return l    endif    " exact matches are replaced with Unicode @@ -463,8 +468,13 @@ endfunction  " Setup the L2U tab mapping  function! s:L2U_SetTab(wait_insert_enter)    if !b:l2u_cmdtab_set && get(g:, "latex_to_unicode_tab", 1) && b:l2u_enabled -    cmap <buffer> <S-Tab> <Plug>L2UCmdTab -    cnoremap <buffer> <Plug>L2UCmdTab <C-\>eLaTeXtoUnicode#CmdTab()<CR> +    let b:l2u_cmdtab_keys = get(g:, "latex_to_unicode_cmd_mapping", ['<Tab>','<S-Tab>']) +    if type(b:l2u_cmdtab_keys) != type([]) " avoid using v:t_list for backward compatibility +      let b:l2u_cmdtab_keys = [b:l2u_cmdtab_keys] +    endif +    for k in b:l2u_cmdtab_keys +      exec 'cnoremap <buffer> '.k.' <C-\>eLaTeXtoUnicode#CmdTab('.(k ==? '<Tab>').')<CR>' +    endfor      let b:l2u_cmdtab_set = 1    endif    if b:l2u_tab_set @@ -500,7 +510,9 @@ endfunction  " Revert the LaTeX-to-Unicode tab mapping settings  function! s:L2U_UnsetTab()    if b:l2u_cmdtab_set -    cunmap <buffer> <S-Tab> +    for k in b:l2u_cmdtab_keys +      exec 'cunmap <buffer> '.k +    endfor      let b:l2u_cmdtab_set = 0    endif    if !b:l2u_tab_set @@ -593,6 +605,21 @@ function! s:L2U_UnsetAutoSub()    let b:l2u_autosub_set = 0  endfunction +function! s:L2U_SetKeymap() +  if !b:l2u_keymap_set && get(g:, "latex_to_unicode_keymap", 0) && b:l2u_enabled +    setlocal keymap=latex2unicode +    let b:l2u_keymap_set = 1 +  endif +endfunction + +function! s:L2U_UnsetKeymap() +  if !b:l2u_keymap_set +    return +  endif +  setlocal keymap= +  let b:l2u_keymap_set = 0 +endfunction +  " Initialization. Can be used to re-init when global settings have changed.  function! LaTeXtoUnicode#Init(...)    let wait_insert_enter = a:0 > 0 ? a:1 : 1 @@ -605,9 +632,11 @@ function! LaTeXtoUnicode#Init(...)    call s:L2U_UnsetTab()    call s:L2U_UnsetAutoSub() +  call s:L2U_UnsetKeymap()    call s:L2U_SetTab(wait_insert_enter)    call s:L2U_SetAutoSub(wait_insert_enter) +  call s:L2U_SetKeymap()  endfunction  function! LaTeXtoUnicode#Toggle() diff --git a/autoload/cargo.vim b/autoload/cargo.vim index d1547fc9..18b6a158 100644 --- a/autoload/cargo.vim +++ b/autoload/cargo.vim @@ -86,6 +86,34 @@ function! cargo#bench(args)      call cargo#cmd("bench " . a:args)  endfunction +function! cargo#runtarget(args) +    let l:filename = expand('%:p') +    let l:read_manifest = system('cargo read-manifest') +    let l:metadata = json_decode(l:read_manifest) +    let l:targets = get(l:metadata, 'targets', []) +    let l:did_run = 0 +    for l:target in l:targets +        let l:src_path = get(l:target, 'src_path', '') +        let l:kinds = get(l:target, 'kind', []) +        let l:name = get(l:target, 'name', '') +        if l:src_path == l:filename +        if index(l:kinds, 'example') != -1 +            let l:did_run = 1 +            call cargo#run("--example " . shellescape(l:name) . " " . a:args) +            return +        elseif index(l:kinds, 'bin') != -1 +            let l:did_run = 1 +            call cargo#run("--bin " . shellescape(l:name) . " " . a:args) +            return +        endif +        endif +    endfor +    if l:did_run != 1 +        call cargo#run(a:args) +        return +    endif +endfunction +  " vim: set et sw=4 sts=4 ts=8:  endif diff --git a/autoload/cargo/quickfix.vim b/autoload/cargo/quickfix.vim index 13c3b465..9eb204fc 100644 --- a/autoload/cargo/quickfix.vim +++ b/autoload/cargo/quickfix.vim @@ -14,7 +14,7 @@ function! cargo#quickfix#CmdPre() abort  endfunction  function! cargo#quickfix#CmdPost() abort -    if b:rust_compiler_cargo_qf_prev_cd_saved +    if exists("b:rust_compiler_cargo_qf_prev_cd_saved") && b:rust_compiler_cargo_qf_prev_cd_saved          " Restore the current directory.          if b:rust_compiler_cargo_qf_has_lcd              execute 'lchdir! '.b:rust_compiler_cargo_qf_prev_cd diff --git a/autoload/elm.vim b/autoload/elm.vim index 85a1a0b2..00b15947 100644 --- a/autoload/elm.vim +++ b/autoload/elm.vim @@ -349,11 +349,14 @@ function! elm#FindRootDirectory() abort  	if empty(l:elm_root)  		let l:current_file = expand('%:p')  		let l:dir_current_file = fnameescape(fnamemodify(l:current_file, ':h')) -		let l:match = findfile('elm-package.json', l:dir_current_file . ';') -		if empty(l:match) -			let l:elm_root = '' +		let l:old_match = findfile('elm-package.json', l:dir_current_file . ';') +		let l:new_match = findfile('elm.json', l:dir_current_file . ';') +		if !empty(l:new_match) +			let l:elm_root = fnamemodify(l:new_match, ':p:h') +		elseif !empty(l:old_match) +			let l:elm_root = fnamemodify(l:old_match, ':p:h')  		else -			let l:elm_root = fnamemodify(l:match, ':p:h') +			let l:elm_root = ''  		endif  		if !empty(l:elm_root) diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 9ed523a9..97cb3630 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -1,5 +1,9 @@  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1 +" don't spam the user when Vim is started in Vi compatibility mode +let s:cpo_save = &cpo +set cpo&vim +  function! go#config#AutodetectGopath() abort  	return get(g:, 'go_autodetect_gopath', 0)  endfunction @@ -137,6 +141,10 @@ function! go#config#SetGuruScope(scope) abort    endif  endfunction +function! go#config#GocodeUnimportedPackages() abort +  return get(g:, 'go_gocode_unimported_packages', 0) +endfunction +  let s:sock_type = (has('win32') || has('win64')) ? 'tcp' : 'unix'  function! go#config#GocodeSocketType() abort    return get(g:, 'go_gocode_socket_type', s:sock_type) @@ -147,7 +155,7 @@ function! go#config#GocodeProposeBuiltins() abort  endfunction  function! go#config#GocodeProposeSource() abort -  return get(g:, 'go_gocode_propose_source', 1) +  return get(g:, 'go_gocode_propose_source', 0)  endfunction  function! go#config#EchoCommandInfo() abort @@ -200,7 +208,7 @@ endfunction  function! go#config#DebugCommands() abort    " make sure g:go_debug_commands is set so that it can be added to easily. -  let g:go_debug_commands = get(g:, 'go_debug_commands', {}) +  let g:go_debug_commands = get(g:, 'go_debug_commands', [])    return g:go_debug_commands  endfunction @@ -308,10 +316,6 @@ function! go#config#DeclsMode() abort    return get(g:, "go_decls_mode", "")  endfunction -function! go#config#DocCommand() abort -  return get(g:, "go_doc_command", ["godoc"]) -endfunction -  function! go#config#FmtCommand() abort    return get(g:, "go_fmt_command", "gofmt")  endfunction @@ -354,6 +358,10 @@ function! go#config#BinPath() abort    return get(g:, "go_bin_path", "")  endfunction +function! go#config#SearchBinPathFirst() abort +  return get(g:, 'go_search_bin_path_first', 1) +endfunction +  function! go#config#HighlightArrayWhitespaceError() abort    return get(g:, 'go_highlight_array_whitespace_error', 0)  endfunction @@ -422,6 +430,10 @@ function! go#config#HighlightVariableDeclarations() abort    return get(g:, 'go_highlight_variable_declarations', 0)  endfunction +function! go#config#HighlightDebug() abort +  return get(g:, 'go_highlight_debug', 1) +endfunction +  function! go#config#FoldEnable(...) abort    if a:0 > 0      return index(go#config#FoldEnable(), a:1) > -1 @@ -435,6 +447,10 @@ if exists("g:go_gorename_prefill") && g:go_gorename_prefill == 1    unlet g:go_gorename_prefill  endif +" restore Vi compatibility settings +let &cpo = s:cpo_save +unlet s:cpo_save +  " vim: sw=2 ts=2 et  endif diff --git a/autoload/julia_latex_symbols.vim b/autoload/julia_latex_symbols.vim index 5dc87df2..69f857e6 100644 --- a/autoload/julia_latex_symbols.vim +++ b/autoload/julia_latex_symbols.vim @@ -1,7 +1,7 @@  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1  " This file is autogenerated from the script 'generate_latex_symbols_table.jl' -" The symbols are based on Julia version 0.7.0-rc2.0 +" The symbols are based on Julia version 1.1.0-DEV.695  scriptencoding utf-8 diff --git a/autoload/rust.vim b/autoload/rust.vim index 77c38b7c..81f8c635 100644 --- a/autoload/rust.vim +++ b/autoload/rust.vim @@ -445,12 +445,12 @@ function! s:SearchTestFunctionNameUnderCursor() abort      let cursor_line = line('.')      " Find #[test] attribute -    if search('#\[test]', 'bcW') is 0 +    if search('\m\C#\[test\]', 'bcW') is 0          return ''      endif      " Move to an opening brace of the test function -    let test_func_line = search('^\s*fn\s\+\h\w*\s*(.\+{$', 'eW') +    let test_func_line = search('\m\C^\s*fn\s\+\h\w*\s*(.\+{$', 'eW')      if test_func_line is 0          return ''      endif @@ -462,19 +462,36 @@ function! s:SearchTestFunctionNameUnderCursor() abort          return ''      endif -    return matchstr(getline(test_func_line), '^\s*fn\s\+\zs\h\w*') +    return matchstr(getline(test_func_line), '\m\C^\s*fn\s\+\zs\h\w*')  endfunction  function! rust#Test(all, options) abort -    let pwd = expand('%:p:h') -    if findfile('Cargo.toml', pwd . ';') ==# '' +    let manifest = findfile('Cargo.toml', expand('%:p:h') . ';') +    if manifest ==# ''          return rust#Run(1, '--test ' . a:options)      endif -    let pwd = shellescape(pwd) +    if exists(':terminal') +        let cmd = 'terminal ' +    else +        let cmd = '!' +        let manifest = shellescape(manifest) +    endif      if a:all -        execute '!cd ' . pwd . ' && cargo test ' . a:options +        if a:options ==# '' +            execute cmd . 'cargo test --manifest-path' manifest +        else +            execute cmd . 'cargo test --manifest-path' manifest a:options +        endif +        return +    endif + +    let mod_name = expand('%:t:r') +    if mod_name ==# '' +        echohl ErrorMsg +        echo 'Cannot extract a module name from file name. Please add ! to command if you want to run all tests' +        echohl None          return      endif @@ -487,7 +504,13 @@ function! rust#Test(all, options) abort              echohl None              return          endif -        execute '!cd ' . pwd . ' && cargo test ' . func_name . ' ' . a:options +        let spec = mod_name . '::' . func_name +        if a:options ==# '' +            execute cmd . 'cargo test --manifest-path' manifest spec +        else +            execute cmd . 'cargo test --manifest-path' manifest spec a:options +        endif +        return      finally          call setpos('.', saved)      endtry diff --git a/autoload/rust/debugging.vim b/autoload/rust/debugging.vim index ff88e00c..ba91c3bd 100644 --- a/autoload/rust/debugging.vim +++ b/autoload/rust/debugging.vim @@ -73,6 +73,12 @@ function! rust#debugging#Info() abort      echo l:output      version + +    if exists(":SyntasticInfo") +        echo "----" +        echo "Info from Syntastic:" +        execute "SyntasticInfo" +    endif  endfunction  function! rust#debugging#InfoToClipboard() abort diff --git a/autoload/rustfmt.vim b/autoload/rustfmt.vim index 916736c0..7b8fdd91 100644 --- a/autoload/rustfmt.vim +++ b/autoload/rustfmt.vim @@ -24,18 +24,17 @@ endif  function! rustfmt#DetectVersion()      " Save rustfmt '--help' for feature inspection      silent let s:rustfmt_help = system(g:rustfmt_command . " --help") -    let s:rustfmt_unstable_features = 1 - (s:rustfmt_help !~# "--unstable-features") +    let s:rustfmt_unstable_features = s:rustfmt_help =~# "--unstable-features"      " Build a comparable rustfmt version varible out of its `--version` output: -    silent let s:rustfmt_version = system(g:rustfmt_command . " --version") -    let s:rustfmt_version = matchlist(s:rustfmt_version, '\vrustfmt ([0-9]+[.][0-9]+[.][0-9]+)') - -    if len(s:rustfmt_version) < 3  +    silent let l:rustfmt_version_full = system(g:rustfmt_command . " --version") +    let l:rustfmt_version_list = matchlist(l:rustfmt_version_full, +        \    '\vrustfmt ([0-9]+[.][0-9]+[.][0-9]+)') +    if len(l:rustfmt_version_list) < 3          let s:rustfmt_version = "0"      else -        let s:rustfmt_version = s:rustfmt_version[1] +        let s:rustfmt_version = l:rustfmt_version_list[1]      endif -      return s:rustfmt_version  endfunction @@ -46,7 +45,7 @@ if !exists("g:rustfmt_emit_files")  endif  if !exists("g:rustfmt_file_lines") -    let g:rustfmt_file_lines = 1 - (s:rustfmt_help !~# "--file-lines JSON") +    let g:rustfmt_file_lines = s:rustfmt_help =~# "--file-lines JSON"  endif  let s:got_fmt_error = 0 @@ -87,11 +86,9 @@ function! s:RustfmtCommandRange(filename, line1, line2)      let l:write_mode = s:RustfmtWriteMode()      let l:rustfmt_config = s:RustfmtConfig() -    " FIXME: When --file-lines gets to be stable, enhance this version range checking +    " FIXME: When --file-lines gets to be stable, add version range checking      " accordingly. -    let l:unstable_features =  -                \ (s:rustfmt_unstable_features && (s:rustfmt_version < '1.')) -                \ ? '--unstable-features' : '' +    let l:unstable_features = s:rustfmt_unstable_features ? '--unstable-features' : ''      let l:cmd = printf("%s %s %s %s %s --file-lines '[%s]' %s", g:rustfmt_command,                  \ l:write_mode, g:rustfmt_options, @@ -119,6 +116,8 @@ function! s:RunRustfmt(command, tmpname, fail_silently)      mkview!      let l:stderr_tmpname = tempname() +    call writefile([], l:stderr_tmpname) +      let l:command = a:command . ' 2> ' . l:stderr_tmpname      if a:tmpname ==# '' @@ -133,7 +132,8 @@ function! s:RunRustfmt(command, tmpname, fail_silently)          if exists("*systemlist")              silent let out = systemlist(l:command, l:buffer)          else -            silent let out = split(system(l:command, l:buffer), '\r\?\n') +            silent let out = split(system(l:command, +                        \ join(l:buffer, "\n")), '\r\?\n')          endif      else          if exists("*systemlist") diff --git a/autoload/vifm/globals.vim b/autoload/vifm/globals.vim index f6f62022..4c4c9924 100644 --- a/autoload/vifm/globals.vim +++ b/autoload/vifm/globals.vim @@ -2,7 +2,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vifm') == -1  " common functions for vifm plugin related to globals  " Maintainer:  xaizek <xaizek@posteo.net> -" Last Change: January 02, 2018 +" Last Change: November 03, 2018  " Initializes global variables to defaults unless they are already set  function! vifm#globals#Init() @@ -26,6 +26,10 @@ function! vifm#globals#Init()              let g:vifm_term = 'xterm -e'          endif      endif + +    if !exists('g:vifm_embed_term') +        let g:vifm_embed_term = has('gui_running') +    endif  endfunction  endif | 
