Compare commits

...

31 Commits

Author SHA1 Message Date
Adam Stankiewicz
560024abe0 Resolve issues with loading order, closes #571 2020-10-02 00:36:09 +02:00
Chayoung You
3ad297db5c Fix error when editing path for shebang (#572) 2020-09-30 11:20:29 +02:00
Adam Stankiewicz
5d7121d829 Update README.md 2020-09-30 11:03:53 +02:00
Adam Stankiewicz
8b272d6e52 Document how to install with vim8 packages 2020-09-30 05:38:14 +02:00
Adam Stankiewicz
449bb88248 Make loading faster for ambiguous extensions without heuristics 2020-09-30 01:40:34 +02:00
Adam Stankiewicz
7036147860 Brag in readme about shortened ftdetect time 2020-09-30 01:23:41 +02:00
Adam Stankiewicz
a37e7e2939 Reduce startup time by avoiding calling slow au! 2020-09-30 01:22:44 +02:00
Adam Stankiewicz
c1aac2e279 Deduplicate polyglot files 2020-09-29 23:36:28 +02:00
Adam Stankiewicz
543e8c917b Modularize lazy loading of polyglot parts 2020-09-29 21:48:38 +02:00
Adam Stankiewicz
2f133372bc Make loading faster for ambiguous extensions 2020-09-29 19:51:43 +02:00
Adam Stankiewicz
539952f922 Prevent warning for ps1xml heuristics, #570 2020-09-29 19:38:49 +02:00
Adam Stankiewicz
b5cc8fc336 Remove ambiguity for terraform files, #570 2020-09-29 19:35:05 +02:00
Adam Stankiewicz
1872af2d5e Fix detection of conf files, closes #569 2020-09-29 19:11:11 +02:00
Adam Stankiewicz
46b09b0d5b Remove {{ }} from detecting htmldjango, #560 2020-09-29 16:26:03 +02:00
Adam Stankiewicz
63f43f3b01 Make ftdetect even shorter 2020-09-28 19:35:09 +02:00
Adam Stankiewicz
046a052f18 Make generated file bit shorter 2020-09-28 19:13:59 +02:00
Adam Stankiewicz
31409eaafb Fix all warning messages 2020-09-28 18:56:36 +02:00
Adam Stankiewicz
f431aee86e Change less provider, closes #567 2020-09-28 18:28:56 +02:00
Adam Stankiewicz
6a086b0c79 Fix many extensions detection 2020-09-28 03:00:01 +02:00
Adam Stankiewicz
692db4dc29 Fix more warnings 2020-09-28 02:30:26 +02:00
Adam Stankiewicz
417df69667 Fix zsh missing filenames 2020-09-28 02:19:06 +02:00
Adam Stankiewicz
ae778bdb17 Add missing filetypes for sql 2020-09-28 01:33:57 +02:00
Adam Stankiewicz
b7598ff0c5 Add missing filetypes for systemd 2020-09-28 01:23:00 +02:00
Adam Stankiewicz
312e95099d Show warnings only for DEV build 2020-09-28 00:43:36 +02:00
Adam Stankiewicz
63369f98ef Fix missing filetypes detection 2020-09-28 00:41:10 +02:00
Adam Stankiewicz
2116dd281b Fix some missing extensions warnings 2020-09-28 00:31:39 +02:00
Adam Stankiewicz
7ec499c19f Set indentation only locally, fixes #564 2020-09-27 12:05:29 +02:00
Adam Stankiewicz
33b86476b6 Fix neovim warning, closes #563 2020-09-26 01:25:12 +02:00
Adam Stankiewicz
4f36a63813 Update filenames for gitignore 2020-09-25 00:09:44 +02:00
Adam Stankiewicz
d6479bbf0b Change gitignore provider 2020-09-25 00:07:37 +02:00
Adam Stankiewicz
d53d2189b9 Add support for .gitignore highlighting 2020-09-24 23:24:42 +02:00
35 changed files with 4781 additions and 3415 deletions

View File

@@ -7,4 +7,4 @@ test:
@ scripts/test
dev:
@ echo "polyglot.vim\npackages.yaml\nheuristics.yaml\nscripts/test\nscripts/build\ntests/extensions.vim" | DEV=1 entr bash -c 'make && make test'
@ find scripts . -type f -depth 1 | DEV=1 entr bash -c 'make && make test'

View File

@@ -7,14 +7,14 @@ A collection of language packs for Vim.
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
- It **installs and updates 120+ times faster** than the <!--Package Count-->200<!--/Package Count--> packages it consists of.
- It **installs and updates 120+ times faster** than the <!--Package Count-->203<!--/Package Count--> packages it consists of.
- It is more secure because scripts loaded for all extensions are generated by vim-polyglot (ftdetect).
- Solid syntax and indentation support (other features skipped). Only the best language packs.
- All unnecessary files are ignored (like enormous documentation from php support).
- Automatically detect indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth))
- Each build is tested by automated vimrunner script on CI. See `spec` directory.
\*To be completely honest, optimized `ftdetect` script takes around `20ms` to load.
\*To be completely honest, optimized `ftdetect` script takes around `10ms` to load.
## Installation
@@ -32,8 +32,8 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
You can also use Vim 8 built-in package manager:
```
mkdir -p ~/.vim/pack/default/start
git clone https://github.com/sheerun/vim-polyglot ~/.vim/pack/default/start/vim-polyglot
" You should put in your ~/.vimrc "packadd vim-polyglot"
git clone --depth 1 https://github.com/sheerun/vim-polyglot ~/.vim/pack/plugins/opt/vim-polyglot
```
NOTE: Not all features of individual language packs are available. We strip them from functionality slowing vim startup (for example we ignore `plugins` folder that is loaded regardless of file type, instead we prefer `ftplugin` which is loaded lazily).
@@ -89,6 +89,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [clojure](https://github.com/guns/vim-clojure-static)
- [cmake](https://github.com/pboettch/vim-cmake-syntax)
- [coffee-script](https://github.com/kchmck/vim-coffee-script)
- [conf](https://github.com/vim/vim/tree/master/runtime)
- [cpp-modern](https://github.com/bfrg/vim-cpp-modern)
- [cql](https://github.com/elubow/cql-vim)
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim)
@@ -115,6 +116,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [fsharp](https://github.com/ionide/Ionide-vim)
- [gdscript](https://github.com/calviken/vim-gdscript3)
- [git](https://github.com/tpope/vim-git)
- [gitignore](https://github.com/fszymanski/fzf-gitignore)
- [glsl](https://github.com/tikhomirov/vim-glsl)
- [gmpl](https://github.com/maelvalais/gmpl.vim)
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting)
@@ -151,7 +153,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [julia](https://github.com/JuliaEditorSupport/julia-vim)
- [kotlin](https://github.com/udalov/kotlin-vim)
- [ledger](https://github.com/ledger/vim-ledger)
- [less](https://github.com/groenewege/vim-less)
- [less](https://github.com/vim/vim/tree/master/runtime)
- [lilypond](https://github.com/anowlcalledjosh/vim-lilypond)
- [livescript](https://github.com/gkz/vim-ls)
- [llvm](https://github.com/rhysd/vim-llvm)
@@ -209,6 +211,7 @@ If you need full functionality of any plugin, please use it directly with your p
- [slime](https://github.com/slime-lang/vim-slime-syntax)
- [smt2](https://github.com/bohlender/vim-smt2)
- [solidity](https://github.com/tomlion/vim-solidity)
- [sql](https://github.com/vim/vim/tree/master/runtime)
- [stylus](https://github.com/wavded/vim-stylus)
- [svelte](https://github.com/evanleck/vim-svelte/tree/main)
- [svg-indent](https://github.com/jasonshell/vim-svg-indent)

View File

@@ -4,9 +4,9 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cpp-modern') ==
" Vim syntax file
" Language: C++ (Standard library including C++11/14/17/20)
" Original Author: Jon Haggblad <https://github.com/octol>
" Maintainer: bfrg <bfrg@users.noreply.github.com>
" Maintainer: bfrg <https://github.com/bfrg>
" Website: https://github.com/bfrg/vim-cpp-modern
" Last Change: Jun 23, 2020
" Last Change: Oct 1, 2020
"
" This syntax file is based on:
" https://github.com/octol/vim-cpp-enhanced-highlight
@@ -17,18 +17,18 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cpp-modern') ==
syntax keyword cppSTLconstant
\ MB_CUR_MAX MB_LEN_MAX WCHAR_MAX WCHAR_MIN WEOF __STDC_UTF_16__ __STDC_UTF_32__
syntax keyword cppSTLnamespace
\ std experimental rel_ops
syntax keyword cppSTLconstant
\ badbit digits digits10 eofbit failbit goodbit has_denorm has_denorm_loss has_infinity has_quiet_NaN has_signaling_NaN is_bounded is_exact is_iec559 is_integer is_modulo is_signed is_specialized max_exponent max_exponent10 min_exponent min_exponent10 nothrow npos radix round_style tinyness_before traps
syntax keyword cppSTLVariable
syntax keyword cppSTLvariable
\ cerr cin clog cout wcerr wcin wclog wcout
syntax keyword cppSTLexception
\ bad_alloc bad_exception bad_typeid bad_cast domain_error exception failure invalid_argument length_error logic_error out_of_range overflow_error range_error runtime_error underflow_error
syntax keyword cppSTLfunctional
\ binary_function binary_negate bit_and bit_not bit_or divides equal_to greater greater_equal less less_equal logical_and logical_not logical_or minus modulus multiplies negate not_equal_to plus unary_function unary_negate
syntax keyword cppSTLios
\ endl ends flush resetiosflags setbase setfill setiosflags setprecision setw ws
@@ -36,230 +36,83 @@ syntax keyword cppSTLios
\ boolalpha dec defaultfloat fixed hex hexfloat internal left noboolalpha noshowbase noshowpoint noshowpos noskipws nounitbuf nouppercase oct right scientific showbase showpoint showpos skipws unitbuf uppercase
syntax keyword cppSTLtype
\ fmtflags iostate openmode
" Some of these can be highlighted as both cppSTLios and cppSTLconstant
" syntax keyword cppSTLconstant
" \ adjustfield app ate basefield binary floatfield in out trunc boolalpha dec fixed hex internal left oct right scientific showbase showpoint showpos skipws unitbuf uppercase
\ fmtflags iostate openmode Init allocator auto_ptr basic_filebuf basic_fstream basic_ifstream basic_ios basic_iostream basic_istream basic_istringstream basic_ofstream basic_ostream basic_ostringstream basic_streambuf basic_string basic_stringbuf basic_stringstream binary_compose binder1st binder2nd bitset char_traits char_type const_mem_fun1_t const_mem_fun_ref1_t const_mem_fun_ref_t const_mem_fun_t const_pointer const_reference container_type deque difference_type div_t double_t event_callback filebuf first_type float_denorm_style float_round_style float_t fpos fstream gslice_array ifstream imaxdiv_t indirect_array int_type ios ios_base iostream istream istringstream istrstream iterator_category iterator_traits key_compare key_type ldiv_t list lldiv_t map mapped_type mask_array mbstate_t mem_fun1_t mem_fun_ref1_t mem_fun_ref_t mem_fun_t multimap multiset nothrow_t numeric_limits off_type ofstream ostream ostringstream ostrstream pair pointer pointer_to_binary_function pointer_to_unary_function pos_type priority_queue queue reference second_type seekdir sequence_buffer set sig_atomic_t size_type slice_array stack state_type stream streambuf streamoff streampos streamsize string stringbuf stringstream strstream strstreambuf temporary_buffer test_type time_t tm traits_type type_info u16string u32string unary_compose unary_negate valarray value_compare value_type vector wctrans_t wctype_t wfilebuf wfstream wifstream wint_t wios wiostream wistream wistringstream wofstream wostream wostringstream wstreambuf wstreampos wstring wstringbuf wstringstream codecvt codecvt_base codecvt_byname collate collate_byname ctype ctype_base ctype_byname locale messages messages_base messages_byname money_base money_get money_put moneypunct moneypunct_byname num_get num_put numpunct numpunct_byname time_base time_get time_get_byname time_put time_put_byname binary_function binary_negate bit_and bit_not bit_or divides equal_to greater greater_equal less less_equal logical_and logical_not logical_or minus modulus multiplies negate not_equal_to plus unary_function unary_negate bidirectional_iterator_tag forward_iterator_tag input_iterator_tag output_iterator_tag random_access_iterator_tag
syntax keyword cppSTLiterator
\ back_insert_iterator bidirectional_iterator const_iterator const_reverse_iterator forward_iterator front_insert_iterator input_iterator insert_iterator istream_iterator istreambuf_iterator iterator ostream_iterator ostreambuf_iterator output_iterator random_access_iterator raw_storage_iterator reverse_bidirectional_iterator reverse_iterator
syntax keyword cppSTLiterator_tag
\ bidirectional_iterator_tag forward_iterator_tag input_iterator_tag output_iterator_tag random_access_iterator_tag
" Function templates that are called with template parameters
syntax keyword cppSTLfunction
\ use_facet has_facet get
syntax keyword cppSTLnamespace
\ experimental rel_ops std
syntax keyword cppSTLtype
\ Init allocator auto_ptr basic_filebuf basic_fstream basic_ifstream basic_ios basic_iostream basic_istream basic_istringstream basic_ofstream basic_ostream basic_ostringstream basic_streambuf basic_string basic_stringbuf basic_stringstream binary_compose binder1st binder2nd bitset char_traits char_type const_mem_fun1_t const_mem_fun_ref1_t const_mem_fun_ref_t const_mem_fun_t const_pointer const_reference container_type deque difference_type div_t double_t event_callback filebuf first_type float_denorm_style float_round_style float_t fpos fstream gslice_array ifstream imaxdiv_t indirect_array int_type ios ios_base iostream istream istringstream istrstream iterator_category iterator_traits key_compare key_type ldiv_t list lldiv_t map mapped_type mask_array mbstate_t mem_fun1_t mem_fun_ref1_t mem_fun_ref_t mem_fun_t multimap multiset nothrow_t numeric_limits off_type ofstream ostream ostringstream ostrstream pair pointer pointer_to_binary_function pointer_to_unary_function pos_type priority_queue queue reference second_type seekdir sequence_buffer set sig_atomic_t size_type slice_array stack state_type stream streambuf streamoff streampos streamsize string stringbuf stringstream strstream strstreambuf temporary_buffer test_type time_t tm traits_type type_info u16string u32string unary_compose unary_negate valarray value_compare value_type vector wctrans_t wctype_t wfilebuf wfstream wifstream wint_t wios wiostream wistream wistringstream wofstream wostream wostringstream wstreambuf wstreampos wstring wstringbuf wstringstream
" locale
syntax keyword cppSTLtype
\ codecvt codecvt_base codecvt_byname collate collate_byname ctype ctype_base ctype_byname locale messages messages_base messages_byname money_base money_get money_put moneypunct moneypunct_byname num_get num_put numpunct numpunct_byname time_base time_get time_get_byname time_put time_put_byname
" template functions that are called with template parameters, like
" std::use_facet<std::moneypunct<char, true>>(loc).curr_symbol()
syntax keyword cppSTLfunction use_facet has_facet
" std::get is a template function, so when called as std::get<N>(t), we want it
" to be highlighted as a function
syntax keyword cppSTLfunction get
" Some of these keywords can be highlighted as cppSTLios or cppSTLconstant
" syntax keyword cppSTLconstant
" \ adjustfield app ate basefield binary floatfield in out trunc boolalpha dec fixed hex internal left oct right scientific showbase showpoint showpos skipws unitbuf uppercase
" C++11 extensions {{{1
if !exists('cpp_no_cpp11')
syntax keyword cppStatement nullptr
syntax keyword cppType char16_t char32_t
syntax keyword cppSTLconstant nullptr
" std containers
syntax keyword cppSTLtype array
" atomic
syntax keyword cppSTLconstant ATOMIC_FLAG_INIT
syntax keyword cppSTLenum memory_order
syntax keyword cppSTLtype
\ atomic atomic_bool atomic_char atomic_char16_t atomic_char32_t atomic_flag atomic_int atomic_int_fast16_t atomic_int_fast32_t atomic_int_fast64_t atomic_int_fast8_t atomic_int_least16_t atomic_int_least32_t atomic_int_least64_t atomic_int_least8_t atomic_intmax_t atomic_intptr_t atomic_llong atomic_long atomic_ptrdiff_t atomic_schar atomic_short atomic_size_t atomic_uchar atomic_uint atomic_uint_fast16_t atomic_uint_fast32_t atomic_uint_fast64_t atomic_uint_fast8_t atomic_uint_least16_t atomic_uint_least32_t atomic_uint_least64_t atomic_uint_least8_t atomic_uintmax_t atomic_uintptr_t atomic_ullong atomic_ulong atomic_ushort atomic_wchar_t
" chrono
syntax keyword cppSTLnamespace chrono
syntax keyword cppSTLcast duration_cast time_point_cast
syntax keyword cppSTLtype
\ duration duration_values high_resolution_clock hours microseconds milliseconds minutes nanoseconds seconds steady_clock system_clock time_point treat_as_floating_point
" condition_variable
syntax keyword cppSTLtype condition_variable
" cstddef
syntax keyword cppSTLtype nullptr_t max_align_t
" exception
syntax keyword cppSTLtype exception_ptr nested_exception
" functional
syntax keyword cppSTLexception bad_function_call
syntax keyword cppSTLfunctional function
syntax keyword cppSTLfunction mem_fn
syntax keyword cppSTLconstant _1 _2 _3 _4 _5 _6 _7 _8 _9
syntax keyword cppSTLtype
\ hash is_bind_expression is_placeholder reference_wrapper
" iterator
syntax keyword cppSTLiterator move_iterator
" forward_list
syntax keyword cppSTLtype forward_list
" future
syntax keyword cppSTLtype future packaged_task promise shared_future
syntax keyword cppSTLenum future_status future_errc launch
syntax keyword cppSTLexception future_error
" initializer_list
syntax keyword cppSTLtype initializer_list
" ios
syntax keyword cppSTLenum io_errc
" syntax keyword cppSTLtype is_error_code_enum
" limits
syntax keyword cppSTLconstant max_digits10
" locale
syntax keyword cppSTLfunction isblank
syntax keyword cppSTLtype
\ codecvt_mode codecvt_utf16 codecvt_utf8 codecvt_utf8_utf16 wbuffer_convert wstring_convert
" memory
syntax keyword cppSTLconstant allocator_arg
syntax keyword cppSTLexception bad_weak_ptr
syntax keyword cppSTLfunction allocate_shared make_shared
syntax keyword cppSTLfunction
\ const_pointer_cast dynamic_pointer_cast static_pointer_cast
syntax keyword cppSTLnamespace chrono this_thread
syntax keyword cppSTLtype
\ allocator_arg_t allocator_traits allocator_type default_delete enable_shared_from_this is_always_equal owner_less pointer_safety pointer_traits propagate_on_container_copy_assignment propagate_on_container_move_assignment propagate_on_container_swap rebind_alloc rebind_traits shared_ptr unique_ptr uses_allocator void_pointer const_void_pointer weak_ptr
\ array atomic atomic_bool atomic_char atomic_char16_t atomic_char32_t atomic_flag atomic_int atomic_int_fast16_t atomic_int_fast32_t atomic_int_fast64_t atomic_int_fast8_t atomic_int_least16_t atomic_int_least32_t atomic_int_least64_t atomic_int_least8_t atomic_intmax_t atomic_intptr_t atomic_llong atomic_long atomic_ptrdiff_t atomic_schar atomic_short atomic_size_t atomic_uchar atomic_uint atomic_uint_fast16_t atomic_uint_fast32_t atomic_uint_fast64_t atomic_uint_fast8_t atomic_uint_least16_t atomic_uint_least32_t atomic_uint_least64_t atomic_uint_least8_t atomic_uintmax_t atomic_uintptr_t atomic_ullong atomic_ulong atomic_ushort atomic_wchar_t duration duration_values high_resolution_clock hours microseconds milliseconds minutes nanoseconds seconds steady_clock system_clock time_point treat_as_floating_point condition_variable nullptr_t max_align_t exception_ptr nested_exception hash is_bind_expression is_placeholder reference_wrapper forward_list future packaged_task promise shared_future initializer_list codecvt_mode codecvt_utf16 codecvt_utf8 codecvt_utf8_utf16 wbuffer_convert wstring_convert allocator_arg_t allocator_traits allocator_type default_delete enable_shared_from_this is_always_equal owner_less pointer_safety pointer_traits propagate_on_container_copy_assignment propagate_on_container_move_assignment propagate_on_container_swap rebind_alloc rebind_traits shared_ptr unique_ptr uses_allocator void_pointer const_void_pointer weak_ptr adopt_lock_t condition_variable_any defer_lock_t lock_guard mutex once_flag recursive_mutex recursive_timed_mutex timed_mutex try_to_lock_t unique_lock bernoulli_distribution binomial_distribution cauchy_distribution chi_squared_distribution default_random_engine discard_block_engine discrete_distribution exponential_distribution extreme_value_distribution fisher_f_distribution gamma_distribution geometric_distribution independent_bits_engine knuth_b linear_congruential_engine lognormal_distribution mersenne_twister_engine minstd_rand minstd_rand0 mt19937 mt19937_64 negative_binomial_distribution normal_distribution piecewise_constant_distribution piecewise_linear_distribution poisson_distribution random_device ranlux24 ranlux24_base ranlux48 ranlux48_base seed_seq shuffle_order_engine student_t_distribution subtract_with_carry_engine uniform_int_distribution uniform_real_distribution weibull_distribution atto centi deca deci exa femto giga hecto kilo mega micro milli nano peta pico ratio ratio_add ratio_divide ratio_equal ratio_greater ratio_greater_equal ratio_less ratio_less_equal ratio_multiply ratio_not_equal ratio_subtract tera yocto yotta zepto zetta basic_regex match_results regex_traits sub_match syntax_option_type match_flag_type error_type scoped_allocator_adaptor outer_allocator_type inner_allocator_type error_code error_condition error_category is_error_code_enum is_error_condition_enum thread tuple tuple_size tuple_element type_index add_const add_cv add_lvalue_reference add_pointer add_rvalue_reference add_volatile aligned_storage aligned_union alignment_of common_type conditional decay enable_if extent false_type has_virtual_destructor integral_constant is_abstract is_arithmetic is_array is_assignable is_base_of is_class is_compound is_const is_constructible is_convertible is_copy_assignable is_copy_constructible is_default_constructible is_destructible is_empty is_enum is_floating_point is_function is_fundamental is_integral is_literal_type is_lvalue_reference is_member_function_pointer is_member_object_pointer is_member_pointer is_move_assignable is_move_constructible is_nothrow_assignable is_nothrow_constructible is_nothrow_copy_assignable is_nothrow_copy_constructible is_nothrow_default_constructible is_nothrow_destructible is_nothrow_move_assignable is_nothrow_move_constructible is_object is_pod is_pointer is_polymorphic is_reference is_rvalue_reference is_same is_scalar is_signed is_standard_layout is_trivial is_trivially_assignable is_trivially_constructible is_trivially_copy_assignable is_trivially_copy_constructible is_trivially_copyable is_trivially_default_constructible is_trivially_destructible is_trivially_move_assignable is_trivially_move_constructible is_union is_unsigned is_void is_volatile make_signed make_unsigned rank remove_all_extents remove_const remove_cv remove_extent remove_pointer remove_reference remove_volatile result_of true_type underlying_type hasher key_equal unordered_map unordered_multimap unordered_multiset unordered_set piecewise_construct_t function
" mutex
syntax keyword cppSTLenum cv_status
syntax keyword cppSTLconstant defer_lock try_to_lock adopt_lock
syntax keyword cppSTLtype
\ adopt_lock_t condition_variable_any defer_lock_t lock_guard mutex once_flag recursive_mutex recursive_timed_mutex timed_mutex try_to_lock_t unique_lock
" new
syntax keyword cppSTLexception bad_array_new_length
" numerics, cmath
syntax keyword cppSTLconstant
\ FLT_EVAL_METHOD FP_INFINITE FP_NAN FP_NORMAL FP_SUBNORMAL FP_ZERO HUGE_VALF HUGE_VALL INFINITY MATH_ERREXCEPT MATH_ERRNO NAN math_errhandling
\ _1 _2 _3 _4 _5 _6 _7 _8 _9 max_digits10 allocator_arg defer_lock try_to_lock adopt_lock math_errhandling
" random
syntax keyword cppSTLfunction generate_canonical
syntax keyword cppSTLtype
\ bernoulli_distribution binomial_distribution cauchy_distribution chi_squared_distribution default_random_engine discard_block_engine discrete_distribution exponential_distribution extreme_value_distribution fisher_f_distribution gamma_distribution geometric_distribution independent_bits_engine knuth_b linear_congruential_engine lognormal_distribution mersenne_twister_engine minstd_rand minstd_rand0 mt19937 mt19937_64 negative_binomial_distribution normal_distribution piecewise_constant_distribution piecewise_linear_distribution poisson_distribution random_device ranlux24 ranlux24_base ranlux48 ranlux48_base seed_seq shuffle_order_engine student_t_distribution subtract_with_carry_engine uniform_int_distribution uniform_real_distribution weibull_distribution
syntax keyword cppSTLconstant
\ FLT_EVAL_METHOD FP_INFINITE FP_NAN FP_NORMAL FP_SUBNORMAL FP_ZERO HUGE_VALF HUGE_VALL INFINITY MATH_ERREXCEPT MATH_ERRNO NAN
" ratio
syntax keyword cppSTLtype
\ atto centi deca deci exa femto giga hecto kilo mega micro milli nano peta pico ratio ratio_add ratio_divide ratio_equal ratio_greater ratio_greater_equal ratio_less ratio_less_equal ratio_multiply ratio_not_equal ratio_subtract tera yocto yotta zepto zetta
syntax keyword cppSTLenum
\ memory_order future_status future_errc launch io_errc cv_status errc
" regex
syntax keyword cppSTLiterator regex_iterator regex_token_iterator
syntax keyword cppSTLexception regex_error
syntax keyword cppSTLtype
\ basic_regex match_results regex_traits sub_match syntax_option_type match_flag_type error_type
syntax keyword cppSTLfunction
\ duration_cast time_point_cast mem_fn const_pointer_cast dynamic_pointer_cast static_pointer_cast allocate_shared make_shared isblank generate_canonical forward_as_tuple make_tuple tie tuple_cat declval forward move move_if_noexcept
" scoped_allocator
syntax keyword cppSTLtype
\ scoped_allocator_adaptor outer_allocator_type inner_allocator_type
syntax keyword cppSTLexception
\ bad_function_call future_error regex_error system_error bad_weak_ptr bad_array_new_length
" system_error
syntax keyword cppSTLenum errc
syntax keyword cppSTLexception system_error
syntax keyword cppSTLtype
\ error_code error_condition error_category is_error_code_enum is_error_condition_enum
" syntax keyword cppSTLiterator contained
syntax keyword cppSTLiterator
\ move_iterator regex_iterator regex_token_iterator const_local_iterator local_iterator
" thread
syntax keyword cppSTLnamespace this_thread
syntax keyword cppSTLtype thread
" tuple
syntax keyword cppSTLtype tuple tuple_size tuple_element
syntax keyword cppSTLfunction forward_as_tuple make_tuple tie tuple_cat
" Note: ignore is also a function
" syntax keyword cppSTLVariable ignore
" typeindex
syntax keyword cppSTLtype type_index
" type_traits
syntax keyword cppSTLtype
\ add_const add_cv add_lvalue_reference add_pointer add_rvalue_reference add_volatile aligned_storage aligned_union alignment_of common_type conditional decay enable_if extent false_type has_virtual_destructor integral_constant is_abstract is_arithmetic is_array is_assignable is_base_of is_class is_compound is_const is_constructible is_convertible is_copy_assignable is_copy_constructible is_default_constructible is_destructible is_empty is_enum is_floating_point is_function is_fundamental is_integral is_literal_type is_lvalue_reference is_member_function_pointer is_member_object_pointer is_member_pointer is_move_assignable is_move_constructible is_nothrow_assignable is_nothrow_constructible is_nothrow_copy_assignable is_nothrow_copy_constructible is_nothrow_default_constructible is_nothrow_destructible is_nothrow_move_assignable is_nothrow_move_constructible is_object is_pod is_pointer is_polymorphic is_reference is_rvalue_reference is_same is_scalar is_signed is_standard_layout is_trivial is_trivially_assignable is_trivially_constructible is_trivially_copy_assignable is_trivially_copy_constructible is_trivially_copyable is_trivially_default_constructible is_trivially_destructible is_trivially_move_assignable is_trivially_move_constructible is_union is_unsigned is_void is_volatile make_signed make_unsigned rank remove_all_extents remove_const remove_cv remove_extent remove_pointer remove_reference remove_volatile result_of true_type underlying_type
" unordered_map, unordered_set, unordered_multimap, unordered_multiset
syntax keyword cppSTLiterator const_local_iterator local_iterator
syntax keyword cppSTLtype
\ hasher key_equal unordered_map unordered_multimap unordered_multiset unordered_set
" utility
syntax keyword cppSTLtype piecewise_construct_t
syntax keyword cppSTLconstant piecewise_construct
syntax keyword cppSTLfunction declval forward move move_if_noexcept
" Note: ignore is also a function (could also be put under cppSTLvariable)
syntax match cppSTLconstant "\<ignore\>(\@!"
endif
" C++14 extensions {{{1
if !exists('cpp_no_cpp14')
" chrono
syntax keyword cppSTLnamespace literals chrono_literals
syntax keyword cppSTLnamespace literals chrono_literals string_literals
" memory
syntax keyword cppSTLfunction make_unique
" utility
syntax keyword cppSTLtype
\ index_sequence index_sequence_for integer_sequence make_index_sequence make_integer_sequence
" shared_mutex
syntax keyword cppSTLtype shared_lock shared_timed_mutex
" string
syntax keyword cppSTLnamespace string_literals
" tuple
syntax keyword cppSTLtype tuple_element_t
" type_traits
syntax keyword cppSTLtype
\ add_const_t add_cv_t add_lvalue_reference_t add_pointer_t add_rvalue_reference_t add_volatile_t aligned_storage_t aligned_union_t common_type_t conditional_t decay_t enable_if_t is_null_pointer make_signed_t make_unsigned_t remove_all_extents_t remove_const_t remove_cv_t remove_extent_t remove_pointer_t remove_reference_t remove_volatile_t result_of_t underlying_type_t
\ index_sequence index_sequence_for integer_sequence make_index_sequence make_integer_sequence shared_lock shared_timed_mutex tuple_element_t add_const_t add_cv_t add_lvalue_reference_t add_pointer_t add_rvalue_reference_t add_volatile_t aligned_storage_t aligned_union_t common_type_t conditional_t decay_t enable_if_t is_null_pointer make_signed_t make_unsigned_t remove_all_extents_t remove_const_t remove_cv_t remove_extent_t remove_pointer_t remove_reference_t remove_volatile_t result_of_t underlying_type_t
endif
" C++17 extensions {{{1
if !exists('cpp_no_cpp17')
" any
syntax keyword cppSTLtype any
syntax keyword cppSTLexception bad_any_cast
syntax keyword cppSTLcast any_cast
" atomic
syntax keyword cppSTLconstant is_always_lock_free
" chrono
syntax keyword cppSTLbool treat_as_floating_point_v
" execution
syntax keyword cppSTLnamespace execution
syntax keyword cppSTLconstant seq par par_unseq
syntax keyword cppSTLbool is_execution_policy_v
syntax keyword cppSTLtype
\ is_execution_policy parallel_policy parallel_unsequenced_policy sequenced_policy
" filesystem
syntax keyword cppSTLnamespace filesystem
syntax keyword cppSTLexception filesystem_error
syntax keyword cppSTLnamespace filesystem execution
syntax keyword cppSTLtype
\ directory_entry directory_iterator file_status file_time_type path recursive_directory_iterator space_info
\ any is_execution_policy parallel_policy parallel_unsequenced_policy sequenced_policy directory_entry directory_iterator file_status file_time_type path recursive_directory_iterator space_info default_order default_order_t default_searcher boyer_moore_searcher boyer_moore_horspool_searcher memory_resource monotonic_buffer_resource polymorphic_allocator pool_options synchronized_pool_resource unsynchronized_pool_resource scoped_lock optional nullopt_t shared_mutex basic_string_view string_view u16string_view u32string_view wstring_view bool_constant conjunction disjunction has_unique_object_representations invoke_result invoke_result_t is_aggregate is_callable is_invocable is_invocable_r is_nothrow_invocable is_nothrow_invocable_r is_nothrow_swappable is_nothrow_swappable_with is_nowthrow_callable is_swappable is_swappable_with negation void_t node_type insert_return_type in_place_tag in_place_t in_place_type_t in_place_index_t monostate variant variant_size variant_alternative variant_alternative_t
syntax keyword cppSTLexception
\ bad_any_cast filesystem_error bad_optional_access bad_variant_access
syntax keyword cppSTLconstant
\ is_always_lock_free seq par par_unseq copy_symlinks auto_format create_hard_links create_symlinks directories_only follow_directory_symlink generic_format group_all group_exec group_read group_write native_format others_all others_exec others_read others_write overwrite_existing owner_all owner_exec owner_read owner_write preferred_separator recursive set_gid set_uid skip_existing skip_permission_denied skip_symlinks sticky_bit update_existing hardware_destructive_interference_size hardware_constructive_interference_size tuple_size_v nullopt alignment_of_v rank_v extent_v variant_npos variant_size_v
syntax keyword cppSTLbool
\ treat_as_floating_point_v is_execution_policy_v is_bind_expression_v is_placeholder_v is_error_code_enum_v is_error_condition_enum_v uses_allocator_v conjunction_v disjunction_v has_unique_object_representations_v has_virtual_destructor_v is_abstract_v is_aggregate_v is_arithmetic_v is_array_v is_assignable_v is_base_of_v is_callable_v is_class_v is_compound_v is_const_v is_constructible_v is_convertible_v is_copy_assignable_v is_copy_constructible_v is_default_constructible_v is_destructible_v is_empty_v is_enum_v is_floating_point_v is_function_v is_fundamental_v is_integral_v is_invocable_r_v is_invocable_v is_literal_type_v is_lvalue_reference_v is_member_function_pointer_v is_member_object_pointer_v is_member_pointer_v is_move_assignable_v is_move_constructible_v is_nothrow_assignable_v is_nothrow_constructible_v is_nothrow_copy_assignable_v is_nothrow_copy_constructible_v is_nothrow_default_constructible_v is_nothrow_destructible_v is_nothrow_invocable_r_v is_nothrow_invocable_v is_nothrow_move_assignable_v is_nothrow_move_constructible_v is_nothrow_swappable_v is_nothrow_swappable_with_v is_nowthrow_callable_v is_null_pointer_v is_object_v is_pod_v is_pointer_v is_polymorphic_v is_reference_v is_rvalue_reference_v is_same_v is_scalar_v is_signed_v is_standard_layout_v is_swappable_v is_swappable_with_v is_trivial_v is_trivially_assignable_v is_trivially_constructible_v is_trivially_copy_assignable_v is_trivially_copy_constructible_v is_trivially_copyable_v is_trivially_default_constructible_v is_trivially_destructible_v is_trivially_move_assignable_v is_trivially_move_constructible_v is_union_v is_unsigned_v is_void_v is_volatile_v negation_v
syntax keyword cppSTLfunction
\ reinterpret_pointer_cast make_from_tuple make_optional any_cast
syntax keyword cppSTLenum
\ copy_options directory_options file_type perm_options perms
@@ -267,152 +120,39 @@ if !exists('cpp_no_cpp17')
" Note: There is std::filesystem::path::format and std::format() in <format>
syntax match cppSTLenum "\<format\>(\@!"
syntax keyword cppSTLconstant
\ copy_symlinks auto_format create_hard_links create_symlinks directories_only follow_directory_symlink generic_format group_all group_exec group_read group_write native_format others_all others_exec others_read others_write overwrite_existing owner_all owner_exec owner_read owner_write preferred_separator recursive set_gid set_uid skip_existing skip_permission_denied skip_symlinks sticky_bit update_existing
" Note: these keywords are very likely to coincide with user-defined variables
" syntax keyword cppSTLconstant
" \ all mask unknown replace add remove nofollow none not_found regular directory symlink block character fifo socket unknown
" Note: these are also functions
" syntax keyword cppSTLconstant capacity free available
" functional
syntax keyword cppSTLbool is_bind_expression_v is_placeholder_v
syntax keyword cppSTLtype
\ default_order default_order_t default_searcher boyer_moore_searcher boyer_moore_horspool_searcher
" memory
syntax keyword cppSTLfunction reinterpret_pointer_cast
syntax keyword cppSTLconstant uses_allocator_v
" memory_resource
syntax keyword cppSTLtype
\ memory_resource monotonic_buffer_resource polymorphic_allocator pool_options synchronized_pool_resource unsynchronized_pool_resource
" mutex
syntax keyword cppSTLtype scoped_lock
" new
syntax keyword cppSTLconstant
\ hardware_destructive_interference_size hardware_constructive_interference_size
" optional
syntax keyword cppSTLtype optional nullopt_t
syntax keyword cppSTLexception bad_optional_access
syntax keyword cppSTLconstant nullopt
syntax keyword cppSTLfunction make_optional
" shared_mutex
syntax keyword cppSTLtype shared_mutex
" string_view
syntax keyword cppSTLtype
\ basic_string_view string_view u16string_view u32string_view wstring_view
" system_error
syntax keyword cppSTLbool is_error_code_enum_v is_error_condition_enum_v
" tuple
syntax keyword cppSTLconstant tuple_size_v
syntax keyword cppSTLfunction make_from_tuple
" type_traits
syntax keyword cppSTLconstant alignment_of_v rank_v extent_v
syntax keyword cppSTLbool
\ conjunction_v disjunction_v has_unique_object_representations_v has_virtual_destructor_v is_abstract_v is_aggregate_v is_arithmetic_v is_array_v is_assignable_v is_base_of_v is_callable_v is_class_v is_compound_v is_const_v is_constructible_v is_convertible_v is_copy_assignable_v is_copy_constructible_v is_default_constructible_v is_destructible_v is_empty_v is_enum_v is_floating_point_v is_function_v is_fundamental_v is_integral_v is_invocable_r_v is_invocable_v is_literal_type_v is_lvalue_reference_v is_member_function_pointer_v is_member_object_pointer_v is_member_pointer_v is_move_assignable_v is_move_constructible_v is_nothrow_assignable_v is_nothrow_constructible_v is_nothrow_copy_assignable_v is_nothrow_copy_constructible_v is_nothrow_default_constructible_v is_nothrow_destructible_v is_nothrow_invocable_r_v is_nothrow_invocable_v is_nothrow_move_assignable_v is_nothrow_move_constructible_v is_nothrow_swappable_v is_nothrow_swappable_with_v is_nowthrow_callable_v is_null_pointer_v is_object_v is_pod_v is_pointer_v is_polymorphic_v is_reference_v is_rvalue_reference_v is_same_v is_scalar_v is_signed_v is_standard_layout_v is_swappable_v is_swappable_with_v is_trivial_v is_trivially_assignable_v is_trivially_constructible_v is_trivially_copy_assignable_v is_trivially_copy_constructible_v is_trivially_copyable_v is_trivially_default_constructible_v is_trivially_destructible_v is_trivially_move_assignable_v is_trivially_move_constructible_v is_union_v is_unsigned_v is_void_v is_volatile_v negation_v
syntax keyword cppSTLtype
\ bool_constant conjunction disjunction has_unique_object_representations invoke_result invoke_result_t is_aggregate is_callable is_invocable is_invocable_r is_nothrow_invocable is_nothrow_invocable_r is_nothrow_swappable is_nothrow_swappable_with is_nowthrow_callable is_swappable is_swappable_with negation void_t
" unordered_map, unordered_set, unordered_multimap, unordered_multiset
syntax keyword cppSTLtype node_type insert_return_type
" utility
syntax keyword cppSTLtype
\ in_place_tag in_place_t in_place_type_t in_place_index_t
" variant
syntax keyword cppSTLconstant variant_npos variant_size_v
syntax keyword cppSTLexception bad_variant_access
syntax keyword cppSTLtype
\ monostate variant variant_size variant_alternative variant_alternative_t
endif
" C++20 extensions {{{1
if !exists('cpp_no_cpp20')
syntax keyword cppType char8_t
syntax keyword cppOperator co_await
syntax keyword cppStatement consteval constinit concept requires co_yield co_return
syntax keyword cppSTLnamespace ranges views
syntax keyword cppSTLconstant dynamic_extent
syntax keyword cppSTLvariable default_sentinel unreachable_sentinel
" atomic
syntax keyword cppSTLtype atomic_ref
" bit
syntax keyword cppSTLtype endian
" compare
syntax keyword cppSTLtype
\ weak_ordering strong_ordering partial_ordering weak_equality strong_equality common_comparison_category common_comparison_category_t
\ atomic_ref endian weak_ordering strong_ordering partial_ordering weak_equality strong_equality common_comparison_category common_comparison_category_t contract_violation coroutine_traits coroutine_handle noop_coroutine_handle noop_coroutine_promise suspend_never suspend_always remove_cvref remove_cvref_t is_bounded_array is_layout_compatible is_unbounded_array is_nothrow_convertible has_strong_structural_equality is_pointer_interconvertible_base_of unwrap_reference unwrap_reference_t unwrap_ref_decay unwrap_ref_decay_t basic_common_reference common_reference common_reference_t iterator_t sentinel_t dangling safe_iterator_t safe_subrange_t ref_view filter_view transform_view iota_view join_view empty_view single_view split_view common_view reverse_view view_interface span basic_syncbuf basic_osyncstream syncbuf wsyncbuf osyncstream wosyncstream jthread latch barrier stop_token stop_source stop_callback counting_semaphore binary_semaphore source_location compare_three_way_result compare_three_way_result_t contiguous_iterator_tag incrementable_traits iter_value_t iter_reference_t iter_difference_t iter_rvalue_reference_t iter_common_reference_t indirectly_readable_traits move_sentinel default_sentinel_t unreachable_sentinel_t common_iterator counted_iterator indirect_result_t projected type_identity type_identity_t
" concepts
syntax keyword cppSTLconcept
\ assignable_from boolean common_reference_with common_with constructible_from convertible_to copy_constructible copyable default_constructible derived_from destructible equality_comparable equality_comparable_with equivalence_relation floating_point integral invocable movable move_constructible predicate regular regular_invocable relation same_as semiregular signed_integral strict_weak_order swappable swappable_with totally_ordered totally_ordered_with unsigned_integral default_initializable
" concepts - named requirements
" These are concepts that haven't made it into the C++ Standard yet
" https://en.cppreference.com/w/cpp/named_req
" http://en.cppreference.com/w/cpp/language/constraints
if get(g:, 'cpp_named_requirements_highlight', 0)
syntax keyword cppSTLNamedReq
\ Allocator AllocatorAwareContainer AssociativeContainer BasicLockable BidirectionalIterator BinaryPredicate BinaryTypeTrait BitmaskType Callable CharTraits Clock Compare ConstExprIterator Container ContiguousContainer ContiguousIterator CopyAssignable CopyInsertable CopyInsertable DefaultInsertable EmplaceConstructible Erasable FormattedInputFunction FormattedOutputFunction ForwardIterator FunctionObject Hash InputIterator Iterator LessThanComparable LiteralType Lockable MoveAssignable MoveInsertable Mutex NullablePointer NumericType OutputIterator PODType RandomAccessIterator RandomNumberDistribution RandomNumberEngine RandomNumberEngineAdaptor RegexTraits ReversibleContainer SeedSequence SequenceContainer SharedMutex SharedTimedMutex StandardLayoutType TimedLockable TimedMutex TransformationTrait TrivialClock TrivialType TriviallyCopyable UnaryTypeTrait UnformattedInputFunction UnformattedOutputFunction UniformRandomBitGenerator UnorderedAssociativeContainer ValueSwappable
hi def link cppSTLNamedReq Typedef
endif
" contract
syntax keyword cppSTLtype contract_violation
" coroutines
syntax keyword cppSTLtype
\ coroutine_traits coroutine_handle noop_coroutine_handle noop_coroutine_promise suspend_never suspend_always
" memory
syntax keyword cppSTLfunction
\ make_unique_default_init make_shared_default_init allocate_shared_default_init uses_allocator_construction_args make_obj_using_allocator
" type_traits
syntax keyword cppSTLtype
\ remove_cvref remove_cvref_t is_bounded_array is_layout_compatible is_unbounded_array is_nothrow_convertible has_strong_structural_equality is_pointer_interconvertible_base_of unwrap_reference unwrap_reference_t unwrap_ref_decay unwrap_ref_decay_t basic_common_reference common_reference common_reference_t
\ make_unique_default_init make_shared_default_init allocate_shared_default_init uses_allocator_construction_args make_obj_using_allocator is_corresponding_member subspan in_range is_pointer_interconvertible_with_class
syntax keyword cppSTLbool
\ is_bounded_array_v is_layout_compatible_v is_unbounded_array_v is_nothrow_convertible_v has_strong_structural_equality_v is_pointer_interconvertible_base_of_v
syntax keyword cppSTLfunction is_corresponding_member
" ranges
syntax keyword cppSTLnamespace ranges views
\ is_bounded_array_v is_layout_compatible_v is_unbounded_array_v is_nothrow_convertible_v has_strong_structural_equality_v is_pointer_interconvertible_base_of_v disable_sized_sentinel_for disable_sized_range enable_borrowed_range enable_view
syntax keyword cppSTLconcept
\ range sized_range view input_range output_range forward_range bidirectional_range random_access_range contiguous_range common_range viewable_range
syntax keyword cppSTLtype
\ iterator_t sentinel_t dangling safe_iterator_t safe_subrange_t ref_view filter_view transform_view iota_view join_view empty_view single_view split_view common_view reverse_view view_interface
" span
syntax keyword cppSTLtype span
syntax keyword cppSTLconstant dynamic_extent
syntax keyword cppSTLfunction subspan
" syncstream
syntax keyword cppSTLtype
\ basic_syncbuf basic_osyncstream syncbuf wsyncbuf osyncstream wosyncstream
\ assignable_from boolean common_reference_with common_with constructible_from convertible_to copy_constructible copyable default_constructible derived_from destructible equality_comparable equality_comparable_with equivalence_relation floating_point integral invocable movable move_constructible predicate regular regular_invocable relation same_as semiregular signed_integral strict_weak_order swappable swappable_with totally_ordered totally_ordered_with unsigned_integral default_initializable range sized_range view input_range output_range forward_range bidirectional_range random_access_range contiguous_range common_range viewable_range three_way_comparable three_way_comparable_with indirectly_readable indirectly_writable weakly_incrementable incrementable input_or_output_iterator sentinel_for sized_sentinel_for input_iterator output_iterator forward_iterator bidirectional_iterator random_access_iterator contiguous_iterator indirectly_unary_invocable indirectly_regular_unary_invocable indirect_unary_predicate indirect_binary_predicate indirect_equivalence_relation indirect_strict_weak_order indirectly_movable indirectly_movable_storable indirectly_copyable indirectly_copyable_storable indirectly_swappable indirectly_comparable permutable mergeable sortable
endif
" Boost {{{1
if !exists('cpp_no_boost')
syntax keyword cppSTLnamespace boost
syntax keyword cppSTLcast lexical_cast
syntax keyword cppSTLfunction lexical_cast
endif
" }}}
@@ -421,18 +161,15 @@ endif
hi def link cppSTLbool Boolean
hi def link cppStatement Statement
hi def link cppSTLfunction Function
hi def link cppSTLfunctional Typedef
hi def link cppSTLconstant Constant
hi def link cppSTLnamespace Constant
hi def link cppSTLtype Typedef
hi def link cppSTLexception Exception
hi def link cppSTLtype Type
hi def link cppSTLexception Type
hi def link cppSTLiterator Typedef
hi def link cppSTLiterator_tag Typedef
hi def link cppSTLenum Typedef
hi def link cppSTLios Function
hi def link cppSTLcast Statement
hi def link cppSTLconcept Typedef
hi def link cppSTLVariable Identifier
hi def link cppSTLvariable Identifier
" The keywords {inline, virtual, explicit, export, override, final} are
" standard C++ keywords and NOT types!
@@ -444,7 +181,6 @@ if get(g:, 'cpp_simple_highlight', 0)
hi link cppStructure Statement
hi link cppExceptions Statement
hi link cppStorageClass Statement
hi link cppSTLexception Typedef
endif
endif

View File

@@ -82,7 +82,7 @@ syn cluster rubyNotTop add=@yardTags,@yardDirectives,@yardTypes,@yardLists,@yard
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
hi def link yardComment rubyComment
" Tags
hi def link yardGenericTag rubyTodo
hi def link yardGenericTag rubyKeyword
hi def link yardAbstract yardGenericTag
hi def link yardApi yardGenericTag
hi def link yardAttr yardGenericTag
@@ -106,7 +106,7 @@ hi def link yardYield yardGenericTag
hi def link yardYieldParam yardGenericTag
hi def link yardYieldReturn yardGenericTag
" Directives
hi def link yardGenericDirective rubyTodo
hi def link yardGenericDirective rubyKeyword
hi def link yardAttribute yardGenericDirective
hi def link yardEndGroup yardGenericDirective
hi def link yardGroup yardGenericDirective

View File

@@ -276,12 +276,14 @@ function! elixir#indent#handle_inside_block(context)
" hack - handle do: better
let block_info = searchpairpos(start_pattern, '', end_pattern, 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip() || getline(line('.')) =~ 'do:'", max([0, a:context.lnum - g:elixir_indent_max_lookbehind]))
let block_start_lnum = block_info[0]
call s:debug("block_start_lnum=" . block_start_lnum)
let block_start_col = block_info[1]
if block_start_lnum != 0 || block_start_col != 0
let block_text = getline(block_start_lnum)
let block_start_char = block_text[block_start_col - 1]
call s:debug("block_start_char=" . block_start_char)
let never_match = '\(a\)\@=b'
let never_match = ''
let config = {
\'f': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
\'c': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
@@ -293,17 +295,25 @@ function! elixir#indent#handle_inside_block(context)
\'(': {'aligned_clauses': ')', 'pattern_match_clauses': never_match}
\}
" if `with` clause...
if block_start_char == 'w'
call s:debug("testing s:handle_with")
return s:handle_with(block_start_lnum, block_start_col, a:context)
else
let block_config = config[block_start_char]
" if aligned clause (closing tag/`else` clause/etc...) then indent this
" at the same level as the block open tag (e.g. `if`/`case`/etc...)
if s:starts_with(a:context, block_config.aligned_clauses)
call s:debug("clause")
return indent(block_start_lnum)
else
let clause_lnum = searchpair(block_config.pattern_match_clauses, '', '*', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", block_start_lnum)
let relative_lnum = max([clause_lnum, block_start_lnum])
if block_config.pattern_match_clauses == never_match
let relative_lnum = block_start_lnum
else
let clause_lnum = searchpair(block_config.pattern_match_clauses, '', '*', 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip()", block_start_lnum)
call s:debug("clause_lum=" . clause_lnum)
let relative_lnum = max([clause_lnum, block_start_lnum])
end
call s:debug("pattern matching relative to lnum " . relative_lnum)
return s:do_handle_pattern_match_block(relative_lnum, a:context)
endif

View File

@@ -0,0 +1,41 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
scriptencoding utf-8
" Copyright (c) 2017-2020 Filip Szymański. All rights reserved.
" Use of this source code is governed by an MIT license that can be
" found in the LICENSE file.
function! s:template_sink(templates) abort
try
let l:lines = _fzf_gitignore_create(a:templates)
catch /^Vim(\(let\|return\)):/
return
endtry
new
setlocal filetype=gitignore
call setline(1, l:lines)
$-2,$delete _
normal! gg
endfunction
function! fzf_gitignore#run() abort
try
let l:opts = {
\ 'source': _fzf_gitignore_get_all_templates(),
\ 'sink*': function('s:template_sink'),
\ 'options': '-m --prompt="Template> " --header="gitignore.io"'
\ }
catch /^Vim(\(let\|return\)):/
return
endtry
call fzf#run(fzf#wrap(l:opts))
endfunction
" vim: ts=2 et sw=2
endif

View File

@@ -1,705 +0,0 @@
" Please do not edit this file directly, instead modify polyglot.vim or scripts/build
" Line continuation is used here, remove 'C' from 'cpoptions'
let s:cpo_save = &cpo
set cpo&vim
func! polyglot#Shebang()
if getline(1) =~# "^#!"
let ft = polyglot#ShebangFiletype()
if ft != ""
let &ft = ft
endif
endif
if &ft == ""
runtime! scripts.vim
endif
return &ft != ""
endfunc
let s:r_hashbang = '^#!\s*\(\S\+\)\s*\(.*\)\s*'
let s:r_envflag = '%(\S\+=\S\+\|-[iS]\|--ignore-environment\|--split-string\)'
let s:r_env = '^\%(\' . s:r_envflag . '\s\+\)*\(\S\+\)'
func! polyglot#ShebangFiletype()
let l:line1 = getline(1)
if l:line1 !~# "^#!"
return
endif
let l:pathrest = matchlist(l:line1, s:r_hashbang)
if len(l:pathrest) == 0
return
endif
let [_, l:path, l:rest; __] = l:pathrest
let l:script = split(l:path, "/")[-1]
if l:script == "env"
let l:argspath = matchlist(l:rest, s:r_env)
if len(l:argspath) == 0
return
endif
let l:script = l:argspath[1]
endif
if has_key(s:interpreters, l:script)
return s:interpreters[l:script]
endif
for interpreter in keys(s:interpreters)
if l:script =~# '^' . interpreter
return s:interpreters[interpreter]
endif
endfor
endfunc
let s:interpreters = {
\ 'osascript': 'applescript',
\ 'tcc': 'c',
\ 'coffee': 'coffee',
\ 'crystal': 'crystal',
\ 'dart': 'dart',
\ 'elixir': 'elixir',
\ 'escript': 'erlang',
\ 'fish': 'fish',
\ 'gnuplot': 'gnuplot',
\ 'groovy': 'groovy',
\ 'runhaskell': 'haskell',
\ 'chakra': 'javascript',
\ 'd8': 'javascript',
\ 'gjs': 'javascript',
\ 'js': 'javascript',
\ 'node': 'javascript',
\ 'nodejs': 'javascript',
\ 'qjs': 'javascript',
\ 'rhino': 'javascript',
\ 'v8': 'javascript',
\ 'v8-shell': 'javascript',
\ 'julia': 'julia',
\ 'lua': 'lua',
\ 'moon': 'moon',
\ 'ocaml': 'ocaml',
\ 'ocamlrun': 'ocaml',
\ 'ocamlscript': 'ocaml',
\ 'cperl': 'perl',
\ 'perl': 'perl',
\ 'php': 'php',
\ 'swipl': 'prolog',
\ 'yap': 'prolog',
\ 'pwsh': 'ps1',
\ 'python': 'python',
\ 'python2': 'python',
\ 'python3': 'python',
\ 'qmake': 'qmake',
\ 'Rscript': 'r',
\ 'racket': 'racket',
\ 'perl6': 'raku',
\ 'raku': 'raku',
\ 'rakudo': 'raku',
\ 'ruby': 'ruby',
\ 'macruby': 'ruby',
\ 'rake': 'ruby',
\ 'jruby': 'ruby',
\ 'rbx': 'ruby',
\ 'scala': 'scala',
\ 'ash': 'sh',
\ 'bash': 'sh',
\ 'dash': 'sh',
\ 'ksh': 'sh',
\ 'mksh': 'sh',
\ 'pdksh': 'sh',
\ 'rc': 'sh',
\ 'sh': 'sh',
\ 'zsh': 'sh',
\ 'boolector': 'smt2',
\ 'cvc4': 'smt2',
\ 'mathsat5': 'smt2',
\ 'opensmt': 'smt2',
\ 'smtinterpol': 'smt2',
\ 'smt-rat': 'smt2',
\ 'stp': 'smt2',
\ 'verit': 'smt2',
\ 'yices2': 'smt2',
\ 'z3': 'smt2',
\ 'deno': 'typescript',
\ 'ts-node': 'typescript',
\ }
func! polyglot#DetectInpFiletype()
let line = getline(nextnonblank(1))
if line =~# '^\*'
set ft=abaqus | return
endif
for lnum in range(1, min([line("$"), 500]))
let line = getline(lnum)
if line =~? '^header surface data'
set ft=trasys | return
endif
endfor
endfunc
func! polyglot#DetectAsaFiletype()
if exists("g:filetype_asa")
let &ft = g:filetype_asa | return
endif
set ft=aspvbs | return
endfunc
func! polyglot#DetectAspFiletype()
if exists("g:filetype_asp")
let &ft = g:filetype_asp | return
endif
for lnum in range(1, min([line("$"), 3]))
let line = getline(lnum)
if line =~? 'perlscript'
set ft=aspperl | return
endif
endfor
set ft=aspvbs | return
endfunc
func! polyglot#DetectHFiletype()
for lnum in range(1, min([line("$"), 200]))
let line = getline(lnum)
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
if exists("g:c_syntax_for_h")
set ft=objc | return
endif
set ft=objcpp | return
endif
endfor
if exists("g:c_syntax_for_h")
set ft=c | return
endif
if exists("g:ch_syntax_for_h")
set ft=ch | return
endif
set ft=cpp | return
endfunc
func! polyglot#DetectMFiletype()
let saw_comment = 0
for lnum in range(1, min([line("$"), 100]))
let line = getline(lnum)
if line =~# '^\s*/\*'
let saw_comment = 1
endif
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
set ft=objc | return
endif
if line =~# '^\s*%'
set ft=octave | return
endif
if line =~# '^\s*(\*'
set ft=mma | return
endif
if line =~? '^\s*\(\(type\|var\)\(\<\|\>\)\|--\)'
set ft=murphi | return
endif
endfor
if saw_comment
set ft=objc | return
endif
if exists("g:filetype_m")
let &ft = g:filetype_m | return
endif
set ft=octave | return
endfunc
func! polyglot#DetectFsFiletype()
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\(: \|new-device\)'
set ft=forth | return
endif
if line =~# '^\s*\(#light\|import\|let\|module\|namespace\|open\|type\)'
set ft=fsharp | return
endif
if line =~# '\s*\(#version\|precision\|uniform\|varying\|vec[234]\)'
set ft=glsl | return
endif
endfor
if exists("g:filetype_fs")
let &ft = g:filetype_fs | return
endif
set ft=forth | return
endfunc
func! polyglot#DetectReFiletype()
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\s*#\%(\%(if\|ifdef\|define\|pragma\)\s\+\w\|\s*include\s\+[<"]\|template\s*<\)'
set ft=cpp | return
endif
set ft=reason | return
endfor
endfunc
func! polyglot#DetectIdrFiletype()
for lnum in range(1, min([line("$"), 5]))
let line = getline(lnum)
if line =~# '^\s*--.*[Ii]dris \=1'
set ft=idris | return
endif
if line =~# '^\s*--.*[Ii]dris \=2'
set ft=idris2 | return
endif
endfor
for lnum in range(1, min([line("$"), 30]))
let line = getline(lnum)
if line =~# '^pkgs =.*'
set ft=idris | return
endif
if line =~# '^depends =.*'
set ft=idris2 | return
endif
if line =~# '^%language \(TypeProviders\|ElabReflection\)'
set ft=idris | return
endif
if line =~# '^%language PostfixProjections'
set ft=idris2 | return
endif
if line =~# '^%access .*'
set ft=idris | return
endif
endfor
if exists("g:filetype_idr")
let &ft = g:filetype_idr | return
endif
set ft=idris2 | return
endfunc
func! polyglot#DetectLidrFiletype()
for lnum in range(1, min([line("$"), 200]))
let line = getline(lnum)
if line =~# '^>\s*--.*[Ii]dris \=1'
set ft=lidris | return
endif
endfor
set ft=lidris2 | return
endfunc
func! polyglot#DetectBasFiletype()
for lnum in range(1, min([line("$"), 5]))
let line = getline(lnum)
if line =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
set ft=vb | return
endif
endfor
set ft=basic | return
endfunc
func! polyglot#DetectPmFiletype()
let line = getline(nextnonblank(1))
if line =~# 'XPM2'
set ft=xpm2 | return
endif
if line =~# 'XPM'
set ft=xpm | return
endif
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
set ft=raku | return
endif
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
set ft=perl | return
endif
endfor
if exists("g:filetype_pm")
let &ft = g:filetype_pm | return
endif
set ft=perl | return
endfunc
func! polyglot#DetectPlFiletype()
let line = getline(nextnonblank(1))
if line =~# '^[^#]*:-' || line =~# '^\s*\%(%\|/\*\)' || line =~# '\.\s*$'
set ft=prolog | return
endif
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
set ft=raku | return
endif
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
set ft=perl | return
endif
endfor
if exists("g:filetype_pl")
let &ft = g:filetype_pl | return
endif
set ft=perl | return
endfunc
func! polyglot#DetectTFiletype()
for lnum in range(1, min([line("$"), 5]))
let line = getline(lnum)
if line =~# '^\.'
set ft=nroff | return
endif
endfor
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
set ft=raku | return
endif
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
set ft=perl | return
endif
endfor
if exists("g:filetype_t")
let &ft = g:filetype_t | return
endif
set ft=perl | return
endfunc
func! polyglot#DetectTt2Filetype()
for lnum in range(1, min([line("$"), 3]))
let line = getline(lnum)
if line =~? '<\%(!DOCTYPE HTML\|[%?]\|html\)'
set ft=tt2html | return
endif
endfor
set ft=tt2 | return
endfunc
func! polyglot#DetectHtmlFiletype()
let line = getline(nextnonblank(1))
if line =~# '^\(%\|<[%&].*>\)'
set ft=mason | return
endif
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '{{.*}}\|{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\(\<\|\>\)\|{#\s\+'
set ft=htmldjango | return
endif
if line =~# '\(\<\|\>\)DTD\s\+XHTML\s'
set ft=xhtml | return
endif
endfor
set ft=html | au! BufWritePost <buffer> ++once call polyglot#DetectHtmlFiletype()
return
endfunc
" Restore 'cpoptions'
let &cpo = s:cpo_save
unlet s:cpo_save
""" ftdetect/polyglot.vim
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
" Disable all native vim ftdetect
if exists('g:polyglot_test')
autocmd!
endif
func! polyglot#Observe(fn)
let b:polyglot_observe = a:fn
augroup polyglot-observer
au! CursorHold,CursorHoldI,BufWritePost <buffer>
\ execute('if polyglot#' . b:polyglot_observe . '() | au! polyglot-observer | endif')
augroup END
endfunc
let s:disabled_packages = {}
let s:new_polyglot_disabled = []
if exists('g:polyglot_disabled')
for pkg in g:polyglot_disabled
let base = split(pkg, '\.')
if len(base) > 0
let s:disabled_packages[pkg] = 1
call add(s:new_polyglot_disabled, base[0])
endif
endfor
else
let g:polyglot_disabled_not_set = 1
endif
function! s:SetDefault(name, value)
if !exists(a:name)
let {a:name} = a:value
endif
endfunction
call s:SetDefault('g:markdown_enable_spell_checking', 0)
call s:SetDefault('g:markdown_enable_input_abbreviations', 0)
call s:SetDefault('g:markdown_enable_mappings', 0)
" Enable jsx syntax by default
call s:SetDefault('g:jsx_ext_required', 0)
" Needed for sql highlighting
call s:SetDefault('g:javascript_sql_dialect', 'sql')
" Make csv loading faster
call s:SetDefault('g:csv_start', 1)
call s:SetDefault('g:csv_end', 2)
" Disable json concealing by default
call s:SetDefault('g:vim_json_syntax_conceal', 0)
call s:SetDefault('g:filetype_euphoria', 'elixir')
if !exists('g:python_highlight_all')
call s:SetDefault('g:python_highlight_builtins', 1)
call s:SetDefault('g:python_highlight_builtin_objs', 1)
call s:SetDefault('g:python_highlight_builtin_types', 1)
call s:SetDefault('g:python_highlight_builtin_funcs', 1)
call s:SetDefault('g:python_highlight_builtin_funcs_kwarg', 1)
call s:SetDefault('g:python_highlight_exceptions', 1)
call s:SetDefault('g:python_highlight_string_formatting', 1)
call s:SetDefault('g:python_highlight_string_format', 1)
call s:SetDefault('g:python_highlight_string_templates', 1)
call s:SetDefault('g:python_highlight_indent_errors', 1)
call s:SetDefault('g:python_highlight_space_errors', 1)
call s:SetDefault('g:python_highlight_doctests', 1)
call s:SetDefault('g:python_highlight_func_calls', 1)
call s:SetDefault('g:python_highlight_class_vars', 1)
call s:SetDefault('g:python_highlight_operators', 1)
call s:SetDefault('g:python_highlight_file_headers_as_comments', 1)
call s:SetDefault('g:python_slow_sync', 1)
endif
" We need it because scripts.vim in vim uses "set ft=" which cannot be
" overridden with setf (and we can't use set ft= so our scripts.vim work)
func! s:Setf(ft)
if &filetype !~# '\<'.a:ft.'\>'
let &filetype = a:ft
endif
endfunc
" Function used for patterns that end in a star: don't set the filetype if the
" file name matches ft_ignore_pat.
" When using this, the entry should probably be further down below with the
" other StarSetf() calls.
func! s:StarSetf(ft)
if expand("<amatch>") !~ g:ft_ignore_pat && &filetype !~# '\<'.a:ft.'\>'
let &filetype = a:ft
endif
endfunc
augroup filetypedetect
" scripts/build inserts here filetype detection autocommands
au! BufNewFile,BufRead,StdinReadPost * if expand("<afile>") !~ g:ft_ignore_pat |
\ call polyglot#Shebang() | endif
au BufEnter * if &ft == "" && expand("<afile>") !~ g:ft_ignore_pat |
\ call polyglot#Observe('Shebang') | endif
augroup END
if !has_key(s:disabled_packages, 'autoindent')
" Code below re-implements sleuth for vim-polyglot
let g:loaded_sleuth = 1
let g:loaded_foobar = 1
" Makes shiftwidth to be synchronized with tabstop by default
if &shiftwidth == &tabstop
let &shiftwidth = 0
endif
function! s:guess(lines) abort
let options = {}
let ccomment = 0
let podcomment = 0
let triplequote = 0
let backtick = 0
let xmlcomment = 0
let heredoc = ''
let minindent = 10
let spaces_minus_tabs = 0
let i = 0
for line in a:lines
let i += 1
if !len(line) || line =~# '^\W*$'
continue
endif
if line =~# '^\s*/\*'
let ccomment = 1
endif
if ccomment
if line =~# '\*/'
let ccomment = 0
endif
continue
endif
if line =~# '^=\w'
let podcomment = 1
endif
if podcomment
if line =~# '^=\%(end\|cut\)\>'
let podcomment = 0
endif
continue
endif
if triplequote
if line =~# '^[^"]*"""[^"]*$'
let triplequote = 0
endif
continue
elseif line =~# '^[^"]*"""[^"]*$'
let triplequote = 1
endif
if backtick
if line =~# '^[^`]*`[^`]*$'
let backtick = 0
endif
continue
elseif &filetype ==# 'go' && line =~# '^[^`]*`[^`]*$'
let backtick = 1
endif
if line =~# '^\s*<\!--'
let xmlcomment = 1
endif
if xmlcomment
if line =~# '-->'
let xmlcomment = 0
endif
continue
endif
" This is correct order because both "<<EOF" and "EOF" matches end
if heredoc != ''
if line =~# heredoc
let heredoc = ''
endif
continue
endif
let herematch = matchlist(line, '\C<<\W*\([A-Z]\+\)\s*$')
if len(herematch) > 0
let heredoc = herematch[1] . '$'
endif
let spaces_minus_tabs += line[0] == "\t" ? 1 : -1
if line[0] == "\t"
setlocal noexpandtab
let &shiftwidth=&tabstop
let b:sleuth_culprit .= ':' . i
return 1
elseif line[0] == " "
let indent = len(matchstr(line, '^ *'))
if (indent % 2 == 0 || indent % 3 == 0) && indent < minindent
let minindent = indent
endif
endif
endfor
if minindent < 10
setlocal expandtab
let &shiftwidth=minindent
let b:sleuth_culprit .= ':' . i
return 1
endif
return 0
endfunction
function! s:detect_indent() abort
if &buftype ==# 'help'
return
endif
let b:sleuth_culprit = expand("<afile>:p")
if s:guess(getline(1, 32))
return
endif
let pattern = sleuth#GlobForFiletype(&filetype)
if len(pattern) == 0
return
endif
let pattern = '{' . pattern . ',.git,.svn,.hg}'
let dir = expand('%:p:h')
let level = 3
while isdirectory(dir) && dir !=# fnamemodify(dir, ':h') && level > 0
" Ignore files from homedir and root
if dir == expand('~') || dir == '/'
unlet b:sleuth_culprit
return
endif
for neighbor in glob(dir . '/' . pattern, 0, 1)[0:level]
let b:sleuth_culprit = neighbor
" Do not consider directories above .git, .svn or .hg
if fnamemodify(neighbor, ":h:t")[0] == "."
let level = 0
continue
endif
if neighbor !=# expand('%:p') && filereadable(neighbor)
if s:guess(readfile(neighbor, '', 32))
return
endif
endif
endfor
let dir = fnamemodify(dir, ':h')
let level -= 1
endwhile
unlet b:sleuth_culprit
endfunction
setglobal smarttab
function! SleuthIndicator() abort
let sw = &shiftwidth ? &shiftwidth : &tabstop
if &expandtab
return 'sw='.sw
elseif &tabstop == sw
return 'ts='.&tabstop
else
return 'sw='.sw.',ts='.&tabstop
endif
endfunction
augroup polyglot-sleuth
au!
au FileType * call s:detect_indent()
au User Flags call Hoist('buffer', 5, 'SleuthIndicator')
augroup END
command! -bar -bang Sleuth call s:detect_indent()
endif
func! s:verify()
if exists("g:polyglot_disabled_not_set")
if exists("g:polyglot_disabled")
echohl WarningMsg
echo "vim-polyglot: g:polyglot_disabled should be defined before loading vim-polyglot"
echohl None
endif
unlet g:polyglot_disabled_not_set
endif
endfunc
au VimEnter * call s:verify()
" Save polyglot_disabled without postfixes
if exists('g:polyglot_disabled')
let g:polyglot_disabled = s:new_polyglot_disabled
endif
" restore Vi compatibility settings
let &cpo = s:cpo_save

View File

@@ -0,0 +1,264 @@
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
func! polyglot#detect#Inp()
let line = getline(nextnonblank(1))
if line =~# '^\*'
set ft=abaqus | return
endif
for lnum in range(1, min([line("$"), 500]))
let line = getline(lnum)
if line =~? '^header surface data'
set ft=trasys | return
endif
endfor
endfunc
func! polyglot#detect#Asa()
if exists("g:filetype_asa")
let &ft = g:filetype_asa | return
endif
set ft=aspvbs | return
endfunc
func! polyglot#detect#Asp()
if exists("g:filetype_asp")
let &ft = g:filetype_asp | return
endif
for lnum in range(1, min([line("$"), 3]))
let line = getline(lnum)
if line =~? 'perlscript'
set ft=aspperl | return
endif
endfor
set ft=aspvbs | return
endfunc
func! polyglot#detect#H()
for lnum in range(1, min([line("$"), 200]))
let line = getline(lnum)
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
if exists("g:c_syntax_for_h")
set ft=objc | return
endif
set ft=objcpp | return
endif
endfor
if exists("g:c_syntax_for_h")
set ft=c | return
endif
if exists("g:ch_syntax_for_h")
set ft=ch | return
endif
set ft=cpp | return
endfunc
func! polyglot#detect#M()
let saw_comment = 0
for lnum in range(1, min([line("$"), 100]))
let line = getline(lnum)
if line =~# '^\s*/\*'
let saw_comment = 1
endif
if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)'
set ft=objc | return
endif
if line =~# '^\s*%'
set ft=octave | return
endif
if line =~# '^\s*(\*'
set ft=mma | return
endif
if line =~? '^\s*\(\(type\|var\)\(\<\|\>\)\|--\)'
set ft=murphi | return
endif
endfor
if saw_comment
set ft=objc | return
endif
if exists("g:filetype_m")
let &ft = g:filetype_m | return
endif
set ft=octave | return
endfunc
func! polyglot#detect#Fs()
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\(: \|new-device\)'
set ft=forth | return
endif
if line =~# '^\s*\(#light\|import\|let\|module\|namespace\|open\|type\)'
set ft=fsharp | return
endif
if line =~# '\s*\(#version\|precision\|uniform\|varying\|vec[234]\)'
set ft=glsl | return
endif
endfor
if exists("g:filetype_fs")
let &ft = g:filetype_fs | return
endif
set ft=forth | return
endfunc
func! polyglot#detect#Re()
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\s*#\%(\%(if\|ifdef\|define\|pragma\)\s\+\w\|\s*include\s\+[<"]\|template\s*<\)'
set ft=cpp | return
endif
set ft=reason | return
endfor
endfunc
func! polyglot#detect#Idr()
for lnum in range(1, min([line("$"), 5]))
let line = getline(lnum)
if line =~# '^\s*--.*[Ii]dris \=1'
set ft=idris | return
endif
if line =~# '^\s*--.*[Ii]dris \=2'
set ft=idris2 | return
endif
endfor
for lnum in range(1, min([line("$"), 30]))
let line = getline(lnum)
if line =~# '^pkgs =.*'
set ft=idris | return
endif
if line =~# '^depends =.*'
set ft=idris2 | return
endif
if line =~# '^%language \(TypeProviders\|ElabReflection\)'
set ft=idris | return
endif
if line =~# '^%language PostfixProjections'
set ft=idris2 | return
endif
if line =~# '^%access .*'
set ft=idris | return
endif
endfor
if exists("g:filetype_idr")
let &ft = g:filetype_idr | return
endif
set ft=idris2 | return
endfunc
func! polyglot#detect#Lidr()
for lnum in range(1, min([line("$"), 200]))
let line = getline(lnum)
if line =~# '^>\s*--.*[Ii]dris \=1'
set ft=lidris | return
endif
endfor
set ft=lidris2 | return
endfunc
func! polyglot#detect#Bas()
for lnum in range(1, min([line("$"), 5]))
let line = getline(lnum)
if line =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
set ft=vb | return
endif
endfor
set ft=basic | return
endfunc
func! polyglot#detect#Pm()
let line = getline(nextnonblank(1))
if line =~# 'XPM2'
set ft=xpm2 | return
endif
if line =~# 'XPM'
set ft=xpm | return
endif
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
set ft=raku | return
endif
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
set ft=perl | return
endif
endfor
if exists("g:filetype_pm")
let &ft = g:filetype_pm | return
endif
if polyglot#shebang#Detect() | return | endif
set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#Pm()
return
endfunc
func! polyglot#detect#Pl()
let line = getline(nextnonblank(1))
if line =~# '^[^#]*:-' || line =~# '^\s*\%(%\|/\*\)' || line =~# '\.\s*$'
set ft=prolog | return
endif
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
set ft=raku | return
endif
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
set ft=perl | return
endif
endfor
if exists("g:filetype_pl")
let &ft = g:filetype_pl | return
endif
if polyglot#shebang#Detect() | return | endif
set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#Pl()
return
endfunc
func! polyglot#detect#T()
for lnum in range(1, min([line("$"), 5]))
let line = getline(lnum)
if line =~# '^\.'
set ft=nroff | return
endif
endfor
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '^\s*\%(use\s\+v6\(\<\|\>\)\|\(\<\|\>\)module\(\<\|\>\)\|\(\<\|\>\)\%(my\s\+\)\=class\(\<\|\>\)\)'
set ft=raku | return
endif
if line =~# '\(\<\|\>\)use\s\+\%(strict\(\<\|\>\)\|v\=5\.\)'
set ft=perl | return
endif
endfor
if exists("g:filetype_t")
let &ft = g:filetype_t | return
endif
if polyglot#shebang#Detect() | return | endif
set ft=perl | au BufWritePost <buffer> ++once call polyglot#detect#T()
return
endfunc
func! polyglot#detect#Tt2()
for lnum in range(1, min([line("$"), 3]))
let line = getline(lnum)
if line =~? '<\%(!DOCTYPE HTML\|[%?]\|html\)'
set ft=tt2html | return
endif
endfor
set ft=tt2 | return
endfunc
func! polyglot#detect#Html()
let line = getline(nextnonblank(1))
if line =~# '^\(%\|<[%&].*>\)'
set ft=mason | return
endif
for lnum in range(1, min([line("$"), 50]))
let line = getline(lnum)
if line =~# '{%-\=\s*\(end.*\|extends\|block\|macro\|set\|if\|for\|include\|trans\)\(\<\|\>\)\|{#\s\+'
set ft=htmldjango | return
endif
if line =~# '\(\<\|\>\)DTD\s\+XHTML\s'
set ft=xhtml | return
endif
endfor
set ft=html | au BufWritePost <buffer> ++once call polyglot#detect#Html()
return
endfunc

View File

@@ -0,0 +1,133 @@
func! polyglot#shebang#Detect()
let ft = s:Filetype()
if ft != ""
let &ft = ft
endif
if &ft == ""
runtime! scripts.vim
endif
return &ft != ""
endfunc
let s:r_hashbang = '^#!\s*\(\S\+\)\s*\(.*\)\s*'
let s:r_envflag = '%(\S\+=\S\+\|-[iS]\|--ignore-environment\|--split-string\)'
let s:r_env = '^\%(\' . s:r_envflag . '\s\+\)*\(\S\+\)'
func! s:Filetype()
let l:line1 = getline(1)
if l:line1 !~# "^#!"
return
endif
let l:pathrest = matchlist(l:line1, s:r_hashbang)
if len(l:pathrest) == 0
return
endif
let [_, l:path, l:rest; __] = l:pathrest
let l:pathparts = split(l:path, "/")
if len(l:pathparts) == 0
return
endif
let l:script = l:pathparts[-1]
if l:script == "env"
let l:argspath = matchlist(l:rest, s:r_env)
if len(l:argspath) == 0
return
endif
let l:script = l:argspath[1]
endif
if has_key(s:interpreters, l:script)
return s:interpreters[l:script]
endif
for interpreter in keys(s:interpreters)
if l:script =~# '^' . interpreter
return s:interpreters[interpreter]
endif
endfor
endfunc
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
let s:interpreters = {
\ 'osascript': 'applescript',
\ 'tcc': 'c',
\ 'coffee': 'coffee',
\ 'crystal': 'crystal',
\ 'dart': 'dart',
\ 'elixir': 'elixir',
\ 'escript': 'erlang',
\ 'fish': 'fish',
\ 'gnuplot': 'gnuplot',
\ 'groovy': 'groovy',
\ 'runhaskell': 'haskell',
\ 'chakra': 'javascript',
\ 'd8': 'javascript',
\ 'gjs': 'javascript',
\ 'js': 'javascript',
\ 'node': 'javascript',
\ 'nodejs': 'javascript',
\ 'qjs': 'javascript',
\ 'rhino': 'javascript',
\ 'v8': 'javascript',
\ 'v8-shell': 'javascript',
\ 'julia': 'julia',
\ 'lua': 'lua',
\ 'moon': 'moon',
\ 'ocaml': 'ocaml',
\ 'ocamlrun': 'ocaml',
\ 'ocamlscript': 'ocaml',
\ 'cperl': 'perl',
\ 'perl': 'perl',
\ 'php': 'php',
\ 'swipl': 'prolog',
\ 'yap': 'prolog',
\ 'pwsh': 'ps1',
\ 'python': 'python',
\ 'python2': 'python',
\ 'python3': 'python',
\ 'qmake': 'qmake',
\ 'Rscript': 'r',
\ 'racket': 'racket',
\ 'perl6': 'raku',
\ 'raku': 'raku',
\ 'rakudo': 'raku',
\ 'ruby': 'ruby',
\ 'macruby': 'ruby',
\ 'rake': 'ruby',
\ 'jruby': 'ruby',
\ 'rbx': 'ruby',
\ 'scala': 'scala',
\ 'ash': 'sh',
\ 'bash': 'sh',
\ 'dash': 'sh',
\ 'ksh': 'sh',
\ 'mksh': 'sh',
\ 'pdksh': 'sh',
\ 'rc': 'sh',
\ 'sh': 'sh',
\ 'zsh': 'sh',
\ 'boolector': 'smt2',
\ 'cvc4': 'smt2',
\ 'mathsat5': 'smt2',
\ 'opensmt': 'smt2',
\ 'smtinterpol': 'smt2',
\ 'smt-rat': 'smt2',
\ 'stp': 'smt2',
\ 'verit': 'smt2',
\ 'yices2': 'smt2',
\ 'z3': 'smt2',
\ 'deno': 'typescript',
\ 'ts-node': 'typescript',
\ }

View File

@@ -1,8 +1,10 @@
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
let s:globs = {
\ '8th': '*.8th',
\ 'Dockerfile': '*.dockerfile,*.dock,*.Dockerfile,Dockerfile,dockerfile,Dockerfile*',
\ 'Jenkinsfile': '*.jenkinsfile,*.Jenkinsfile,Jenkinsfile,Jenkinsfile*',
\ 'a2ps': 'a2psrc',
\ 'a2ps': 'a2psrc,.a2psrc',
\ 'a65': '*.a65',
\ 'aap': '*.aap',
\ 'abap': '*.abap',
@@ -13,15 +15,15 @@ let s:globs = {
\ 'ada': '*.adb,*.ads,*.ada,*.adc,*.gpr,*.ada_m',
\ 'ahdl': '*.tdf',
\ 'aidl': '*.aidl',
\ 'alsaconf': '',
\ 'alsaconf': '.asoundrc',
\ 'aml': '*.aml',
\ 'ampl': '*.run',
\ 'ant': 'build.xml',
\ 'apache': 'access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf*',
\ 'apache': '.htaccess,access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf*',
\ 'apiblueprint': '*.apib',
\ 'applescript': '*.applescript,*.scpt',
\ 'aptconf': 'apt.conf',
\ 'arch': '=tagging-method',
\ 'arch': '.arch-inventory,=tagging-method',
\ 'arduino': '*.pde,*.ino',
\ 'art': '*.art',
\ 'asciidoc': '*.asciidoc,*.adoc,*.asc',
@@ -45,6 +47,7 @@ let s:globs = {
\ 'clojure': '*.clj,*.boot,*.cl2,*.cljc,*.cljs,*.cljs.hl,*.cljscm,*.cljx,*.hic,*.edn,riemann.config,build.boot,profile.boot',
\ 'cmake': '*.cmake,*.cmake.in,CMakeLists.txt',
\ 'coffee': '*.coffee,*._coffee,*.cake,*.cjsx,*.iced,*.coffeekup,Cakefile',
\ 'conf': '*.conf,auto.master,config',
\ 'cpp': '*.cpp,*.c++,*.cc,*.cp,*.cxx,*.h,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.tcc,*.tpp,*.moc,*.tlh',
\ 'cql': '*.cql',
\ 'cryptol': '*.cry,*.cyl,*.lcry,*.lcyl',
@@ -58,7 +61,7 @@ let s:globs = {
\ 'dd': '*.dd',
\ 'ddoc': '*.ddoc',
\ 'dhall': '*.dhall',
\ 'dosini': '*.wrap,*.ini,*.dof,*.lektorproject,*.prefs,*.pro,*.properties,buildozer.spec,php.ini-*',
\ 'dosini': '*.wrap,*.ini,*.dof,*.lektorproject,*.prefs,*.pro,*.properties,buildozer.spec,.editorconfig,.npmrc,php.ini-*',
\ 'dsdl': '*.sdl',
\ 'dune': 'jbuild,dune,dune-project,dune-workspace',
\ 'ecrystal': '*.ecr',
@@ -80,9 +83,10 @@ let s:globs = {
\ 'fsharp': '*.fs,*.fsi,*.fsx',
\ 'gdscript3': '*.gd',
\ 'gitcommit': 'COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG',
\ 'gitconfig': '*.gitconfig',
\ 'gitconfig': '*.gitconfig,.gitconfig,.gitmodules',
\ 'gitignore': '.gitignore',
\ 'gitrebase': 'git-rebase-todo',
\ 'gitsendemail': '',
\ 'gitsendemail': '.gitsendemail.*',
\ 'glsl': '*.glsl,*.fp,*.frag,*.frg,*.fs,*.fsh,*.fshader,*.geo,*.geom,*.glslf,*.glslv,*.gs,*.gshader,*.shader,*.tesc,*.tese,*.vert,*.vrx,*.vsh,*.vshader,*.comp',
\ 'gmpl': '*.mod',
\ 'gnuplot': '*.gp,*.gnu,*.gnuplot,*.p,*.plot,*.plt,*.gpi',
@@ -93,7 +97,7 @@ let s:globs = {
\ 'groovy': '*.groovy,*.grt,*.gtpl,*.gvy,*.gradle,Jenkinsfile',
\ 'grub': '',
\ 'haml': '*.haml,*.haml.deface,*.hamlc,*.hamlbars',
\ 'haproxy': '*.cfg,haproxy.cfg,haproxy*.c*',
\ 'haproxy': '*.cfg,haproxy.cfg,haproxy*.conf*',
\ 'haskell': '*.hs,*.hs-boot,*.hsc,*.bpk,*.hsig',
\ 'haxe': '*.hx,*.hxsl',
\ 'hcl': '*.hcl,*.nomad,*.workflow,Appfile',
@@ -105,15 +109,15 @@ let s:globs = {
\ 'html.mustache': '*.mustache,*.hogan,*.hulk,*.hjs',
\ 'html.twig': '*.twig',
\ 'htmldjango': '*.jinja,*.j2,*.jinja2,*.njk',
\ 'i3config': '*.i3.config,*.i3config,i3.config,i3config',
\ 'i3config': '*.i3.config,*.i3config,i3.config,i3config,.i3.config,.i3config',
\ 'icalendar': '*.ics',
\ 'idris': '*.idr,*.lidr,idris-response',
\ 'idris2': '*.idr,*.ipkg,idris-response',
\ 'ion': '*.ion',
\ 'javascript': '*.js,*._js,*.bones,*.cjs,*.es,*.es6,*.frag,*.gs,*.jake,*.jsb,*.jscad,*.jsfl,*.jsm,*.jss,*.mjs,*.njs,*.pac,*.sjs,*.ssjs,*.xsjs,*.xsjslib,Jakefile',
\ 'javascript': '*.js,*._js,*.bones,*.cjs,*.es,*.es6,*.frag,*.gs,*.jake,*.jsb,*.jscad,*.jsfl,*.jsm,*.jss,*.mjs,*.njs,*.pac,*.sjs,*.ssjs,*.xsjs,*.xsjslib,*.javascript,Jakefile',
\ 'javascriptreact': '*.jsx',
\ 'jq': '*.jq',
\ 'json': '*.json,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,composer.lock,mcmod.info,Pipfile.lock',
\ 'jq': '*.jq,.jqrc,.jqrc*',
\ 'json': '*.json,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,.arcconfig,.htmlhintrc,.tern-config,.tern-project,.watchmanconfig,composer.lock,mcmod.info,Pipfile.lock',
\ 'json5': '*.json5',
\ 'jsonnet': '*.jsonnet,*.libsonnet',
\ 'jst': '*.ejs,*.ect,*.jst',
@@ -127,7 +131,7 @@ let s:globs = {
\ 'livescript': '*.ls,*._ls,Slakefile',
\ 'llvm': '*.ll',
\ 'log': '*.log,*.LOG,*_log,*_LOG',
\ 'lua': '*.lua,*.fcgi,*.nse,*.p8,*.pd_lua,*.rbxs,*.rockspec,*.wlua',
\ 'lua': '*.lua,*.fcgi,*.nse,*.p8,*.pd_lua,*.rbxs,*.rockspec,*.wlua,.luacheckrc',
\ 'm4': '*.m4,*.at',
\ 'mako': '*.mako,*.mao',
\ 'markdown': '*.md,*.markdown,*.mdown,*.mdwn,*.mkd,*.mkdn,*.mkdown,*.ronn,*.workbook,contents.lr',
@@ -142,7 +146,7 @@ let s:globs = {
\ 'nix': '*.nix',
\ 'oasis': '_oasis',
\ 'objc': '*.m,*.h',
\ 'ocaml': '*.ml,*.eliom,*.eliomi,*.ml4,*.mli,*.mll,*.mly,*.mlt,*.mlp,*.mlip,*.mli.cppo,*.ml.cppo',
\ 'ocaml': '*.ml,*.eliom,*.eliomi,*.ml4,*.mli,*.mll,*.mly,*.mlt,*.mlp,*.mlip,*.mli.cppo,*.ml.cppo,.ocamlinit',
\ 'ocamlbuild_tags': '_tags',
\ 'ocpbuild': '*.ocp',
\ 'ocpbuildroot': '*.root',
@@ -151,22 +155,22 @@ let s:globs = {
\ 'omake': '*.om,OMakefile,OMakeroot,OMakeroot.in',
\ 'opam': '*.opam,*.opam.template,opam',
\ 'opencl': '*.cl,*.opencl',
\ 'perl': '*.pl,*.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.pm,*.psgi,*.t,Makefile.PL,Rexfile,ack,cpanfile',
\ 'php': '*.php,*.aw,*.ctp,*.fcgi,*.inc,*.php3,*.php4,*.php5,*.phps,*.phpt,Phakefile',
\ 'perl': '*.pl,*.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.pm,*.psgi,*.t,Makefile.PL,Rexfile,ack,cpanfile,example.gitolite.rc,.gitolite.rc',
\ 'php': '*.php,*.aw,*.ctp,*.fcgi,*.inc,*.php3,*.php4,*.php5,*.phps,*.phpt,*.phtml,.php,.php_cs,.php_cs.dist,Phakefile',
\ 'plantuml': '*.puml,*.iuml,*.plantuml,*.uml,*.pu',
\ 'pod': '*.pod',
\ 'pony': '*.pony',
\ 'prolog': '*.pl,*.pro,*.prolog,*.yap',
\ 'prolog': '*.pl,*.pro,*.prolog,*.yap,*.pdb',
\ 'proto': '*.proto',
\ 'ps1': '*.ps1,*.psd1,*.psm1,*.pssc',
\ 'ps1xml': '*.ps1xml',
\ 'pug': '*.jade,*.pug',
\ 'puppet': '*.pp,Modulefile',
\ 'purescript': '*.purs',
\ 'python': '*.py,*.cgi,*.fcgi,*.gyp,*.gypi,*.lmi,*.py3,*.pyde,*.pyi,*.pyp,*.pyt,*.pyw,*.rpy,*.smk,*.spec,*.tac,*.wsgi,*.xpy,DEPS,SConscript,SConstruct,Snakefile,wscript',
\ 'python': '*.py,*.cgi,*.fcgi,*.gyp,*.gypi,*.lmi,*.py3,*.pyde,*.pyi,*.pyp,*.pyt,*.pyw,*.rpy,*.smk,*.spec,*.tac,*.wsgi,*.xpy,*.ptl,.gclient,DEPS,SConscript,SConstruct,Snakefile,wscript,.pythonrc,.pythonstartup',
\ 'qmake': '*.pro,*.pri',
\ 'qml': '*.qml,*.qbs',
\ 'r': '*.r,*.rsx,*.s,*.S,expr-dist',
\ 'r': '*.r,*.rsx,*.s,*.S,.Rprofile,expr-dist',
\ 'racket': '*.rkt,*.rktd,*.rktl,*.scrbl',
\ 'ragel': '*.rl',
\ 'raku': '*.6pl,*.6pm,*.nqp,*.p6,*.p6l,*.p6m,*.pl,*.pl6,*.pm,*.pm6,*.t,*.rakudoc,*.rakutest,*.raku,*.rakumod,*.pod6,*.t6',
@@ -176,30 +180,30 @@ let s:globs = {
\ 'requirements': '*.pip,*requirements.{txt,in},*require.{txt,in},constraints.{txt,in}',
\ 'rhelp': '*.rd',
\ 'rst': '*.rst,*.rest,*.rest.txt,*.rst.txt',
\ 'ruby': '*.rb,*.builder,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.pluginspec,*.podspec,*.rabl,*.rake,*.rbi,*.rbuild,*.rbw,*.rbx,*.ru,*.ruby,*.spec,*.thor,*.watchr,*.rxml,*.rjs,*.rant,*.axlsx,*.cap,*.opal,Appraisals,Berksfile,Buildfile,Capfile,Dangerfile,Deliverfile,Fastfile,Gemfile,Gemfile.lock,Guardfile,Jarfile,Mavenfile,Podfile,Puppetfile,Rakefile,Snapfile,Thorfile,Vagrantfile,buildfile,Rantfile,Cheffile,KitchenSink,Routefile,vagrantfile,[Rr]akefile*,*_spec.rb',
\ 'ruby': '*.rb,*.builder,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.pluginspec,*.podspec,*.rabl,*.rake,*.rbi,*.rbuild,*.rbw,*.rbx,*.ru,*.ruby,*.spec,*.thor,*.watchr,*.rxml,*.rjs,*.rant,*.axlsx,*.cap,*.opal,.irbrc,.pryrc,.simplecov,Appraisals,Berksfile,Buildfile,Capfile,Dangerfile,Deliverfile,Fastfile,Gemfile,Gemfile.lock,Guardfile,Jarfile,Mavenfile,Podfile,Puppetfile,Rakefile,Snapfile,Thorfile,Vagrantfile,buildfile,Rantfile,.autotest,Cheffile,KitchenSink,Routefile,.Guardfile,.Brewfile,vagrantfile,[Rr]akefile*,*_spec.rb',
\ 'rust': '*.rs,*.rs.in',
\ 'sbt.scala': '*.sbt',
\ 'scala': '*.scala,*.kojo,*.sc',
\ 'scss': '*.scss',
\ 'sexplib': '*.sexp',
\ 'sh': '*.sh,*.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh.in,*.tmux,*.tool,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,login,man,profile',
\ 'sh': '*.sh,*.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh.in,*.tmux,*.tool,.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',
\ 'slim': '*.slim',
\ 'slime': '*.slime',
\ 'smt2': '*.smt2,*.smt',
\ 'solidity': '*.sol',
\ 'sql': '*.pgsql',
\ 'sql': '*.pgsql,*.pls,*.bdy,*.ddl,*.fnc,*.pck,*.pkb,*.pks,*.plb,*.plsql,*.prc,*.spc,*.sql,*.tpb,*.tps,*.trg,*.vw,*.tyb,*.typ,*.tyc',
\ 'stylus': '*.styl,*.stylus',
\ 'svelte': '*.svelte',
\ 'svg': '*.svg',
\ 'swift': '*.swift',
\ 'sxhkdrc': '*.sxhkdrc,sxhkdrc',
\ 'systemd': '*.automount,*.mount,*.path,*.service,*.socket,*.swap,*.target,*.timer',
\ 'systemd': '*.automount,*.dnssd,*.link,*.mount,*.netdev,*.network,*.nspawn,*.path,*.service,*.slice,*.socket,*.swap,*.target,*.timer,*.#*',
\ 'tablegen': '*.td',
\ 'tads': '*.t',
\ 'terraform': '*.hcl,*.nomad,*.tf,*.tfvars,*.workflow',
\ 'terraform': '*.tf,*.tfvars',
\ 'textile': '*.textile',
\ 'thrift': '*.thrift',
\ 'tmux': '',
\ 'tmux': '.tmux*.conf',
\ 'toml': '*.toml,Cargo.lock,Gopkg.lock,poetry.lock,Pipfile',
\ 'tptp': '*.p,*.tptp,*.ax',
\ 'trasys': '*.inp',
@@ -217,19 +221,19 @@ let s:globs = {
\ 'vmasm': '*.mar',
\ 'vue': '*.vue,*.wpy',
\ 'xdc': '*.xdc',
\ 'xml': '*.xml,*.adml,*.admx,*.ant,*.axml,*.builds,*.ccproj,*.ccxml,*.clixml,*.cproject,*.cscfg,*.csdef,*.csl,*.csproj,*.ct,*.depproj,*.dita,*.ditamap,*.ditaval,*.dll.config,*.dotsettings,*.filters,*.fsproj,*.fxml,*.glade,*.gml,*.gmx,*.grxml,*.gst,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mm,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.ps1xml,*.psc1,*.pt,*.rdf,*.resx,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.targets,*.tml,*.ui,*.urdf,*.ux,*.vbproj,*.vcxproj,*.vsixmanifest,*.vssettings,*.vstemplate,*.vxml,*.wixproj,*.workflow,*.wsdl,*.wsf,*.wxi,*.wxl,*.wxs,*.x3d,*.xacro,*.xaml,*.xib,*.xlf,*.xliff,*.xmi,*.xml.dist,*.xproj,*.xsd,*.xspec,*.xul,*.zcml,*.cdxml,*.tpm,*.csproj.user,*.wpl,App.config,NuGet.config,Settings.StyleCop,Web.Debug.config,Web.Release.config,Web.config,packages.config',
\ 'xml': '*.xml,*.adml,*.admx,*.ant,*.axml,*.builds,*.ccproj,*.ccxml,*.clixml,*.cproject,*.cscfg,*.csdef,*.csl,*.csproj,*.ct,*.depproj,*.dita,*.ditamap,*.ditaval,*.dll.config,*.dotsettings,*.filters,*.fsproj,*.fxml,*.glade,*.gml,*.gmx,*.grxml,*.gst,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mm,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.rdf,*.resx,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.targets,*.tml,*.ui,*.urdf,*.ux,*.vbproj,*.vcxproj,*.vsixmanifest,*.vssettings,*.vstemplate,*.vxml,*.wixproj,*.workflow,*.wsdl,*.wsf,*.wxi,*.wxl,*.wxs,*.x3d,*.xacro,*.xaml,*.xib,*.xlf,*.xliff,*.xmi,*.xml.dist,*.xproj,*.xsd,*.xspec,*.xul,*.zcml,*.cdxml,*.tpm,*.csproj.user,*.wpl,.classpath,.cproject,.project,App.config,NuGet.config,Settings.StyleCop,Web.Debug.config,Web.Release.config,Web.config,packages.config,*fglrxrc',
\ 'xml.twig': '*.xml.twig',
\ 'xs': '*.xs',
\ 'xsl': '*.xslt,*.xsl',
\ 'yaml': '*.yml,*.mir,*.reek,*.rviz,*.sublime-syntax,*.syntax,*.yaml,*.yaml-tmlanguage,*.yaml.sed,*.yml.mysql,glide.lock,yarn.lock,fish_history,fish_read_history',
\ 'yaml': '*.yml,*.mir,*.reek,*.rviz,*.sublime-syntax,*.syntax,*.yaml,*.yaml-tmlanguage,*.yaml.sed,*.yml.mysql,.clang-format,.clang-tidy,.gemrc,glide.lock,yarn.lock,fish_history,fish_read_history',
\ 'yaml.ansible': 'playbook.y{a,}ml,site.y{a,}ml,main.y{a,}ml,local.y{a,}ml,requirements.y{a,}ml,tasks.*.y{a,}ml,roles.*.y{a,}ml,handlers.*.y{a,}ml',
\ 'yaml.docker-compose': 'docker-compose*.yaml,docker-compose*.yml',
\ 'zephir': '*.zep',
\ 'zig': '*.zig,*.zir',
\ 'zir': '*.zir',
\ 'zsh': '*.zsh',
\ 'zsh': '*.zsh,.zshrc,.zshenv,.zlogin,.zprofile,.zlogout,.zlog*,.zcompdump*,.zfbfmarks,.zsh*',
\}
func! sleuth#GlobForFiletype(type)
func! polyglot#sleuth#GlobForFiletype(type)
return get(s:globs, a:type, '')
endfunc

85
doc/fzf_gitignore.txt Normal file
View File

@@ -0,0 +1,85 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
*fzf_gitignore.txt* Create useful .gitignore files for your project
Author: Filip Szymański <fszymanski.pl@gmail.com>
==============================================================================
CONTENTS *fzf-gitignore-contents*
1. Introduction |fzf-gitignore-introduction|
2. Configuration |fzf-gitignore-configuration|
3. Commands |fzf-gitignore-commands|
4. Mappings |fzf-gitignore-mappings|
5. License |fzf-gitignore-license|
6. Bugs |fzf-gitignore-bugs|
7. Contributing |fzf-gitignore-contributing|
==============================================================================
INTRODUCTION *fzf-gitignore-introduction*
fzf[1] interface for creating .gitignore files using the gitignore.io[2] API.
Note: This plugin was inspired by helm-gitignore[3].
==============================================================================
CONFIGURATION *fzf-gitignore-configuration*
*g:fzf_gitignore_no_maps*
Set this option to disable all key mappings.
>
let g:fzf_gitignore_no_maps = 1
<
Default: Not defined (number)
*g:fzf_gitignore_map*
Set this option to change the |<Plug>(fzf-gitignore)| key mapping.
>
let g:fzf_gitignore_map = '<Leader>i'
<
Default: '<Leader>gi' (string)
==============================================================================
COMMANDS *fzf-gitignore-commands*
*:FzfGitignore*
Create .gitignore file.
==============================================================================
MAPPINGS *fzf-gitignore-mappings*
-----------------------------------+----------------------------------------
Mapping | Description ~
-----------------------------------+----------------------------------------
<Plug>(fzf-gitignore) | Create .gitignore file
-----------------------------------+----------------------------------------
==============================================================================
LICENSE *fzf-gitignore-license*
MIT
==============================================================================
BUGS *fzf-gitignore-bugs*
If you find a bug please create an issue on GitHub.
https://github.com/fszymanski/fzf-gitignore/issues
==============================================================================
CONTRIBUTING *fzf-gitignore-contributing*
Think you can make this plugin better? Awesome. Fork it on GitHub and create
a pull request.
https://github.com/fszymanski/fzf-gitignore
==============================================================================
[1] https://github.com/junegunn/fzf
[2] https://www.gitignore.io/
[3] https://github.com/jupl/helm-gitignore
vim: tw=78 ts=8 ft=help norl
endif

8
filetype.vim Normal file
View File

@@ -0,0 +1,8 @@
" Oh yeah, we are loading before vim's filetype.vim so we can
" make startup little faster by preventing it to load later
if !exists("did_load_filetypes")
runtime! ftdetect/polyglot.vim
" We need to do it here to avoid recursive loop
runtime! ftdetect/*.vim
endif

File diff suppressed because it is too large Load Diff

View File

@@ -3,9 +3,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'awk') == -1
" Vim filetype plugin
" Language: awk, nawk, gawk, mawk
" Maintainer: Antonio Colombo <azc100@gmail.com>
" Last Change: 2017 Feb 17
" Last Change: 2020 Sep 28
" This plugin was prepared by Mark Sikora
" This plugin was updated as proposed by Doug Kearns
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -15,8 +16,44 @@ endif
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
let b:undo_ftplugin = "setl commentstring<"
let s:cpo_save = &cpo
set cpo&vim
setlocal comments=:#
setlocal commentstring=#\ %s
setlocal formatoptions-=t formatoptions+=croql
setlocal define=function
setlocal suffixesadd+=.awk
let b:undo_ftplugin = "setl fo< com< cms< def< sua<" .
\ " | unlet! b:browsefilter"
" TODO: set this in scripts.vim?
if exists("g:awk_is_gawk")
setlocal include=@include
setlocal suffixesadd+=.gawk
if has("unix") || has("win32unix")
setlocal formatprg=gawk\ -f-\ -o/dev/stdout
let b:undo_ftplugin .= " | setl fp<"
endif
let path = system("gawk 'BEGIN { printf ENVIRON[\"AWKPATH\"] }'")
let path = substitute(path, '^\.\=:\|:\.\=$\|:\.\=:', ',,', 'g') " POSIX cwd
let path = substitute(path, ':', ',', 'g')
let &l:path = path
let b:undo_ftplugin .= " | setl inc< path<"
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Awk Source Files (*.awk,*.gawk)\t*.awk;*.gawk\n" .
\ "All Files (*.*)\t*.*\n"
endif
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: nowrap sw=2 sts=2 ts=8
endif

23
ftplugin/conf.vim Normal file
View File

@@ -0,0 +1,23 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'conf') == -1
" Vim filetype plugin file
" Language: generic configuration file
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2008-07-09
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
let b:undo_ftplugin = "setl com< cms< fo<"
setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
unlet s:cpo_save
endif

20
ftplugin/gitignore.vim Normal file
View File

@@ -0,0 +1,20 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
scriptencoding utf-8
" Copyright (c) 2017-2020 Filip Szymański. All rights reserved.
" Use of this source code is governed by an MIT license that can be
" found in the LICENSE file.
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
setlocal commentstring=#\ %s
let b:undo_ftplugin = 'setlocal commentstring<'
" vim: ts=2 et sw=2
endif

View File

@@ -1,10 +1,10 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
" Vim filetype plugin
" Language: LessCSS
" Author: Tim Pope <vimNOSPAM@tpope.org>
" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de>
" Last Change: 2011 Sep 30
" Language: less
" Maintainer: Alessandro Vioni <jenoma@gmail.com>
" URL: https://github.com/genoma/vim-less
" Last Change: 2014 November 24
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -14,17 +14,11 @@ 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 formatoptions-=t formatoptions+=croql
setlocal comments=:// commentstring=//\ %s
setlocal omnifunc=csscomplete#CompleteCSS
setlocal suffixesadd=.less
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,://
setlocal fo=croql
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
" vim:set sw=2:
endif

552
ftplugin/sql.vim Normal file
View File

@@ -0,0 +1,552 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sql') == -1
" SQL filetype plugin file
" Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase)
" Version: 12.0
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
" Last Change: 2017 Mar 07
" Download: http://vim.sourceforge.net/script.php?script_id=454
" For more details please use:
" :h sql.txt
"
" This file should only contain values that are common to all SQL languages
" Oracle, Microsoft SQL Server, Sybase ASA/ASE, MySQL, and so on
" If additional features are required create:
" vimfiles/after/ftplugin/sql.vim (Windows)
" .vim/after/ftplugin/sql.vim (Unix)
" to override and add any of your own settings.
" This file also creates a command, SQLSetType, which allows you to change
" SQL dialects on the fly. For example, if I open an Oracle SQL file, it
" is color highlighted appropriately. If I open an Informix SQL file, it
" will still be highlighted according to Oracles settings. By running:
" :SQLSetType sqlinformix
"
" All files called sqlinformix.vim will be loaded from the indent and syntax
" directories. This allows you to easily flip SQL dialects on a per file
" basis. NOTE: you can also use completion:
" :SQLSetType <tab>
"
" To change the default dialect, add the following to your vimrc:
" let g:sql_type_default = 'sqlanywhere'
"
" This file also creates a command, SQLGetType, which allows you to
" determine what the current dialect is in use.
" :SQLGetType
"
" History
"
" Version 12.0 (April 2013)
"
" NF: Added support for "BEGIN TRY ... END TRY ... BEGIN CATCH ... END CATCH
" BF: This plugin is designed to be used with other plugins to enable the
" SQL completion with Perl, Python, Java, ... The loading mechanism
" was not checking if the SQL objects were created, which can lead to
" the plugin not loading the SQL support.
"
" Version 11.0 (May 2013)
"
" NF: Updated to use SyntaxComplete's new regex support for syntax groups.
"
" Version 10.0 (Dec 2012)
"
" NF: Changed all maps to use noremap instead of must map
" NF: Changed all visual maps to use xnoremap instead of vnoremap as they
" should only be used in visual mode and not select mode.
" BF: Most of the maps were using doubled up backslashes before they were
" changed to using the search() function, which meant they no longer
" worked.
"
" Version 9.0
"
" NF: Completes 'b:undo_ftplugin'
" BF: Correctly set cpoptions when creating script
"
" Version 8.0
"
" NF: Improved the matchit plugin regex (Talek)
"
" Version 7.0
"
" NF: Calls the sqlcomplete#ResetCacheSyntax() function when calling
" SQLSetType.
"
" Version 6.0
"
" NF: Adds the command SQLGetType
"
" Version 5.0
"
" NF: Adds the ability to choose the keys to control SQL completion, just add
" the following to your .vimrc:
" let g:ftplugin_sql_omni_key = '<C-C>'
" let g:ftplugin_sql_omni_key_right = '<Right>'
" let g:ftplugin_sql_omni_key_left = '<Left>'
"
" BF: format-options - Auto-wrap comments using textwidth was turned off
" by mistake.
" Only do this when not done yet for this buffer
" This ftplugin can be used with other ftplugins. So ensure loading
" happens if all elements of this plugin have not yet loaded.
if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql'
finish
endif
let s:save_cpo = &cpo
set cpo&vim
" Disable autowrapping for code, but enable for comments
" t Auto-wrap text using textwidth
" c Auto-wrap comments using textwidth, inserting the current comment
" leader automatically.
setlocal formatoptions-=t
setlocal formatoptions+=c
" Functions/Commands to allow the user to change SQL syntax dialects
" through the use of :SQLSetType <tab> for completion.
" This works with both Vim 6 and 7.
if !exists("*SQL_SetType")
" NOTE: You cannot use function! since this file can be
" sourced from within this function. That will result in
" an error reported by Vim.
function SQL_GetList(ArgLead, CmdLine, CursorPos)
if !exists('s:sql_list')
" Grab a list of files that contain "sql" in their names
let list_indent = globpath(&runtimepath, 'indent/*sql*')
let list_syntax = globpath(&runtimepath, 'syntax/*sql*')
let list_ftplugin = globpath(&runtimepath, 'ftplugin/*sql*')
let sqls = "\n".list_indent."\n".list_syntax."\n".list_ftplugin."\n"
" Strip out everything (path info) but the filename
" Regex
" From between two newline characters
" Non-greedily grab all characters
" Followed by a valid filename \w\+\.\w\+ (sql.vim)
" Followed by a newline, but do not include the newline
"
" Replace it with just the filename (get rid of PATH)
"
" Recursively, since there are many filenames that contain
" the word SQL in the indent, syntax and ftplugin directory
let sqls = substitute( sqls,
\ '[\n]\%(.\{-}\)\(\w\+\.\w\+\)\n\@=',
\ '\1\n',
\ 'g'
\ )
" Remove duplicates, since sqlanywhere.vim can exist in the
" sytax, indent and ftplugin directory, yet we only want
" to display the option once
let index = match(sqls, '.\{-}\ze\n')
while index > -1
" Get the first filename
let file = matchstr(sqls, '.\{-}\ze\n', index)
" Recursively replace any *other* occurrence of that
" filename with nothing (ie remove it)
let sqls = substitute(sqls, '\%>'.(index+strlen(file)).'c\<'.file.'\>\n', '', 'g')
" Move on to the next filename
let index = match(sqls, '.\{-}\ze\n', (index+strlen(file)+1))
endwhile
" Sort the list if using version 7
if v:version >= 700
let mylist = split(sqls, "\n")
let mylist = sort(mylist)
let sqls = join(mylist, "\n")
endif
let s:sql_list = sqls
endif
return s:sql_list
endfunction
function SQL_SetType(name)
" User has decided to override default SQL scripts and
" specify a vendor specific version
" (ie Oracle, Informix, SQL Anywhere, ...)
" So check for an remove any settings that prevent the
" scripts from being executed, and then source the
" appropriate Vim scripts.
if exists("b:did_ftplugin")
unlet b:did_ftplugin
endif
if exists("b:current_syntax")
" echomsg 'SQLSetType - clearing syntax'
syntax clear
if exists("b:current_syntax")
unlet b:current_syntax
endif
endif
if exists("b:did_indent")
" echomsg 'SQLSetType - clearing indent'
unlet b:did_indent
" Set these values to their defaults
setlocal indentkeys&
setlocal indentexpr&
endif
" Ensure the name is in the correct format
let new_sql_type = substitute(a:name,
\ '\s*\([^\.]\+\)\(\.\w\+\)\?', '\L\1', '')
" Do not specify a buffer local variable if it is
" the default value
if new_sql_type == 'sql'
let new_sql_type = 'sqloracle'
endif
let b:sql_type_override = new_sql_type
" Remove any cached SQL since a new sytax will have different
" items and groups
if !exists('g:loaded_sql_completion') || g:loaded_sql_completion >= 100
call sqlcomplete#ResetCacheSyntax()
endif
" Vim will automatically source the correct files if we
" change the filetype. You cannot do this with setfiletype
" since that command will only execute if a filetype has
" not already been set. In this case we want to override
" the existing filetype.
let &filetype = 'sql'
if b:sql_compl_savefunc != ""
" We are changing the filetype to SQL from some other filetype
" which had OMNI completion defined. We need to activate the
" SQL completion plugin in order to cache some of the syntax items
" while the syntax rules for SQL are active.
call sqlcomplete#PreCacheSyntax()
endif
endfunction
command! -nargs=* -complete=custom,SQL_GetList SQLSetType :call SQL_SetType(<q-args>)
endif
" Functions/Commands to allow the user determine current SQL syntax dialect
" This works with both Vim 6 and 7.
if !exists("*SQL_GetType")
function SQL_GetType()
if exists('b:sql_type_override')
echomsg "Current SQL dialect in use:".b:sql_type_override
else
echomsg "Current SQL dialect in use:".g:sql_type_default
endif
endfunction
command! -nargs=0 SQLGetType :call SQL_GetType()
endif
if exists("b:sql_type_override")
" echo 'sourcing buffer ftplugin/'.b:sql_type_override.'.vim'
if globpath(&runtimepath, 'ftplugin/'.b:sql_type_override.'.vim') != ''
exec 'runtime ftplugin/'.b:sql_type_override.'.vim'
" else
" echomsg 'ftplugin/'.b:sql_type_override.' not exist, using default'
endif
elseif exists("g:sql_type_default")
" echo 'sourcing global ftplugin/'.g:sql_type_default.'.vim'
if globpath(&runtimepath, 'ftplugin/'.g:sql_type_default.'.vim') != ''
exec 'runtime ftplugin/'.g:sql_type_default.'.vim'
" else
" echomsg 'ftplugin/'.g:sql_type_default.'.vim not exist, using default'
endif
endif
" If the above runtime command succeeded, do not load the default settings
" as they should have already been loaded from a previous run.
if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql'
finish
endif
let b:undo_ftplugin = "setl comments< formatoptions< define< omnifunc<" .
\ " | unlet! b:browsefilter b:match_words"
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
let b:current_ftplugin = 'sql'
" Win32 can filter files in the browse dialog
if has("gui_win32") && !exists("b:browsefilter")
let b:browsefilter = "SQL Files (*.sql)\t*.sql\n" .
\ "All Files (*.*)\t*.*\n"
endif
" Some standard expressions for use with the matchit strings
let s:notend = '\%(\<end\s\+\)\@<!'
let s:when_no_matched_or_others = '\%(\<when\>\%(\s\+\%(\%(\<not\>\s\+\)\?<matched\>\)\|\<others\>\)\@!\)'
let s:or_replace = '\%(or\s\+replace\s\+\)\?'
" Define patterns for the matchit macro
if !exists("b:match_words")
" SQL is generally case insensitive
let b:match_ignorecase = 1
" Handle the following:
" if
" elseif | elsif
" else [if]
" end if
"
" [while condition] loop
" leave
" break
" continue
" exit
" end loop
"
" for
" leave
" break
" continue
" exit
" end loop
"
" do
" statements
" doend
"
" case
" when
" when
" default
" end case
"
" merge
" when not matched
" when matched
"
" EXCEPTION
" WHEN column_not_found THEN
" WHEN OTHERS THEN
"
" begin try
" end try
" begin catch
" end catch
"
" create[ or replace] procedure|function|event
" \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'.
" For ColdFusion support
setlocal matchpairs+=<:>
let b:match_words = &matchpairs .
\ ',\%(\<begin\)\%(\s\+\%(try\|catch\)\>\)\@!:\<end\>\W*$,'.
\
\ '\<begin\s\+try\>:'.
\ '\<end\s\+try\>:'.
\ '\<begin\s\+catch\>:'.
\ '\<end\s\+catch\>,'.
\
\ s:notend . '\<if\>:'.
\ '\<elsif\>\|\<elseif\>\|\<else\>:'.
\ '\<end\s\+if\>,'.
\
\ '\(^\s*\)\@<=\(\<\%(do\|for\|while\|loop\)\>.*\):'.
\ '\%(\<exit\>\|\<leave\>\|\<break\>\|\<continue\>\):'.
\ '\%(\<doend\>\|\%(\<end\s\+\%(for\|while\|loop\>\)\)\),'.
\
\ '\%('. s:notend . '\<case\>\):'.
\ '\%('.s:when_no_matched_or_others.'\):'.
\ '\%(\<when\s\+others\>\|\<end\s\+case\>\),' .
\
\ '\<merge\>:' .
\ '\<when\s\+not\s\+matched\>:' .
\ '\<when\s\+matched\>,' .
\
\ '\%(\<create\s\+' . s:or_replace . '\)\?'.
\ '\%(function\|procedure\|event\):'.
\ '\<returns\?\>'
" \ '\<begin\>\|\<returns\?\>:'.
" \ '\<end\>\(;\)\?\s*$'
" \ '\<exception\>:'.s:when_no_matched_or_others.
" \ ':\<when\s\+others\>,'.
"
" \ '\%(\<exception\>\|\%('. s:notend . '\<case\>\)\):'.
" \ '\%(\<default\>\|'.s:when_no_matched_or_others.'\):'.
" \ '\%(\%(\<when\s\+others\>\)\|\<end\s\+case\>\),' .
endif
" Define how to find the macro definition of a variable using the various
" [d, [D, [_CTRL_D and so on features
" Match these values ignoring case
" ie DECLARE varname INTEGER
let &l:define = '\c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\>'
" Mappings to move to the next BEGIN ... END block
" \W - no characters or digits
nnoremap <buffer> <silent> ]] :call search('\c^\s*begin\>', 'W' )<CR>
nnoremap <buffer> <silent> [[ :call search('\c^\s*begin\>', 'bW' )<CR>
nnoremap <buffer> <silent> ][ :call search('\c^\s*end\W*$', 'W' )<CR>
nnoremap <buffer> <silent> [] :call search('\c^\s*end\W*$', 'bW' )<CR>
xnoremap <buffer> <silent> ]] :<C-U>exec "normal! gv"<Bar>call search('\c^\s*begin\>', 'W' )<CR>
xnoremap <buffer> <silent> [[ :<C-U>exec "normal! gv"<Bar>call search('\c^\s*begin\>', 'bW' )<CR>
xnoremap <buffer> <silent> ][ :<C-U>exec "normal! gv"<Bar>call search('\c^\s*end\W*$', 'W' )<CR>
xnoremap <buffer> <silent> [] :<C-U>exec "normal! gv"<Bar>call search('\c^\s*end\W*$', 'bW' )<CR>
" By default only look for CREATE statements, but allow
" the user to override
if !exists('g:ftplugin_sql_statements')
let g:ftplugin_sql_statements = 'create'
endif
" Predefined SQL objects what are used by the below mappings using
" the ]} style maps.
" This global variable allows the users to override its value
" from within their vimrc.
" Note, you cannot use \?, since these patterns can be used to search
" backwards, you must use \{,1}
if !exists('g:ftplugin_sql_objects')
let g:ftplugin_sql_objects = 'function,procedure,event,' .
\ '\(existing\\|global\s\+temporary\s\+\)\{,1}' .
\ 'table,trigger' .
\ ',schema,service,publication,database,datatype,domain' .
\ ',index,subscription,synchronization,view,variable'
endif
" Key to trigger SQL completion
if !exists('g:ftplugin_sql_omni_key')
let g:ftplugin_sql_omni_key = '<C-C>'
endif
" Key to trigger drill into column list
if !exists('g:ftplugin_sql_omni_key_right')
let g:ftplugin_sql_omni_key_right = '<Right>'
endif
" Key to trigger drill out of column list
if !exists('g:ftplugin_sql_omni_key_left')
let g:ftplugin_sql_omni_key_left = '<Left>'
endif
" Replace all ,'s with bars, except ones with numbers after them.
" This will most likely be a \{,1} string.
let s:ftplugin_sql_objects =
\ '\c^\s*' .
\ '\(\(' .
\ substitute(g:ftplugin_sql_statements, ',\d\@!', '\\\\|', 'g') .
\ '\)\s\+\(or\s\+replace\s\+\)\{,1}\)\{,1}' .
\ '\<\(' .
\ substitute(g:ftplugin_sql_objects, ',\d\@!', '\\\\|', 'g') .
\ '\)\>'
" Mappings to move to the next CREATE ... block
exec "nnoremap <buffer> <silent> ]} :call search('".s:ftplugin_sql_objects."', 'W')<CR>"
exec "nnoremap <buffer> <silent> [{ :call search('".s:ftplugin_sql_objects."', 'bW')<CR>"
" Could not figure out how to use a :call search() string in visual mode
" without it ending visual mode
" Unfortunately, this will add a entry to the search history
exec 'xnoremap <buffer> <silent> ]} /'.s:ftplugin_sql_objects.'<CR>'
exec 'xnoremap <buffer> <silent> [{ ?'.s:ftplugin_sql_objects.'<CR>'
" Mappings to move to the next COMMENT
"
" Had to double the \ for the \| separator since this has a special
" meaning on maps
let b:comment_leader = '\(--\\|\/\/\\|\*\\|\/\*\\|\*\/\)'
" Find the start of the next comment
let b:comment_start = '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
\ '\(\s*'.b:comment_leader.'\)'
" Find the end of the previous comment
let b:comment_end = '\(^\s*'.b:comment_leader.'.*\n\)'.
\ '\(^\s*'.b:comment_leader.'\)\@!'
" Skip over the comment
let b:comment_jump_over = "call search('".
\ '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
\ "', 'W')"
let b:comment_skip_back = "call search('".
\ '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
\ "', 'bW')"
" Move to the start and end of comments
exec 'nnoremap <silent><buffer> ]" :call search('."'".b:comment_start."'".', "W" )<CR>'
exec 'nnoremap <silent><buffer> [" :call search('."'".b:comment_end."'".', "W" )<CR>'
exec 'xnoremap <silent><buffer> ]" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_start."'".', "W" )<CR>'
exec 'xnoremap <silent><buffer> [" :<C-U>exec "normal! gv"<Bar>call search('."'".b:comment_end."'".', "W" )<CR>'
" Comments can be of the form:
" /*
" *
" */
" or
" --
" or
" //
setlocal comments=s1:/*,mb:*,ex:*/,:--,://
" Set completion with CTRL-X CTRL-O to autoloaded function.
if exists('&omnifunc')
" Since the SQL completion plugin can be used in conjunction
" with other completion filetypes it must record the previous
" OMNI function prior to setting up the SQL OMNI function
let b:sql_compl_savefunc = &omnifunc
" Source it to determine its version
runtime autoload/sqlcomplete.vim
" This is used by the sqlcomplete.vim plugin
" Source it for its global functions
runtime autoload/syntaxcomplete.vim
setlocal omnifunc=sqlcomplete#Complete
" Prevent the intellisense plugin from loading
let b:sql_vis = 1
if !exists('g:omni_sql_no_default_maps')
let regex_extra = ''
if exists('g:loaded_syntax_completion') && exists('g:loaded_sql_completion')
if g:loaded_syntax_completion > 120 && g:loaded_sql_completion > 140
let regex_extra = '\\w*'
endif
endif
" Static maps which use populate the completion list
" using Vim's syntax highlighting rules
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'a <C-\><C-O>:call sqlcomplete#Map("syntax")<CR><C-X><C-O>'
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'k <C-\><C-O>:call sqlcomplete#Map("sqlKeyword'.regex_extra.'")<CR><C-X><C-O>'
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'f <C-\><C-O>:call sqlcomplete#Map("sqlFunction'.regex_extra.'")<CR><C-X><C-O>'
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'o <C-\><C-O>:call sqlcomplete#Map("sqlOption'.regex_extra.'")<CR><C-X><C-O>'
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'T <C-\><C-O>:call sqlcomplete#Map("sqlType'.regex_extra.'")<CR><C-X><C-O>'
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'s <C-\><C-O>:call sqlcomplete#Map("sqlStatement'.regex_extra.'")<CR><C-X><C-O>'
" Dynamic maps which use populate the completion list
" using the dbext.vim plugin
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'t <C-\><C-O>:call sqlcomplete#Map("table")<CR><C-X><C-O>'
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'p <C-\><C-O>:call sqlcomplete#Map("procedure")<CR><C-X><C-O>'
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'v <C-\><C-O>:call sqlcomplete#Map("view")<CR><C-X><C-O>'
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'c <C-\><C-O>:call sqlcomplete#Map("column")<CR><C-X><C-O>'
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'l <C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>'
" The next 3 maps are only to be used while the completion window is
" active due to the <CR> at the beginning of the map
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'L <C-Y><C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>'
" <C-Right> is not recognized on most Unix systems, so only create
" these additional maps on the Windows platform.
" If you would like to use these maps, choose a different key and make
" the same map in your vimrc.
" if has('win32')
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key_right.' <C-R>=sqlcomplete#DrillIntoTable()<CR>'
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key_left.' <C-R>=sqlcomplete#DrillOutOfColumns()<CR>'
" endif
" Remove any cached items useful for schema changes
exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'R <C-\><C-O>:call sqlcomplete#Map("resetCache")<CR><C-X><C-O>'
endif
if b:sql_compl_savefunc != ""
" We are changing the filetype to SQL from some other filetype
" which had OMNI completion defined. We need to activate the
" SQL completion plugin in order to cache some of the syntax items
" while the syntax rules for SQL are active.
call sqlcomplete#ResetCacheSyntax()
call sqlcomplete#PreCacheSyntax()
endif
endif
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:sw=4:
endif

View File

@@ -132,6 +132,8 @@ rules:
filetype: perl
- override: true
- filetype: perl
shebang: true
fallback: true
---
extensions: [pl]
rules:
@@ -149,6 +151,8 @@ rules:
filetype: perl
- override: true
- filetype: perl
shebang: true
fallback: true
---
extensions: [t]
rules:
@@ -166,6 +170,8 @@ rules:
# filetype: turing
- override: true
- filetype: perl
shebang: true
fallback: true
---
extensions: [tt2]
rules:
@@ -182,7 +188,7 @@ rules:
filetype: mason
- lines: 50
rules:
- pattern: '{{.*}}|{%-?\s*(end.*|extends|block|macro|set|if|for|include|trans)\b|{#\s+'
- pattern: '{%-?\s*(end.*|extends|block|macro|set|if|for|include|trans)\b|{#\s+'
filetype: htmldjango
- pattern: '\bDTD\s+XHTML\s'
filetype: xhtml

View File

@@ -1,13 +1,17 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
" Vim indent file
" Language: LessCSS
" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de>
" Last Change: 2011 Sep 26
" Language: less
" Maintainer: Alessandro Vioni <jenoma@gmail.com>
" URL: https://github.com/genoma/vim-less
" Last Change: 2014 November 24
if exists("b:did_indent")
finish
endif
runtime! indent/css.vim
" vim:set sw=2:
endif

43
indent/sql.vim Normal file
View File

@@ -0,0 +1,43 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sql') == -1
" Vim indent file loader
" Language: SQL
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
" Last Change: Thu Sep 15 2005 10:27:51 AM
" Version: 1.0
" Download: http://vim.sourceforge.net/script.php?script_id=495
" Description: Checks for a:
" buffer local variable,
" global variable,
" If the above exist, it will source the type specified.
" If none exist, it will source the default sqlanywhere.vim file.
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
" Default to the standard Vim distribution file
let filename = 'sqlanywhere'
" Check for overrides. Buffer variables have the highest priority.
if exists("b:sql_type_override")
" Check the runtimepath to see if the file exists
if globpath(&runtimepath, 'indent/'.b:sql_type_override.'.vim') != ''
let filename = b:sql_type_override
endif
elseif exists("g:sql_type_default")
if globpath(&runtimepath, 'indent/'.g:sql_type_default.'.vim') != ''
let filename = g:sql_type_default
endif
endif
" Source the appropriate file
exec 'runtime indent/'.filename.'.vim'
" vim:sw=4:
endif

View File

@@ -10,8 +10,6 @@ filetypes:
name: a2ps
remote: vim/vim:runtime
glob: '**/a2ps.vim'
after:
- haproxy
filetypes:
- name: a2ps
filenames:
@@ -142,7 +140,6 @@ filetypes:
name: ant
remote: vim/vim:runtime
glob: '**/ant.vim'
after: xml
filetypes:
- name: ant
filenames:
@@ -210,7 +207,7 @@ filetypes:
---
name: arduino
remote: sudar/vim-arduino-syntax
after: c/c++
dependencies: c/c++
filetypes:
- name: arduino
linguist: Processing
@@ -240,7 +237,6 @@ filetypes:
name: automake
remote: vim/vim:runtime
glob: '**/automake.vim'
after: elf
filetypes:
- name: automake
filenames:
@@ -260,7 +256,6 @@ name: aspvbs
remote: vim/vim:runtime
globs:
- '**/aspvbs.vim'
dependencies:
filetypes:
- name: aspvbs
extensions:
@@ -271,7 +266,6 @@ name: aspperl
remote: vim/vim:runtime
globs:
- '**/aspperl.vim'
dependencies:
filetypes:
- name: aspperl
extensions:
@@ -327,8 +321,8 @@ filetypes:
- ino
ignored_warnings:
# TODO: fix these
- C
- H
- '*.C'
- '*.H'
- name: c
linguist: C
extra_extensions:
@@ -347,7 +341,7 @@ filetypes:
---
name: cpp-modern
remote: bfrg/vim-cpp-modern
after: c/c++
dependencies: c/c++
filetypes: []
---
name: carp
@@ -389,9 +383,9 @@ filetypes:
# Probably mistake
- '*Cakefile'
# Used by C#
- csx
- '*.csx'
# Used by Chuck
- ck
- '*.ck'
- name: litcoffee
linguist: Literate CoffeeScript
extra_extensions:
@@ -433,7 +427,7 @@ filetypes:
- tab
ignored_warnings:
# This is definitely not csv-only, maybe re-enable when heuristics done
- dat
- '*.dat'
---
name: cucumber
remote: tpope/vim-cucumber
@@ -590,7 +584,6 @@ name: fsharp
remote: ionide/Ionide-vim
ignored_dirs:
- ftplugin
after: glsl
filetypes:
- name: fsharp
linguist: F#
@@ -681,7 +674,8 @@ filetypes:
---
name: graphql
remote: jparise/vim-graphql
after: [javascript, jsx]
dependencies: javascript
after: jsx
ignored_dirs:
# TODO: remove after bug is fixed:
# https://github.com/jparise/vim-graphql/issues/62
@@ -692,7 +686,7 @@ filetypes:
---
name: gradle
remote: tfnico/vim-gradle
after: groovy
dependencies: groovy
# Just adds compiler
filetypes: []
---
@@ -708,7 +702,6 @@ filetypes:
name: grub
remote: vim/vim:runtime
glob: '**/grub.vim'
after: dlang
filetypes:
- name: grub
filenames:
@@ -747,6 +740,8 @@ filetypes:
- name: haproxy
linguist: HAProxy
extra_filenames:
- 'haproxy*.conf*'
ignored_warnings:
- 'haproxy*.c*'
---
name: haskell
@@ -850,13 +845,15 @@ ignored_dirs:
filetypes:
- name: javascript
linguist: JavaScript
extra_extensions:
- javascript
- name: flow
extensions:
- flow
---
name: javascript-sql
remote: statico/vim-javascript-sql
after: javascript
dependencies: javascript
filetypes: []
---
name: jenkins
@@ -924,12 +921,12 @@ filetypes:
- ect
ignored_warnings:
# I haven't found reference to them on github
- djs
- hamljs
- '*.djs'
- '*.hamljs'
---
name: jsx
remote: MaxMEllon/vim-jsx-pretty
after: javascript
dependencies: javascript
filetypes:
- name: javascriptreact
linguist: JSX
@@ -958,10 +955,8 @@ filetypes:
- journal
---
name: less
remote: groenewege/vim-less
ignored_dirs:
# We don't want to slow down .html files
- after
remote: vim/vim:runtime
glob: '**/less.vim'
filetypes:
- name: less
linguist: Less
@@ -1042,7 +1037,7 @@ filetypes:
# Handled by mdx extension
- mdx
ignored_warnings:
- '{md,mdx,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx}'
- '*.{md,mdx,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx}'
---
name: mdx
remote: jxnblk/vim-mdx-js
@@ -1158,7 +1153,7 @@ filetypes:
---
name: octave
remote: McSinyx/vim-octave
after: mathematica
dependencies: mathematica
filetypes:
- name: octave
extensions:
@@ -1176,6 +1171,9 @@ remote: vim-perl/vim-perl
filetypes:
- name: perl
linguist: Perl
extra_filenames:
- example.gitolite.rc
- .gitolite.rc
- name: pod
extensions:
- pod
@@ -1215,10 +1213,12 @@ remote: StanAngeloff/php.vim
filetypes:
- name: php
linguist: PHP
extra_extensions:
- phtml
---
name: blade
remote: jwalton512/vim-blade
after: php
dependencies: php
filetypes:
- name: blade
linguist: Blade
@@ -1240,7 +1240,6 @@ filetypes:
---
name: powershell
remote: PProvost/vim-ps1
after: xml
filetypes:
- name: ps1
linguist: PowerShell
@@ -1284,6 +1283,11 @@ filetypes:
linguist: Python
ignored_filenames:
- 'lit.*cfg'
extra_extensions:
- ptl
extra_filenames:
- '.pythonrc'
- '.pythonstartup'
---
name: python-indent
remote: Vimjas/vim-python-pep8-indent
@@ -1378,7 +1382,6 @@ filetypes:
---
name: reason
remote: reasonml-editor/vim-reason-plus
after: c/c++
filetypes:
- name: reason
linguist: Reason
@@ -1487,11 +1490,9 @@ filetypes:
- '.zlogin'
- '.zprofile'
- '.zlogout'
- 'zshrc'
- 'zshenv'
- 'zlogin'
- 'zprofile'
- 'zlogout'
# Udev symlinks config
extra_filenames:
- '*/etc/udev/cdsymlinks.conf'
- name: zsh
extensions:
- zsh
@@ -1501,6 +1502,10 @@ filetypes:
- '.zlogin'
- '.zprofile'
- '.zlogout'
- '.zlog*'
- '.zcompdump*'
- '.zfbfmarks'
- '.zsh*'
---
name: zinit
remote: zinit-zsh/zplugin-vim-syntax
@@ -1580,19 +1585,30 @@ filetypes:
- name: systemd
extensions:
- automount
- dnssd
- link
- mount
- netdev
- network
- nspawn
- path
- service
- slice
- socket
- swap
- target
- timer
filenames:
- '*.#*'
- '*/systemd/*.conf'
---
name: terraform
remote: hashivim/vim-terraform
filetypes:
- name: terraform
linguist: HCL
extensions:
- tf
- tfvars
---
name: textile
remote: timcharper/textile.vim
@@ -1611,7 +1627,7 @@ remote: ericpruitt/tmux.vim:vim
filetypes:
- name: tmux
filenames:
- '.tmux.conf'
- '.tmux*.conf'
---
name: toml
remote: cespare/vim-toml
@@ -1639,9 +1655,9 @@ filetypes:
linguist: Twig
ignored_warnings:
# handled by other extension
- xml.twig
- '*.xml.twig'
# already covered by .twig
- html.twig
- '*.html.twig'
- name: xml.twig
extensions:
- xml.twig
@@ -1728,9 +1744,16 @@ filetypes:
- tpm
- csproj.user
- wpl
extra_filenames:
- '*/etc/blkid.tab'
- '*/etc/blkid.tab.old'
- '*/etc/xdg/menus/*.menu'
- '*fglrxrc'
ignored_extensions:
- ts
- tsx
# handled by powershell plugin
- ps1xml
---
name: xsl
remote: vim-scripts/XSLT-syntax
@@ -1754,7 +1777,7 @@ filetypes:
---
name: ansible
remote: pearofducks/ansible-vim
after: yaml
dependencies: yaml
filetypes:
- name: yaml.ansible
filenames:
@@ -1832,7 +1855,7 @@ filetypes:
# SaxBasic is close to Visual Basic
- sba
ignored_warnings:
- vb
- '*.vb'
---
name: dosini
remote: vim/vim:runtime
@@ -1849,8 +1872,6 @@ filetypes:
- '*/etc/yum.repos.d/*'
ignored_extensions:
- cfg
ignored_warnings:
- php.ini
---
name: odin
remote: Tetralux/odin.vim
@@ -1874,6 +1895,8 @@ glob: '**/prolog.vim'
filetypes:
- name: prolog
linguist: Prolog
extra_extensions:
- pdb
---
name: tads
remote: vim/vim:runtime
@@ -1882,3 +1905,34 @@ filetypes:
- name: tads
extensions:
- t
---
name: gitignore
remote: fszymanski/fzf-gitignore
filetypes:
- name: gitignore
filenames:
- '.gitignore'
- '*/.config/git/ignore'
- '*.git/info/exclude'
---
name: sql
remote: vim/vim:runtime
glob: '**/sql.vim'
filetypes:
- name: sql
linguist: PLSQL
extra_extensions:
- tyb
- typ
- tyc
---
name: conf
remote: vim/vim:runtime
glob: '**/conf.vim'
filetypes:
- name: conf
extensions:
- conf
filenames:
- auto.master
- config

View File

@@ -1,379 +0,0 @@
""" autoload/polyglot.vim
" Line continuation is used here, remove 'C' from 'cpoptions'
let s:cpo_save = &cpo
set cpo&vim
func! polyglot#Shebang()
if getline(1) =~# "^#!"
let ft = polyglot#ShebangFiletype()
if ft != ""
let &ft = ft
endif
endif
if &ft == ""
runtime! scripts.vim
endif
return &ft != ""
endfunc
let s:r_hashbang = '^#!\s*\(\S\+\)\s*\(.*\)\s*'
let s:r_envflag = '%(\S\+=\S\+\|-[iS]\|--ignore-environment\|--split-string\)'
let s:r_env = '^\%(\' . s:r_envflag . '\s\+\)*\(\S\+\)'
func! polyglot#ShebangFiletype()
let l:line1 = getline(1)
if l:line1 !~# "^#!"
return
endif
let l:pathrest = matchlist(l:line1, s:r_hashbang)
if len(l:pathrest) == 0
return
endif
let [_, l:path, l:rest; __] = l:pathrest
let l:script = split(l:path, "/")[-1]
if l:script == "env"
let l:argspath = matchlist(l:rest, s:r_env)
if len(l:argspath) == 0
return
endif
let l:script = l:argspath[1]
endif
if has_key(s:interpreters, l:script)
return s:interpreters[l:script]
endif
for interpreter in keys(s:interpreters)
if l:script =~# '^' . interpreter
return s:interpreters[interpreter]
endif
endfor
endfunc
" scripts/build generates heuristics functions here
" Restore 'cpoptions'
let &cpo = s:cpo_save
unlet s:cpo_save
""" ftdetect/polyglot.vim
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
" Disable all native vim ftdetect
if exists('g:polyglot_test')
autocmd!
endif
func! polyglot#Observe(fn)
let b:polyglot_observe = a:fn
augroup polyglot-observer
au! CursorHold,CursorHoldI,BufWritePost <buffer>
\ execute('if polyglot#' . b:polyglot_observe . '() | au! polyglot-observer | endif')
augroup END
endfunc
let s:disabled_packages = {}
let s:new_polyglot_disabled = []
if exists('g:polyglot_disabled')
for pkg in g:polyglot_disabled
let base = split(pkg, '\.')
if len(base) > 0
let s:disabled_packages[pkg] = 1
call add(s:new_polyglot_disabled, base[0])
endif
endfor
else
let g:polyglot_disabled_not_set = 1
endif
function! s:SetDefault(name, value)
if !exists(a:name)
let {a:name} = a:value
endif
endfunction
call s:SetDefault('g:markdown_enable_spell_checking', 0)
call s:SetDefault('g:markdown_enable_input_abbreviations', 0)
call s:SetDefault('g:markdown_enable_mappings', 0)
" Enable jsx syntax by default
call s:SetDefault('g:jsx_ext_required', 0)
" Needed for sql highlighting
call s:SetDefault('g:javascript_sql_dialect', 'sql')
" Make csv loading faster
call s:SetDefault('g:csv_start', 1)
call s:SetDefault('g:csv_end', 2)
" Disable json concealing by default
call s:SetDefault('g:vim_json_syntax_conceal', 0)
call s:SetDefault('g:filetype_euphoria', 'elixir')
if !exists('g:python_highlight_all')
call s:SetDefault('g:python_highlight_builtins', 1)
call s:SetDefault('g:python_highlight_builtin_objs', 1)
call s:SetDefault('g:python_highlight_builtin_types', 1)
call s:SetDefault('g:python_highlight_builtin_funcs', 1)
call s:SetDefault('g:python_highlight_builtin_funcs_kwarg', 1)
call s:SetDefault('g:python_highlight_exceptions', 1)
call s:SetDefault('g:python_highlight_string_formatting', 1)
call s:SetDefault('g:python_highlight_string_format', 1)
call s:SetDefault('g:python_highlight_string_templates', 1)
call s:SetDefault('g:python_highlight_indent_errors', 1)
call s:SetDefault('g:python_highlight_space_errors', 1)
call s:SetDefault('g:python_highlight_doctests', 1)
call s:SetDefault('g:python_highlight_func_calls', 1)
call s:SetDefault('g:python_highlight_class_vars', 1)
call s:SetDefault('g:python_highlight_operators', 1)
call s:SetDefault('g:python_highlight_file_headers_as_comments', 1)
call s:SetDefault('g:python_slow_sync', 1)
endif
" We need it because scripts.vim in vim uses "set ft=" which cannot be
" overridden with setf (and we can't use set ft= so our scripts.vim work)
func! s:Setf(ft)
if &filetype !~# '\<'.a:ft.'\>'
let &filetype = a:ft
endif
endfunc
" Function used for patterns that end in a star: don't set the filetype if the
" file name matches ft_ignore_pat.
" When using this, the entry should probably be further down below with the
" other StarSetf() calls.
func! s:StarSetf(ft)
if expand("<amatch>") !~ g:ft_ignore_pat && &filetype !~# '\<'.a:ft.'\>'
let &filetype = a:ft
endif
endfunc
augroup filetypedetect
" scripts/build inserts here filetype detection autocommands
au! BufNewFile,BufRead,StdinReadPost * if expand("<afile>") !~ g:ft_ignore_pat |
\ call polyglot#Shebang() | endif
au BufEnter * if &ft == "" && expand("<afile>") !~ g:ft_ignore_pat |
\ call polyglot#Observe('Shebang') | endif
augroup END
if !has_key(s:disabled_packages, 'autoindent')
" Code below re-implements sleuth for vim-polyglot
let g:loaded_sleuth = 1
let g:loaded_foobar = 1
" Makes shiftwidth to be synchronized with tabstop by default
if &shiftwidth == &tabstop
let &shiftwidth = 0
endif
function! s:guess(lines) abort
let options = {}
let ccomment = 0
let podcomment = 0
let triplequote = 0
let backtick = 0
let xmlcomment = 0
let heredoc = ''
let minindent = 10
let spaces_minus_tabs = 0
let i = 0
for line in a:lines
let i += 1
if !len(line) || line =~# '^\W*$'
continue
endif
if line =~# '^\s*/\*'
let ccomment = 1
endif
if ccomment
if line =~# '\*/'
let ccomment = 0
endif
continue
endif
if line =~# '^=\w'
let podcomment = 1
endif
if podcomment
if line =~# '^=\%(end\|cut\)\>'
let podcomment = 0
endif
continue
endif
if triplequote
if line =~# '^[^"]*"""[^"]*$'
let triplequote = 0
endif
continue
elseif line =~# '^[^"]*"""[^"]*$'
let triplequote = 1
endif
if backtick
if line =~# '^[^`]*`[^`]*$'
let backtick = 0
endif
continue
elseif &filetype ==# 'go' && line =~# '^[^`]*`[^`]*$'
let backtick = 1
endif
if line =~# '^\s*<\!--'
let xmlcomment = 1
endif
if xmlcomment
if line =~# '-->'
let xmlcomment = 0
endif
continue
endif
" This is correct order because both "<<EOF" and "EOF" matches end
if heredoc != ''
if line =~# heredoc
let heredoc = ''
endif
continue
endif
let herematch = matchlist(line, '\C<<\W*\([A-Z]\+\)\s*$')
if len(herematch) > 0
let heredoc = herematch[1] . '$'
endif
let spaces_minus_tabs += line[0] == "\t" ? 1 : -1
if line[0] == "\t"
setlocal noexpandtab
let &shiftwidth=&tabstop
let b:sleuth_culprit .= ':' . i
return 1
elseif line[0] == " "
let indent = len(matchstr(line, '^ *'))
if (indent % 2 == 0 || indent % 3 == 0) && indent < minindent
let minindent = indent
endif
endif
endfor
if minindent < 10
setlocal expandtab
let &shiftwidth=minindent
let b:sleuth_culprit .= ':' . i
return 1
endif
return 0
endfunction
function! s:detect_indent() abort
if &buftype ==# 'help'
return
endif
let b:sleuth_culprit = expand("<afile>:p")
if s:guess(getline(1, 32))
return
endif
let pattern = sleuth#GlobForFiletype(&filetype)
if len(pattern) == 0
return
endif
let pattern = '{' . pattern . ',.git,.svn,.hg}'
let dir = expand('%:p:h')
let level = 3
while isdirectory(dir) && dir !=# fnamemodify(dir, ':h') && level > 0
" Ignore files from homedir and root
if dir == expand('~') || dir == '/'
unlet b:sleuth_culprit
return
endif
for neighbor in glob(dir . '/' . pattern, 0, 1)[0:level]
let b:sleuth_culprit = neighbor
" Do not consider directories above .git, .svn or .hg
if fnamemodify(neighbor, ":h:t")[0] == "."
let level = 0
continue
endif
if neighbor !=# expand('%:p') && filereadable(neighbor)
if s:guess(readfile(neighbor, '', 32))
return
endif
endif
endfor
let dir = fnamemodify(dir, ':h')
let level -= 1
endwhile
unlet b:sleuth_culprit
endfunction
setglobal smarttab
function! SleuthIndicator() abort
let sw = &shiftwidth ? &shiftwidth : &tabstop
if &expandtab
return 'sw='.sw
elseif &tabstop == sw
return 'ts='.&tabstop
else
return 'sw='.sw.',ts='.&tabstop
endif
endfunction
augroup polyglot-sleuth
au!
au FileType * call s:detect_indent()
au User Flags call Hoist('buffer', 5, 'SleuthIndicator')
augroup END
command! -bar -bang Sleuth call s:detect_indent()
endif
func! s:verify()
if exists("g:polyglot_disabled_not_set")
if exists("g:polyglot_disabled")
echohl WarningMsg
echo "vim-polyglot: g:polyglot_disabled should be defined before loading vim-polyglot"
echohl None
endif
unlet g:polyglot_disabled_not_set
endif
endfunc
au VimEnter * call s:verify()
" Save polyglot_disabled without postfixes
if exists('g:polyglot_disabled')
let g:polyglot_disabled = s:new_polyglot_disabled
endif
" restore Vi compatibility settings
let &cpo = s:cpo_save
""" end

View File

@@ -12,11 +12,6 @@ Dir.chdir(File.dirname(__dir__))
BASE_URL = 'https://raw.githubusercontent.com/github/linguist/master'
def read_section(name)
"\" Please do not edit this file directly, instead modify polyglot.vim or scripts/build\n\n" +
File.read('polyglot.vim').match(/""" #{Regexp.escape(name)}\n*(.*)\n(?=\n""")/m)[1]
end
def camelize(str)
str.split(/[-_\.]/).map { |a| a.capitalize }.join("")
end
@@ -27,22 +22,77 @@ def except(hash, *keys)
h
end
def verify(packages, heuristics)
extensions_with_heuristics = Set.new(heuristics.flat_map { |e| e["extensions"] })
no_heuristics = Hash.new { |a, b| a[b] = [] }
for p in packages
for f in p["filetypes"]
for e in f["extensions"]
if !extensions_with_heuristics.include?(e)
no_heuristics[e] << p["name"]
end
end
end
end
no_heuristics.select! { |a, b| b.size > 1}
for e, names in no_heuristics
if ENV["DEV"]
puts "No heuristics for .#{e} extension (#{names.join(", ")})"
end
end
end
def sort_packages(packages)
implicit_dependencies = Hash.new { |h, k| h[k] = [] }
by_extension = Hash.new { |h, k| h[k] = [] }
for p in packages
for f in p["filetypes"]
for e in f["extensions"]
by_extension[e] << p["name"]
end
end
end
for p in packages
for f in p["filetypes"]
for t in f["filenames"]
filename = t.split('/').last
if filename.include?(".")
ext = filename.split(".").last.gsub('*', '')
if by_extension[ext]
for name in by_extension[ext]
if p["name"] != name
implicit_dependencies[p["name"]] |= [name]
end
end
end
end
end
end
end
packages = Hash[packages.group_by { |a| a.fetch("name") }.map { |a, b| [a, b.first] }]
each_node = lambda { |&b| packages.keys.each(&b) }
each_child = lambda { |n, &b|
[
implicit_dependencies[n] || [],
packages[n]["dependencies"] || [],
packages[n]["after"] || []
].flatten.each(&b)
}
TSort.tsort(each_node, each_child).map { |a| packages[a] }
end
def load_data()
packages = Hash[YAML.load_stream(File.read('packages.yaml'))
.group_by { |a| a.fetch("name") }
.map { |a, b| [a, b.first] }]
deps = Hash.new { |h, k| h[k] = [] }
each_node = lambda {|&b| packages.keys.each(&b) }
each_child = lambda {|n, &b| [packages[n]["after"] || []].flatten.each(&b) }
packages = load_packages
languages = load_languages
# Reason can have ocaml as interpreter but let's not depend on it...
languages["Reason"]["interpreters"] -= ["ocaml"]
packages = TSort.tsort(each_node, each_child).map { |a| packages[a] }
heuristics = load_heuristics
for package in packages
for filetype in package["filetypes"]
@@ -90,7 +140,9 @@ def load_data()
end
end
heuristics = YAML.load_stream(File.read('heuristics.yaml'))
verify(packages, heuristics)
packages = sort_packages(packages)
[packages, transform_patterns(heuristics)]
end
@@ -144,6 +196,14 @@ def load_languages
YAML.load(File.read(file))
end
def load_packages
YAML.load_stream(File.read('packages.yaml'))
end
def load_heuristics
YAML.load_stream(File.read('heuristics.yaml'))
end
def parse_remote(remote)
match = remote.match(/(?<repo>[^@:]+)(?:@(?<branch>[^:]+))?(?::(?<path>.*))?/)
dir = "tmp/" + match[:repo] + (match[:branch] ? "-#{match[:branch]}" : "")
@@ -322,10 +382,17 @@ def rule_to_code(rule)
EOS
end
if rule.has_key?("shebang")
return <<~EOS
if polyglot#shebang#Detect() | return | endif
#{indent(rule_to_code(except(rule, "shebang")), 0)}
EOS
end
if rule.has_key?("filetype")
if rule.has_key?("fallback")
return <<~EOS
set ft=#{rule["filetype"]} | au! BufWritePost <buffer> ++once call polyglot#Detect#{camelize(rule["extensions"].first)}Filetype()
set ft=#{rule["filetype"]} | au BufWritePost <buffer> ++once call polyglot#detect##{camelize(rule["extensions"].first)}()
return
EOS
end
@@ -353,7 +420,7 @@ def rule_to_code(rule)
end
def extract(packages)
all_dirs = %w(syntax indent doc compiler autoload ftplugin ctags extras after)
all_dirs = %w(syntax indent doc compiler ftplugin ctags extras after)
default_dirs = %w(
syntax indent doc compiler autoload ftplugin ctags extras
@@ -362,6 +429,12 @@ def extract(packages)
FileUtils.rm_rf(all_dirs)
for dir in Dir.glob("*", base: "autoload")
if dir != "polyglot"
FileUtils.rm_rf("autoload/" + dir)
end
end
output = []
packages.map do |package|
repo, branch, path, dir = parse_remote(package["remote"])
@@ -421,21 +494,10 @@ def extract(packages)
end
def generate_ftdetect(packages, heuristics)
FileUtils.mkdir_p('autoload/polyglot')
output = "\n"
extensions = Hash.new { |h, k| h[k] = [] }
for package in packages
for filetype in package["filetypes"]
for ext in filetype["extensions"]
extensions[ext] << filetype["name"]
end
end
end
ambiguous_extensions = extensions
.select { |a, b| b.uniq.size > 1 }.keys.sort
all_filetypes = packages.flat_map { |f| f["filetypes"] || [] }
filetype_names = Set.new(all_filetypes.map { |f| f["name"] })
@@ -447,43 +509,18 @@ def generate_ftdetect(packages, heuristics)
native_extensions = Set.new(native_filetypes.flat_map { |f| f["extensions"] || [] })
native_filenames = Set.new(native_filetypes.flat_map { |f| f["filenames"] || [] })
for package in packages
name = package.fetch("name")
to_disable = []
for filetype in package["filetypes"]
for extension in filetype["extensions"]
if native_extensions.include?(extension)
to_disable << "*." + extension
end
end
for filename in filetype["filenames"]
if native_filenames.include?(filename)
to_disable << filename
end
end
end
if to_disable.size > 0
output << "if !has_key(s:disabled_packages, '#{name}')\n"
output << " au! BufRead,BufNewFile #{to_disable.join(",")}\n"
output << "endif\n\n"
end
end
for package in packages
# Because we're using setf we need to reverse order
for package in packages.reverse
filetypes = package["filetypes"] or raise "Unknown filetype for: #{package["name"]}"
package_heuristics = []
autocommands = ""
autocommands = []
for filetype in filetypes
name = filetype.fetch("name")
syntax = filetype["syntax"] ? " | set syntax=#{filetype["syntax"]}" : ""
set_command = "set ft=#{name}"
set_command = "setf #{name}"
if filetype["syntax"]
set_command = "set ft=#{name} syntax=#{filetype["syntax"]}"
@@ -496,6 +533,8 @@ def generate_ftdetect(packages, heuristics)
extensions = filetype["extensions"]
filenames = filetype["filenames"]
set_globs = []
for extension in extensions.sort
outer_filetype = filetype["outer_filetype"]
if outer_filetype
@@ -507,11 +546,7 @@ def generate_ftdetect(packages, heuristics)
if heuristic
package_heuristics << heuristic
else
# if ambiguous_extensions.include?(extension)
# puts "Ambiguous extension without heuristic: #{extension} => #{filetype["name"]}"
# end
#
autocommands << " au BufNewFile,BufRead *.#{extension} #{set_command}\n"
set_globs << "*." + extension
end
end
@@ -522,48 +557,52 @@ def generate_ftdetect(packages, heuristics)
if filename[-1] == "*"
autocommands << " au BufNewFile,BufRead #{filename} call s:StarSetf('#{name}')\n"
else
autocommands << " au BufNewFile,BufRead #{filename} #{set_command}\n"
set_globs << filename
end
end
if set_globs.size > 0
autocommands << " au BufNewFile,BufRead #{set_globs.join(",")} #{set_command}\n"
end
end
for heuristic in package_heuristics.uniq
extensions = heuristic["extensions"].map { |e| "*.#{e}" }
autocommands << " au! BufNewFile,BufRead #{extensions.join(",")} call polyglot#Detect#{camelize(heuristic["extensions"].first)}Filetype()\n"
autocommands << " au! BufNewFile,BufRead #{extensions.join(",")} call polyglot#detect##{camelize(heuristic["extensions"].first)}()\n"
end
if autocommands != ""
output << "if !has_key(s:disabled_packages, '#{package["name"]}')\n"
output << autocommands
output << autocommands.reverse.join("")
output << "endif\n\n"
end
end
defined_extensions = all_filetypes.flat_map { |f| expand_all(f["extensions"] || []).map { |e| [f["name"], e] } }
expected_extensions = expected_filetypes.flat_map { |f| expand_all(f["extensions"] || []).map { |e| [f["name"], e] } }
ignored_extensions = all_filetypes.flat_map { |f| expand_all(f.fetch("ignored_extensions", [])).map { |e| [f["name"], e] } }
defined_filenames = all_filetypes.flat_map { |f| expand_all(f["filenames"] || []).map { |e| [f["name"], e] } }
expected_filenames = expected_filetypes.flat_map { |f| expand_all(f["filenames"] || []).map { |e| [f["name"], e] } }
ignored_filenames = all_filetypes.flat_map { |f| expand_all(f.fetch("ignored_filenames", [])).map { |e| [f["name"], e] } }
show_warnings(all_filetypes, expected_filetypes)
ignored_warnings = all_filetypes.flat_map { |f| expand_all(f.fetch("ignored_warnings", [])).map { |e| [f["name"], e] } + [f, "*"] }
ftdetect = File.read('ftdetect/polyglot.vim')
for name, e in expected_extensions - defined_extensions - ignored_extensions - ignored_warnings
puts "Missing extension for #{name}: #{e}"
end
for name, e in expected_filenames - defined_filenames - ignored_filenames - ignored_warnings
puts "Missing filename for #{name}: #{e}"
end
ftdetect = read_section('ftdetect/polyglot.vim')
starting = '" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE'
ending = '" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE'
File.write(
'ftdetect/polyglot.vim',
ftdetect.gsub('" scripts/build inserts here filetype detection autocommands') { output }
ftdetect.gsub(/(?<=#{starting}\n)(.*)(?=#{ending})/m) { output }
)
output = ["\" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE\n"]
for heuristic in heuristics
output << <<~EOS
func! polyglot#detect##{camelize(heuristic["extensions"].first)}()
#{indent(rules_to_code(heuristic), 2)}
endfunc
EOS
end
File.write('autoload/polyglot/detect.vim', output.join("\n"))
output = <<~EOS
let s:interpreters = {
EOS
@@ -574,24 +613,15 @@ def generate_ftdetect(packages, heuristics)
end
end
output << <<~EOS
\\ }
output << " \\ }"
EOS
inject_code('autoload/polyglot/shebang.vim', output)
end
for heuristic in heuristics
output << <<~EOS
func! polyglot#Detect#{camelize(heuristic["extensions"].first)}Filetype()
#{indent(rules_to_code(heuristic), 2)}
endfunc
EOS
end
autoload_script = read_section('autoload/polyglot.vim')
autoload_script["\" scripts/build generates heuristics functions here\n"] = output
File.write('autoload/polyglot.vim', autoload_script)
def inject_code(path, code)
header = "\" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE\n"
normal, generated = File.read(path).split(header)
File.write(path, [normal, generated].join(header))
end
def generate_tests(packages)
@@ -650,14 +680,32 @@ def comma_expanson(s)
end
end
def expand_all(pattern)
def expand_all(pattern, all = false)
if !pattern
return []
end
if pattern.is_a?(Array)
return pattern.flat_map { |p| expand_all(p) }
return pattern.flat_map { |p| expand_all(p, all) }
end
comma_expanson(pattern).flat_map do |e|
brace_expansion(e).flat_map do |e2|
square_expansion(e2)
square_expansion(e2).flat_map do |e3|
results = [e3]
if all
if e3[0] == "."
results << e3[1..-1]
end
if e3.include?("*")
results.concat(results.map { |e4| e4.gsub("*", "") })
end
if e3.match(/\*\.[a-z]/)
results << "*." + e3[2].upcase + e3[3..-1]
end
end
results
end
end
end
end
@@ -690,14 +738,18 @@ def detect_filetypes(glob)
end
def generate_plugins(packages)
output = "let s:globs = {\n"
output = <<~EOS
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
let s:globs = {
EOS
patterns = Hash.new { |h, k| h[k] = [] }
for package in packages
for filetype in package["filetypes"]
extensions = (filetype["extensions"] || []).map { |e| "*.#{e}" }
files = (filetype["filenames"] || []).reject { |e| e.match(/\*\*|\//) || e[0] == "." }
files = (filetype["filenames"] || []).reject { |e| e.match(/\*\*|\//) }
patterns[filetype["name"]].concat(extensions)
patterns[filetype["name"]].concat(files)
end
@@ -710,13 +762,46 @@ def generate_plugins(packages)
output << <<~EOS
func! sleuth#GlobForFiletype(type)
func! polyglot#sleuth#GlobForFiletype(type)
return get(s:globs, a:type, '')
endfunc
EOS
File.write('autoload/sleuth.vim', output)
File.write('autoload/polyglot/sleuth.vim', output)
end
def process_list(list, extras)
list.flat_map do |f|
expand_all(yield(f), extras).uniq.map { |e| [f["name"], e] }
end
end
def show_warnings(all_filetypes, expected_filetypes)
if !ENV["DEV"]
return
end
all_expected = process_list(expected_filetypes, false) do |f|
(f["extensions"] || []).map { |e| "*." + e } + (f["filenames"] || [])
end
all_handled = process_list(all_filetypes, all_expected) do |f|
[f["filenames"], f["ignored_filenames"], f["ignored_warnings"], f["extra_filenames"]].compact.flatten +
[f["extensions"], f["ignored_extensions"], f["extra_extensions"]].compact.flatten.map { |e| "*." + e }
end
all_handled_regexps = Hash[all_handled.group_by { |a, b| a }.map do |a, b|
[a, Regexp.union(b.map { |x| Regexp.new(Regexp.escape(x[1]).gsub('\\*', '.*')) })]
end]
for name, e in all_expected - all_handled
if all_handled_regexps[name].match?(e) || e == "*"
next
end
puts "Missing for #{name}: #{e}"
end
end

View File

@@ -18,8 +18,6 @@ def run_vimscript(src)
func! Log(msg)
if $DEV != '1'
echo a:msg
else
echon '.'
endif
endfunc
EOM

View File

@@ -56,6 +56,7 @@ syntax cluster typescriptPrimaryType contains=
\ typescriptTupleType,
\ typescriptTypeQuery,
\ typescriptStringLiteralType,
\ typescriptTemplateLiteralType,
\ typescriptReadonlyArrayKeyword,
\ typescriptAssertType
@@ -64,6 +65,17 @@ syntax region typescriptStringLiteralType contained
\ nextgroup=typescriptUnion
\ skipwhite skipempty
syntax region typescriptTemplateLiteralType contained
\ start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/
\ contains=typescriptTemplateSubstitutionType
\ nextgroup=typescriptTypeOperator
\ skipwhite skipempty
syntax region typescriptTemplateSubstitutionType matchgroup=typescriptTemplateSB
\ start=/\${/ end=/}/
\ contains=@typescriptType
\ contained
syntax region typescriptParenthesizedType matchgroup=typescriptParens
\ start=/(/ end=/)/
\ contains=@typescriptType
@@ -103,10 +115,12 @@ syntax region typescriptTupleType matchgroup=typescriptBraces
\ contained skipwhite
syntax cluster typescriptTypeOperator
\ contains=typescriptUnion,typescriptTypeBracket
\ contains=typescriptUnion,typescriptTypeBracket,typescriptConstraint,typescriptConditionalType
syntax match typescriptUnion /|\|&/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty
syntax match typescriptConditionalType /?\|:/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty
syntax cluster typescriptFunctionType contains=typescriptGenericFunc,typescriptFuncType
syntax region typescriptGenericFunc matchgroup=typescriptTypeBrackets
\ start=/</ end=/>/

View File

@@ -71,6 +71,7 @@ if exists("did_typescript_hilink")
HiLink typescriptString String
HiLink typescriptSpecial Special
HiLink typescriptStringLiteralType String
HiLink typescriptTemplateLiteralType String
HiLink typescriptStringMember String
HiLink typescriptTemplate String
HiLink typescriptEventString String

30
syntax/conf.vim Normal file
View File

@@ -0,0 +1,30 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'conf') == -1
" Vim syntax file
" Language: generic configure file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2005 Jun 20
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
finish
endif
syn keyword confTodo contained TODO FIXME XXX
" Avoid matching "text#text", used in /etc/disktab and /etc/gettytab
syn match confComment "^#.*" contains=confTodo
syn match confComment "\s#.*"ms=s+1 contains=confTodo
syn region confString start=+"+ skip=+\\\\\|\\"+ end=+"+ oneline
syn region confString start=+'+ skip=+\\\\\|\\'+ end=+'+ oneline
" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
hi def link confComment Comment
hi def link confTodo Todo
hi def link confString String
let b:current_syntax = "conf"
" vim: ts=8 sw=2
endif

View File

@@ -20,10 +20,6 @@ syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
syn match elixirId '\<[_a-zA-Z]\w*[!?]\?\>' contains=elixirUnusedVariable
syn match elixirFunctionCall '\<[a-z_]\w*[!?]\?\(\s*\.\?\s*(\|\s\+[a-zA-Z0-9@:\'\"\[]\)\@='
syn match elixirFunctionCall '\(:\w\+\s*\.\s*\|[A-Z]\w*\s*\.\s*\)\@<=[a-z_]\w*[!?]\?'
syn match elixirFunctionCall '\(>\s+\)\<[a-z_]\w*[!?]\?'
syn match elixirKeyword '\(\.\)\@<!\<\(for\|case\|when\|with\|cond\|if\|unless\|try\|receive\|after\|raise\|rescue\|catch\|else\|quote\|unquote\|super\|unquote_splicing\)\>:\@!'
syn keyword elixirInclude import require alias use
@@ -48,7 +44,7 @@ syn match elixirOperator '\~>\|\~>>\|<\~\|<<\~\|<\~>'
syn match elixirAlias '\([a-z]\)\@<![A-Z]\w*\%(\.[A-Z]\w*\)*'
syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)'
syn match elixirAtom '\(:\)\@<!:\%([a-zA-Z_*]\w*\%([?!]\|=[>=]\@!\)\?\|<>\|===\?\|>=\?\|<=\?\)'
syn match elixirAtom '\(:\)\@<!:\%(<=>\|&&\?\|%\(()\|\[\]\|{}\)\|++\?\|--\?\|||\?\|!\|//\|[%&`/|]\)'
syn match elixirAtom "\%([a-zA-Z_]\w*[?!]\?\):\(:\)\@!"

33
syntax/gitignore.vim Normal file
View File

@@ -0,0 +1,33 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
scriptencoding utf-8
" Copyright (c) 2017-2020 Filip Szymański. All rights reserved.
" Use of this source code is governed by an MIT license that can be
" found in the LICENSE file.
if exists('b:current_syntax')
finish
endif
" https://git-scm.com/docs/gitignore#_pattern_format
syntax keyword gitignoreTodo TODO FIXME XXX NOTE SEE contained
syntax match gitignoreComment '^#.*' contains=gitignoreTodo
syntax match gitignoreComment '\s#.*'ms=s+1 contains=gitignoreTodo
syntax match gitignoreNegation '^!'
syntax match gitignoreSeparator '/'
syntax match gitignoreWildcard '\(\\\)\@<![*?]'
syntax region gitignoreSet start='\[' skip='\\\]' end='\]'
highlight default link gitignoreTodo Todo
highlight default link gitignoreComment Comment
highlight default link gitignoreNegation Exception
highlight default link gitignoreSeparator Constant
highlight default link gitignoreWildcard Special
highlight default link gitignoreSet Character
let b:current_syntax = 'gitignore'
" vim: ts=2 et sw=2
endif

View File

@@ -1,68 +1,83 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'less') == -1
" Vim syntax file
" Language: less
" Maintainer: Alessandro Vioni <jenoma@gmail.com>
" URL: https://github.com/genoma/vim-less
" Last Change: 2014 November 24
if exists("b:current_syntax")
finish
endif
runtime! syntax/css.vim
runtime! after/syntax/css.vim
" load files from vim-css3-syntax plugin (https://github.com/hail2u/vim-css3-syntax)
runtime! after/syntax/css/*.vim
syn case ignore
syn region lessDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssTagName,cssPseudoClass,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,lessDefinition,lessComment,lessClassChar,lessVariable,lessMixinChar,lessAmpersandChar,lessFunction,lessNestedSelector,@cssColors fold
syn cluster lessCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp
syn cluster lessCssAttributes contains=css.*Attr,lessEndOfLineComment,lessComment,cssValue.*,cssColor,cssURL,lessDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp
syn match lessVariable "@[[:alnum:]_-]\+" contained
syn match lessVariable "@[[:alnum:]_-]\+" nextgroup=lessVariableAssignment skipwhite
syn match lessVariableAssignment ":" contained nextgroup=lessVariableValue skipwhite
syn match lessVariableValue ".*;"me=e-1 contained contains=lessVariable,lessOperator,lessDefault,cssValue.*,@cssColors "me=e-1 means that the last char of the pattern is not highlighted
syn region lessDefinition matchgroup=cssBraces start="{" end="}" contains=TOP
syn match lessOperator "+" contained
syn match lessOperator "-" contained
syn match lessOperator "/" contained
syn match lessOperator "*" contained
syn match lessProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:" contains=css.*Prop skipwhite nextgroup=lessCssAttribute contained containedin=lessDefinition
syn match lessProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=lessCssAttribute
syn match lessProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=lessCssAttribute
syn match lessCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@lessCssAttributes,lessVariable,lessFunction,lessInterpolation
syn match lessDefault "!default\>" contained
syn match lessNestedSelector "[^/]* {"me=e-1 contained contains=cssTagName,cssAttributeSelector,lessAmpersandChar,lessVariable,lessMixinChar,lessFunction,lessNestedProperty
syn match lessNestedProperty "[[:alnum:]]\+:"me=e-1 contained
" less variables and media queries
syn match lessVariable "@[[:alnum:]_-]\+" nextgroup=lessCssAttribute skipwhite
syn match lessMedia "@media" nextgroup=lessCssAttribute skipwhite
syn match lessDefault "!default" contained
" Less functions
syn match lessFunction "\<\%(escape\|e\|unit\)\>(\@=" contained
syn match lessFunction "\<\%(ceil\|floor\|percentage\|round\|sqrt\|abs\|sin\|asin\|cos\|acos\|tan\|atan\|pi\|pow\|min\|max\)\>(\@=" contained
syn match lessFunction "\<\%(rgb\|rgba\|argb\|argb\|hsl\|hsla\|hsv\|hsva\)\>(\@=" contained
syn match lessFunction "\<\%(hue\|saturation\|lightness\|red\|green\|blue\|alpha\|luma\)\>(\@=" contained
syn match lessFunction "\<\%(saturate\|desaturate\|lighten\|darken\|fadein\|fadeout\|fade\|spin\|mix\|greyscale\|contrast\)\>(\@=" contained
syn match lessFunction "\<\%(multiply\|screen\|overlay\|softlight\|hardlight\|difference\|exclusion\|average\|negation\)\>(\@=" contained
syn match lessMixinChar "\.[[:alnum:]_-]\@=" contained nextgroup=lessClass
syn match lessAmpersandChar "&" contained nextgroup=lessClass,cssPseudoClass
syn match lessClass "[[:alnum:]_-]\+" contained
" Less id class visualization
syn match lessIdChar "#[[:alnum:]_-]\@=" nextgroup=lessId,lessClassIdCall
syn match lessId "[[:alnum:]_-]\+" contained
syn match lessClassIdCall "[[:alnum:]_-]\+()" contained
" functions {{{
syn match lessClassChar "\.[[:alnum:]_-]\@=" nextgroup=lessClass,lessClassCall
syn match lessClass "[[:alnum:]_-]\+" contained
syn match lessClassCall "[[:alnum:]_-]\+()" contained
" string functions
syn keyword lessFunction escape e % containedin=cssDefinition contained
" misc functions
syn keyword lessFunction unit containedin=cssDefinition contained
" math functions
syn keyword lessFunction ceil floor percentage round containedin=cssDefinition contained
" color definition
syn keyword lessFunction rgb rgba argb hsl hsla hsv hsva containedin=cssDefinition contained
" color channel information
syn keyword lessFunction hue saturation lightness red green blue alpha luma containedin=cssDefinition contained
" color operations
syn keyword lessFunction saturate desaturate lighten darken fadein fadeout fade spin mix greyscale contrast containedin=cssDefinition contained
" color blending
syn keyword lessFunction multiply screen overlay softlight hardlight difference exclusion average negation containedin=cssDefinition contained
syn match lessAmpersand "&" contains=lessIdChar,lessClassChar
" }}}
syn region lessInclude start="@import" end=";\|$" contains=lessComment,cssURL,cssUnicodeEscape,cssMediaType,cssStringQ,cssStringQQ
syn match lessComment "//.*$" contains=@Spell
syn keyword lessTodo FIXME NOTE TODO OPTIMIZE XXX contained
syn region lessComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=lessTodo,@Spell
syn region lessCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=lessTodo,@Spell
syn match lessEndOfLineComment "//.*" contains=lessComment,lessTodo,@Spell
hi def link lessVariable Special
hi def link lessVariableValue Constant
hi def link lessDefault Special
hi def link lessComment Comment
hi def link lessFunction Function
hi def link lessMixinChar Special
hi def link lessAmpersandChar Special
hi def link lessNestedProperty Type
hi def link lessClass PreProc
hi def link lessEndOfLineComment lessComment
hi def link lessCssComment lessComment
hi def link lessComment Comment
hi def link lessDefault cssImportant
hi def link lessVariable Identifier
hi def link lessFunction PreProc
hi def link lessTodo Todo
hi def link lessInclude Include
hi def link lessIdChar Special
hi def link lessClassChar Special
hi def link lessAmpersand Character
hi def link lessId Identifier
hi def link lessClass Type
hi def link lessCssAttribute PreProc
hi def link lessClassCall Type
hi def link lessClassIdCall Type
hi def link lessTagName cssTagName
hi def link lessDeprecated cssDeprecated
hi def link lessMedia cssMedia
let b:current_syntax = "less"
" vim:set sw=2:
endif

View File

@@ -25,6 +25,7 @@ syntax keyword odinCase case
syntax keyword odinContinue continue
syntax keyword odinBreak break
syntax keyword odinSizeOf size_of
syntax keyword odinOffsetOf offset_of
syntax keyword odinTypeInfoOf type_info_of
syntax keyword odinTypeIdOf typeid_of
syntax keyword odinTypeOf type_of
@@ -102,6 +103,7 @@ highlight link odinNotIn Keyword
highlight link odinContinue Keyword
highlight link odinBreak Keyword
highlight link odinSizeOf Keyword
highlight link odinOffsetOf Keyword
highlight link odinTypeOf Keyword
highlight link odinTypeInfoOf Keyword
highlight link odinTypeIdOf Keyword

40
syntax/sql.vim Normal file
View File

@@ -0,0 +1,40 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sql') == -1
" Vim syntax file loader
" Language: SQL
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
" Last Change: Thu Sep 15 2005 10:30:02 AM
" Version: 1.0
" Description: Checks for a:
" buffer local variable,
" global variable,
" If the above exist, it will source the type specified.
" If none exist, it will source the default sql.vim file.
"
" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" Default to the standard Vim distribution file
let filename = 'sqloracle'
" Check for overrides. Buffer variables have the highest priority.
if exists("b:sql_type_override")
" Check the runtimepath to see if the file exists
if globpath(&runtimepath, 'syntax/'.b:sql_type_override.'.vim') != ''
let filename = b:sql_type_override
endif
elseif exists("g:sql_type_default")
if globpath(&runtimepath, 'syntax/'.g:sql_type_default.'.vim') != ''
let filename = g:sql_type_default
endif
endif
" Source the appropriate file
exec 'runtime syntax/'.filename.'.vim'
" vim:sw=4:
endif

View File

@@ -2,6 +2,7 @@ function! TestExtension(filetype, filename, content)
call Log('Detecting ' . a:filetype . ' filetype (' . a:filename . ')...')
try
set shortmess+=F
let g:message = ""
exec "noautocmd n " . a:filename
silent put =a:content
@@ -29,6 +30,8 @@ call TestExtension("sh", "bash3", "#! /bin/bash2.3")
call TestExtension("sh", "bash4", "#!/usr/bin/env bash")
call TestExtension("sh", "bash6", "#!/usr/bin/env -i -=split-string foo=bar bash -l foo")
call TestExtension("sh", "bash1", "#!/bin/bash")
" This is defined only by vim-native scripts.vim for now
call TestExtension("sh", "bash7", ":")
" Vim help file
call TestExtension("help", $VIMRUNTIME . "/doc/foobar.txt", "")
@@ -363,8 +366,22 @@ call TestExtension("tt2html", "html.tt2", "<html>")
call TestExtension("html", "empty.html", "")
call TestExtension("mason", "mason1.html", "% my $planet = 42;")
call TestExtension("mason", "mason2.html", "<%filter></%filter>")
call TestExtension("htmldjango", "jinja1.html", "{{ item.href }}")
call TestExtension("htmldjango", "jinja2.html", "{% for item in navigation %}{% endfor %}")
call TestExtension("htmldjango", "jinja3.html", "{% block head %}")
call TestExtension("htmldjango", "jinja4.html", "{# some comment #}")
call TestExtension("xhtml", "xhtml.html", "<DTD XHTML ")
" many html templates use {{ }}, e.g. Angular, we should not assume django
call TestExtension("html", "template.html", "{{ item.href }}")
" .gitignore
call TestExtension("gitignore", ".gitignore", "")
" .xml
call TestExtension("xml", ".fglrxrc", "")
call TestExtension("xml", "fglrxrc", "")
" .conf
call TestExtension("conf", "foo.conf", "")
call TestExtension("conf", "config", "")
call TestExtension("conf", "auto.master", "")

View File

@@ -6,6 +6,7 @@ function! TestFiletype(filetype)
endfunction
call TestFiletype('8th')
call TestFiletype('conf')
call TestFiletype('haproxy')
call TestFiletype('a2ps')
call TestFiletype('a65')
@@ -22,6 +23,7 @@ call TestFiletype('aidl')
call TestFiletype('alsaconf')
call TestFiletype('aml')
call TestFiletype('ampl')
call TestFiletype('csv')
call TestFiletype('xml')
call TestFiletype('ant')
call TestFiletype('apache')
@@ -53,7 +55,6 @@ call TestFiletype('litcoffee')
call TestFiletype('cryptol')
call TestFiletype('crystal')
call TestFiletype('ecrystal')
call TestFiletype('csv')
call TestFiletype('cucumber')
call TestFiletype('cuesheet')
call TestFiletype('dart')
@@ -63,6 +64,7 @@ call TestFiletype('dcov')
call TestFiletype('dd')
call TestFiletype('ddoc')
call TestFiletype('dsdl')
call TestFiletype('yaml')
call TestFiletype('Dockerfile')
call TestFiletype('yaml.docker-compose')
call TestFiletype('elixir')
@@ -76,13 +78,13 @@ call TestFiletype('ferm')
call TestFiletype('fish')
call TestFiletype('fbs')
call TestFiletype('forth')
call TestFiletype('glsl')
call TestFiletype('fsharp')
call TestFiletype('gdscript3')
call TestFiletype('gitconfig')
call TestFiletype('gitrebase')
call TestFiletype('gitsendemail')
call TestFiletype('gitcommit')
call TestFiletype('glsl')
call TestFiletype('gmpl')
call TestFiletype('gnuplot')
call TestFiletype('go')
@@ -221,7 +223,6 @@ call TestFiletype('vmasm')
call TestFiletype('vue')
call TestFiletype('xdc')
call TestFiletype('xsl')
call TestFiletype('yaml')
call TestFiletype('yaml.ansible')
call TestFiletype('helm')
call TestFiletype('help')
@@ -236,3 +237,5 @@ call TestFiletype('odin')
call TestFiletype('bzl')
call TestFiletype('prolog')
call TestFiletype('tads')
call TestFiletype('gitignore')
call TestFiletype('sql')