diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-09 22:57:13 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-10-09 22:57:13 +0200 |
commit | 0d48ba92455548018105670980552e54930f60eb (patch) | |
tree | ce1b41ae7a984eff3709073ae97809bce876f147 | |
parent | 1993b9f68fff3cb87413fdc2e328763c291578c4 (diff) | |
download | vim-polyglot-0d48ba92455548018105670980552e54930f60eb.tar.gz vim-polyglot-0d48ba92455548018105670980552e54930f60eb.zip |
Fix detecting of some filetypes, closes #579
-rw-r--r-- | after/syntax/cpp.vim | 11 | ||||
-rw-r--r-- | autoload/go/config.vim | 16 | ||||
-rw-r--r-- | doc/vim-go.txt | 42 | ||||
-rw-r--r-- | ftdetect/polyglot.vim | 20 | ||||
-rwxr-xr-x | scripts/build | 2 | ||||
-rwxr-xr-x | scripts/test | 2 | ||||
-rw-r--r-- | syntax/zig.vim | 2 | ||||
-rw-r--r-- | tests/extensions.vim | 3 |
8 files changed, 69 insertions, 29 deletions
diff --git a/after/syntax/cpp.vim b/after/syntax/cpp.vim index 730bb819..ec3f1fcf 100644 --- a/after/syntax/cpp.vim +++ b/after/syntax/cpp.vim @@ -6,13 +6,20 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cpp-modern') == " Original Author: Jon Haggblad <https://github.com/octol> " Maintainer: bfrg <https://github.com/bfrg> " Website: https://github.com/bfrg/vim-cpp-modern -" Last Change: Oct 4, 2020 +" Last Change: Oct 8, 2020 " " This syntax file is based on: " https://github.com/octol/vim-cpp-enhanced-highlight -" http://www.vim.org/scripts/script.php?script_id=4293 " ============================================================================== +" C++ attributes {{{1 +if get(g:, 'cpp_attributes_highlight', 0) + syntax region cppAttribute matchgroup=cppAttributeBrackets start='\[\[' end=']]' contains=cString + hi def link cppAttribute Macro + hi def link cppAttributeBrackets Identifier +endif + + " Standard library {{{1 syntax keyword cppSTLdefine \ MB_CUR_MAX MB_LEN_MAX WCHAR_MAX WCHAR_MIN WEOF __STDC_UTF_16__ __STDC_UTF_32__ diff --git a/autoload/go/config.vim b/autoload/go/config.vim index 355f90fb..b450ad16 100644 --- a/autoload/go/config.vim +++ b/autoload/go/config.vim @@ -266,15 +266,25 @@ function! go#config#SetTemplateAutocreate(value) abort endfunction function! go#config#MetalinterCommand() abort - return get(g:, "go_metalinter_command", "golangci-lint") + return get(g:, 'go_metalinter_command', 'golangci-lint') endfunction function! go#config#MetalinterAutosaveEnabled() abort - return get(g:, "go_metalinter_autosave_enabled", ["govet", "golint"]) + let l:default = [] + if get(g:, 'go_metalinter_command', 'golangci-lint') == 'golangci-lint' + let l:default = ['govet', 'golint'] + endif + + return get(g:, 'go_metalinter_autosave_enabled', l:default) endfunction function! go#config#MetalinterEnabled() abort - return get(g:, "go_metalinter_enabled", ["vet", "golint", "errcheck"]) + let l:default = [] + if get(g:, 'go_metalinter_command', 'golangci-lint') == 'golangci-lint' + let l:default = ['vet', 'golint', 'errcheck'] + endif + + return get(g:, 'go_metalinter_enabled', l:default) endfunction function! go#config#GolintBin() abort diff --git a/doc/vim-go.txt b/doc/vim-go.txt index 7d4ac52d..cc412836 100644 --- a/doc/vim-go.txt +++ b/doc/vim-go.txt @@ -1625,27 +1625,45 @@ window. The list to use can be set using |'g:go_list_type_commands'|. < *'g:go_metalinter_autosave_enabled'* -Specifies the enabled linters for auto |:GoMetaLinter| on save. By -default it's using `vet` and `golint`. If any are enabled, `--disable-all` -will be sent to the metalinter. +Specifies the enabled linters for auto |:GoMetaLinter| on save. When the +metalinter is `golangci-lint`, if any are enabled, `--disable-all` will be +sent to the metalinter. + +When `g:go_metalinter_command` is set to `staticcheck`, the default value is +an empty list; `staticcheck`'s `-checks` flag will not be used. +> + let g:go_metalinter_autosave_enabled = ['all'] +< + +When `g:go_metalinter_command is set to `golangci-lint'`, the default value is > let g:go_metalinter_autosave_enabled = ['vet', 'golint'] < *'g:go_metalinter_enabled'* -Specifies the linters to enable for the |:GoMetaLinter| command. By default -it's using `vet`, `golint` and `errcheck`. If any are enabled, `--disable-all` -will be sent to the metalinter. +Specifies the linters to enable for the |:GoMetaLinter| command. For +`golangci-lint`, if any are enabled, `--disable-all` will be passed to the +metalinter. + +When `g:go_metalinter_command` is set to `staticcheck`, the default value is +an empty list; `staticcheck`'s `-checks` flag will not be used. +> + let g:go_metalinter_autosave_enabled = ['all'] +< + +When `g:go_metalinter_command is set to `golangci-lint'`, the default value is > let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] < *'g:go_metalinter_command'* Overrides the command to be executed when |:GoMetaLinter| is called. By -default it's `golangci-lint`. Valid options are `golangci-lint` and `gopls`. +default it's `golangci-lint`. Valid options are `golangci-lint, `gopls`, and +`staticcheck`.. + When the value is `gopls`, users may want to consider setting -`g:go_gopls_staticcheck`. It can also be used as an advanced setting for -users who want to have more control over the metalinter. +`g:go_gopls_staticcheck`. It can also be used as an advanced setting for users +who want to have more control over the metalinter. > let g:go_metalinter_command = "golangci-lint" < @@ -1653,6 +1671,8 @@ users who want to have more control over the metalinter. Overrides the maximum time the linters have to complete. By default it's 5 seconds. + +Only applies when the metalinter is `golangci-lint`. > let g:go_metalinter_deadline = "5s" < @@ -2286,7 +2306,7 @@ The program will halt on the breakpoint, at which point you can inspect the program state. You can go to the next line with |:GoDebugNext| (<F10>) or step in with |:GoDebugStep| (<F11>). -The program can also be halted with `:GoDebugHalt` (<F6>). +The program can also be halted with `:GoDebugHalt` (<F8>). The variable window in the bottom left (`GODEBUG_VARIABLES`) will display all local variables. Struct values are displayed as `{...}`, array/slices as @@ -2362,7 +2382,7 @@ The rest of the commands and mappings become available after executing Halt the program. - Mapped to <F6> by default. + Mapped to <F8> by default. *:GoDebugStop* *(go-debug-stop)* diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 2f8cad97..3d08e2ab 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -629,7 +629,7 @@ endif if !has_key(s:disabled_packages, 'remind') au BufNewFile,BufRead *.rem,*.remind,{.,}reminders setf remind - au BufNewFile,BufRead {.,}reminders* call s:StarSetf('remind') + au BufNewFile,BufRead .reminders* call s:StarSetf('remind') endif if !has_key(s:disabled_packages, 'rrst') @@ -854,7 +854,7 @@ if !has_key(s:disabled_packages, 'neomuttrc') au BufNewFile,BufRead Neomuttrc setf neomuttrc au BufNewFile,BufRead neomuttrc* call s:StarSetf('neomuttrc') au BufNewFile,BufRead Neomuttrc* call s:StarSetf('neomuttrc') - au BufNewFile,BufRead {.,}neomuttrc* call s:StarSetf('neomuttrc') + au BufNewFile,BufRead .neomuttrc* call s:StarSetf('neomuttrc') au BufNewFile,BufRead */.neomutt/neomuttrc* call s:StarSetf('neomuttrc') endif @@ -882,7 +882,7 @@ if !has_key(s:disabled_packages, 'muttrc') au BufNewFile,BufRead Mutt{ng,}rc setf muttrc au BufNewFile,BufRead mutt{ng,}rc* call s:StarSetf('muttrc') au BufNewFile,BufRead Mutt{ng,}rc* call s:StarSetf('muttrc') - au BufNewFile,BufRead {.,}mutt{ng,}rc* call s:StarSetf('muttrc') + au BufNewFile,BufRead .mutt{ng,}rc* call s:StarSetf('muttrc') au BufNewFile,BufRead */etc/Muttrc.d/* call s:StarSetf('muttrc') au BufNewFile,BufRead */.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc') endif @@ -1273,7 +1273,7 @@ endif if !has_key(s:disabled_packages, 'gtkrc') au BufNewFile,BufRead {.,}gtkrc,gtkrc setf gtkrc au BufNewFile,BufRead gtkrc* call s:StarSetf('gtkrc') - au BufNewFile,BufRead {.,}gtkrc* call s:StarSetf('gtkrc') + au BufNewFile,BufRead .gtkrc* call s:StarSetf('gtkrc') endif if !has_key(s:disabled_packages, 'group') @@ -1820,7 +1820,7 @@ if !has_key(s:disabled_packages, 'toml') endif if !has_key(s:disabled_packages, 'tmux') - au BufNewFile,BufRead {.,}tmux*.conf setf tmux + au BufNewFile,BufRead .tmux*.conf setf tmux endif if !has_key(s:disabled_packages, 'thrift') @@ -1883,9 +1883,9 @@ endif if !has_key(s:disabled_packages, 'sh') au BufNewFile,BufRead *.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh,*.sh.in,*.tmux,*.tool,*/etc/udev/cdsymlinks.conf,{.,}bash_aliases,{.,}bash_history,{.,}bash_logout,{.,}bash_profile,{.,}bashrc,{.,}cshrc,{.,}env,{.,}env.example,{.,}flaskenv,{.,}login,{.,}profile,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,login,man,profile,zlogin,zlogout,zprofile,zshenv,zshrc setf sh au BufNewFile,BufRead *.zsh,{.,}zfbfmarks,{.,}zlogin,{.,}zlogout,{.,}zprofile,{.,}zshenv,{.,}zshrc setf zsh - au BufNewFile,BufRead {.,}zsh* call s:StarSetf('zsh') - au BufNewFile,BufRead {.,}zlog* call s:StarSetf('zsh') - au BufNewFile,BufRead {.,}zcompdump* call s:StarSetf('zsh') + au BufNewFile,BufRead .zsh* call s:StarSetf('zsh') + au BufNewFile,BufRead .zlog* call s:StarSetf('zsh') + au BufNewFile,BufRead .zcompdump* call s:StarSetf('zsh') endif if !has_key(s:disabled_packages, 'scss') @@ -2166,7 +2166,7 @@ endif if !has_key(s:disabled_packages, 'jq') au BufNewFile,BufRead *.jq,{.,}jqrc setf jq - au BufNewFile,BufRead {.,}jqrc* call s:StarSetf('jq') + au BufNewFile,BufRead .jqrc* call s:StarSetf('jq') endif if !has_key(s:disabled_packages, 'htmldjango') @@ -2271,7 +2271,7 @@ if !has_key(s:disabled_packages, 'git') au BufNewFile,BufRead *.gitconfig,*.git/config,*.git/modules/*/config,*/.config/git/config,*/git/config,{.,}gitconfig,{.,}gitmodules setf gitconfig au BufNewFile,BufRead */{.,}gitconfig.d/* call s:StarSetf('gitconfig') au BufNewFile,BufRead git-rebase-todo setf gitrebase - au BufNewFile,BufRead {.,}gitsendemail.* call s:StarSetf('gitsendemail') + au BufNewFile,BufRead .gitsendemail.* call s:StarSetf('gitsendemail') au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG setf gitcommit endif diff --git a/scripts/build b/scripts/build index 573a8891..6ba4e43a 100755 --- a/scripts/build +++ b/scripts/build @@ -579,7 +579,7 @@ def generate_ftdetect(packages, heuristics) end for filename in filenames.sort - if filename[0] == "." + if filename.match?(/^\.[^\*\/]+$/) filename = "{.,}" + filename[1..-1] end if filename[-1] == "*" diff --git a/scripts/test b/scripts/test index f22c224c..b87d511c 100755 --- a/scripts/test +++ b/scripts/test @@ -46,7 +46,7 @@ test_helptags = <<~EOF EOF run_vimscript('source tests/filetypes.vim') -# run_vimscript('source tests/extensions.vim') +run_vimscript('source tests/extensions.vim') run_script(test_helptags) # run_vimscript(" diff --git a/syntax/zig.vim b/syntax/zig.vim index f6819ef5..95d52381 100644 --- a/syntax/zig.vim +++ b/syntax/zig.vim @@ -11,7 +11,7 @@ endif let b:current_syntax = "zig" syn keyword zigStorage const var extern packed export pub noalias inline noinline comptime callconv volatile allowzero align linksection threadlocal anytype -syn keyword zigStructure struct enum union error +syn keyword zigStructure struct enum union error opaque syn keyword zigStatement break return continue asm defer errdefer unreachable try catch async nosuspend await suspend resume syn keyword zigConditional if else switch and or orelse syn keyword zigRepeat while for diff --git a/tests/extensions.vim b/tests/extensions.vim index f6606532..77ff620b 100644 --- a/tests/extensions.vim +++ b/tests/extensions.vim @@ -385,3 +385,6 @@ call TestExtension("xml", "fglrxrc", "") call TestExtension("conf", "foo.conf", "") call TestExtension("conf", "config", "") call TestExtension("conf", "auto.master", "") + +" https://github.com/sheerun/vim-polyglot/issues/579 +call TestExtension("dart", "reminders.dart", "") |