diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-04-14 13:17:26 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-04-14 13:17:26 +0200 |
commit | 14dc82fc4e6c0c08078f97a24a6c1639c1cc5113 (patch) | |
tree | dea8d2398a9377a0eee7786776e3cd420ce1ee89 /ftplugin | |
parent | e86e0ad36ef9501acbc3e8c63a1d4fab104e47cb (diff) | |
download | vim-polyglot-14dc82fc4e6c0c08078f97a24a6c1639c1cc5113.tar.gz vim-polyglot-14dc82fc4e6c0c08078f97a24a6c1639c1cc5113.zip |
Update
Diffstat (limited to 'ftplugin')
-rw-r--r-- | ftplugin/crystal.vim | 10 | ||||
-rw-r--r-- | ftplugin/ecrystal.vim | 100 | ||||
-rw-r--r-- | ftplugin/fish.vim | 1 | ||||
-rw-r--r-- | ftplugin/graphql.vim | 2 | ||||
-rw-r--r-- | ftplugin/ps1.vim | 24 | ||||
-rw-r--r-- | ftplugin/racket.vim | 2 | ||||
-rw-r--r-- | ftplugin/razor.vim | 20 | ||||
-rw-r--r-- | ftplugin/rust.vim | 2 | ||||
-rw-r--r-- | ftplugin/svelte.vim | 47 | ||||
-rw-r--r-- | ftplugin/typescriptreact.vim | 4 | ||||
-rw-r--r-- | ftplugin/vala.vim | 2 |
11 files changed, 187 insertions, 27 deletions
diff --git a/ftplugin/crystal.vim b/ftplugin/crystal.vim index c23d93f6..441e069f 100644 --- a/ftplugin/crystal.vim +++ b/ftplugin/crystal.vim @@ -5,6 +5,11 @@ if exists('b:did_ftplugin') endif let b:did_ftplugin = 1 +" This file is loaded on 'ecrystal' filetype +if &filetype !=# 'crystal' + finish +endif + let s:save_cpo = &cpo set cpo&vim @@ -76,6 +81,11 @@ if &l:ofu ==# '' setlocal omnifunc=crystal_lang#complete endif +if exists('AutoPairsLoaded') + let b:AutoPairs = { '{%': '%}' } + call extend(b:AutoPairs, g:AutoPairs, 'force') +endif + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/ftplugin/ecrystal.vim b/ftplugin/ecrystal.vim new file mode 100644 index 00000000..b8687853 --- /dev/null +++ b/ftplugin/ecrystal.vim @@ -0,0 +1,100 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'crystal') == -1 + +if exists('b:did_ftplugin') + finish +endif + +" Define some defaults in case the included ftplugins don't set them. +let s:comments = '' +let s:shiftwidth = '' +let s:undo_ftplugin = '' +let s:browsefilter = 'All Files (*.*)\t*.*\n' +let s:match_words = '' + +call ecrystal#SetSubtype() + +if b:ecrystal_subtype !=# '' + exe 'runtime! ftplugin/'.b:ecrystal_subtype.'.vim ftplugin/'.b:ecrystal_subtype.'_*.vim ftplugin/'.b:ecrystal_subtype.'/*.vim' + unlet! b:did_ftplugin + + " Keep the comments for this filetype + let s:comments = escape(&comments, ' \') + + " Keep the shiftwidth for this filetype + let s:shiftwidth = &shiftwidth + + " Override our defaults if these were set by an included ftplugin. + if exists('b:undo_ftplugin') + let s:undo_ftplugin = b:undo_ftplugin + unlet b:undo_ftplugin + endif + if exists('b:browsefilter') + let s:browsefilter = b:browsefilter + unlet b:browsefilter + endif + if exists('b:match_words') + let s:match_words = b:match_words + unlet b:match_words + endif +endif + +runtime! ftplugin/crystal.vim ftplugin/crystal_*.vim ftplugin/crystal/*.vim +let b:did_ftplugin = 1 + +" Combine the new set of values with those previously included. +if exists('b:undo_ftplugin') + let s:undo_ftplugin = b:undo_ftplugin . ' | ' . s:undo_ftplugin +endif +if exists ('b:browsefilter') + let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter +endif +if exists('b:match_words') + let s:match_words = b:match_words . ',' . s:match_words +endif + +" Change the browse dialog on Win32 to show mainly eCrystal-related files +if has('gui_win32') + let b:browsefilter='eCrystal Files (*.ecr)\t*.ecr\n' . s:browsefilter +endif + +" Load the combined list of match_words for matchit.vim +if exists('loaded_matchit') + let b:match_words = s:match_words +endif + +" Define additional pairs for jiangmiao/auto-pairs +if exists('AutoPairsLoaded') + let b:AutoPairs = { + \ '<%': '%>', + \ '<%=': '%>', + \ '<%#': '%>', + \ '<%-': '-%>', + \ '<%-=': '-%>', + \ '<%-#': '-%>', + \ } + + call extend(b:AutoPairs, g:AutoPairs, 'force') +endif + +" Load the subtype's vim-endwise settings +if exists('loaded_endwise') && b:ecrystal_subtype !=# '' + exec 'doautocmd endwise FileType ' . b:ecrystal_subtype +endif + +" Start RagTag +if exists('loaded_ragtag') + call RagtagInit() +endif + +exec 'setlocal comments='.s:comments +exec 'setlocal shiftwidth='.s:shiftwidth +setlocal commentstring=<%#%s%> + +setlocal suffixesadd=.ecr + +let b:undo_ftplugin = 'setlocal comments< commentstring< shiftwidth<' . + \ '| unlet! b:browsefilter b:match_words ' . + \ '| unlet! b:AutoPairs ' . + \ '| ' . s:undo_ftplugin + +endif diff --git a/ftplugin/fish.vim b/ftplugin/fish.vim index 7ba9c927..393b84e4 100644 --- a/ftplugin/fish.vim +++ b/ftplugin/fish.vim @@ -7,7 +7,6 @@ setlocal foldexpr=fish#Fold() setlocal formatoptions+=ron1 setlocal formatoptions-=t setlocal include=\\v^\\s*\\.> -setlocal iskeyword=@,48-57,-,_,.,/ setlocal suffixesadd^=.fish " Use the 'j' format option when available. diff --git a/ftplugin/graphql.vim b/ftplugin/graphql.vim index df6004fb..524be44c 100644 --- a/ftplugin/graphql.vim +++ b/ftplugin/graphql.vim @@ -1,6 +1,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 -" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org> +" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org> " " Permission is hereby granted, free of charge, to any person obtaining a copy " of this software and associated documentation files (the "Software"), to diff --git a/ftplugin/ps1.vim b/ftplugin/ps1.vim index 4baa4665..f14a31eb 100644 --- a/ftplugin/ps1.vim +++ b/ftplugin/ps1.vim @@ -30,8 +30,30 @@ if has("gui_win32") \ "All Files (*.*)\t*.*\n" endif +" Look up keywords by Get-Help: +" check for PowerShell Core in Windows, Linux or MacOS +if executable('pwsh') | let s:pwsh_cmd = 'pwsh' + " on Windows Subsystem for Linux, check for PowerShell Core in Windows +elseif exists('$WSLENV') && executable('pwsh.exe') | let s:pwsh_cmd = 'pwsh.exe' + " check for PowerShell <= 5.1 in Windows +elseif executable('powershell.exe') | let s:pwsh_cmd = 'powershell.exe' +endif + +if exists('s:pwsh_cmd') + if !has('gui_running') && executable('less') && + \ !(exists('$ConEmuBuild') && &term =~? '^xterm') + " For exclusion of ConEmu, see https://github.com/Maximus5/ConEmu/issues/2048 + command! -buffer -nargs=1 GetHelp silent exe '!' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>" | ' . (has('unix') ? 'LESS= less' : 'less') | redraw! + elseif has('terminal') + command! -buffer -nargs=1 GetHelp silent exe 'term ' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>"' . (executable('less') ? ' | less' : '') + else + command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full <args>') + endif +endif +setlocal keywordprg=:GetHelp + " Undo the stuff we changed -let b:undo_ftplugin = "setlocal tw< cms< fo<" . +let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword< keywordprg<" . \ " | unlet! b:browsefilter" diff --git a/ftplugin/racket.vim b/ftplugin/racket.vim index ccdcdef4..89990061 100644 --- a/ftplugin/racket.vim +++ b/ftplugin/racket.vim @@ -55,8 +55,6 @@ endfunction vnoremap <buffer> K :call <SID>Racket_visual_doc()<cr> -nnoremap <buffer> <f9> :!racket -t %<cr> - "setl commentstring=;;%s setl commentstring=#\|\ %s\ \|# diff --git a/ftplugin/razor.vim b/ftplugin/razor.vim index 76348dd0..2d516bfc 100644 --- a/ftplugin/razor.vim +++ b/ftplugin/razor.vim @@ -1,30 +1,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'razor') == -1 -" Vim filetype plugin -" Language: LessCSS -" Author: Tim Pope <vimNOSPAM@tpope.org> -" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de> -" Last Change: 2011 Sep 30 - -" Only do this when not done yet for this buffer -:UltiSnipsAddFiletypes razor.html - if exists("b:did_ftplugin") finish endif let b:did_ftplugin = 1 -"let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<" - -"setlocal iskeyword+=- -"setlocal commentstring=//\ %s -"setlocal define=^\\s*\\%(@mixin\\\|=\\) -"setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','') -"setlocal omnifunc=csscomplete#CompleteCSS -"setlocal suffixesadd=.less - -"let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\=' - " vim:set sw=2: endif diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index dab5d5ab..211f86b0 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -123,7 +123,7 @@ command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", <q-args>) command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>) " See |:RustFmt| for docs -command! -buffer RustFmt call rustfmt#Format() +command! -bar -buffer RustFmt call rustfmt#Format() " See |:RustFmtRange| for docs command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>) diff --git a/ftplugin/svelte.vim b/ftplugin/svelte.vim new file mode 100644 index 00000000..3c3df23a --- /dev/null +++ b/ftplugin/svelte.vim @@ -0,0 +1,47 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'svelte') == -1 + +" Vim filetype plugin +" Language: Svelte 3 (HTML/JavaScript) +" Author: Evan Lecklider <evan@lecklider.com> +" Maintainer: Evan Lecklide <evan@lecklider.com> +" URL: https://github.com/evanleck/vim-svelte +if (exists('b:did_ftplugin')) + finish +endif +let b:did_ftplugin = 1 + +" Matchit support +if exists('loaded_matchit') && !exists('b:match_words') + let b:match_ignorecase = 0 + + " In order: + " + " 1. Svelte control flow keywords. + " 2. Parens. + " 3-5. HTML tags pulled from Vim itself. + " + " https://github.com/vim/vim/blob/5259275347667a90fb88d8ea74331f88ad68edfc/runtime/ftplugin/html.vim#L29-L35 + let b:match_words = + \ '#\%(if\|await\|each\)\>:\:\%(else\|catch\|then\)\>:\/\%(if\|await\|each\)\>,' . + \ '{:},' . + \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' . + \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' . + \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' +endif + +" ALE fixing and linting. +if exists('g:loaded_ale') + if !exists('b:ale_fixers') + let b:ale_fixers = ['eslint', 'prettier', 'prettier_standard'] + endif + + if !exists('b:ale_linter_aliases') + let b:ale_linter_aliases = ['css', 'javascript'] + endif + + if !exists('b:ale_linters') + let b:ale_linters = ['stylelint', 'eslint'] + endif +endif + +endif diff --git a/ftplugin/typescriptreact.vim b/ftplugin/typescriptreact.vim index 8a6bb9b5..6b8380f7 100644 --- a/ftplugin/typescriptreact.vim +++ b/ftplugin/typescriptreact.vim @@ -10,6 +10,10 @@ if exists("loaded_matchit") && !exists('b:tsx_match_words') \ : b:tsx_match_words endif +" Comment formatting +setlocal comments=s1:/*,mb:*,ex:*/,:// +setlocal formatoptions-=t formatoptions+=croql + set suffixesadd+=.tsx endif diff --git a/ftplugin/vala.vim b/ftplugin/vala.vim index ef433a26..00eefd1d 100644 --- a/ftplugin/vala.vim +++ b/ftplugin/vala.vim @@ -37,7 +37,7 @@ endfunction command! -buffer -bar CCode call CCode() command! -buffer -bar ValaCodingStyle call ValaCodingStyle() -if get(g:, 'vala_syntax_folding_enabled', 1) +if get(g:, 'vala_syntax_folding_enabled', 0) setlocal foldmethod=syntax endif |