mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 03:53:52 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c99830e5a | ||
|
|
c4af23e3f8 | ||
|
|
57aeb5fdf5 | ||
|
|
184a9122c1 | ||
|
|
a0644d9c80 |
@@ -5,8 +5,10 @@ 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.
|
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 all files are loaded only on demand.
|
- It **won't affect your startup time**, as all files are loaded only on demand.
|
||||||
- Language packs are merged, not submoduled. It significantly speeds up installation time.
|
- It **installs 40x faster** (unparallelized), as language packs are not submoduled, but merged.
|
||||||
- No support for esoteric languages (there is for modern ones like `slim` though).
|
- It clones even faster as all unnecessary files are ignored (like enormous documentation from php support).
|
||||||
|
- Best syntax and indentation support. If someone releases better language pack, it will be replaced here.
|
||||||
|
- No support for esoteric languages (vim-polyglot supports modern ones like `slim` though).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
" usage:
|
|
||||||
" set indentexpr=scss_indent#GetIndent(v:lnum)
|
|
||||||
fun! scss_indent#GetIndent(lnum)
|
|
||||||
" { -> increase indent
|
|
||||||
" } -> decrease indent
|
|
||||||
if a:lnum == 1
|
|
||||||
" start at 0 indentation
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
" try to find last line ending with { or }
|
|
||||||
" ignoring // comments
|
|
||||||
let regex = '\([{}]\)\%(\/\/.*\)\?$'
|
|
||||||
let nr = search(regex, 'bnW')
|
|
||||||
if nr > 0
|
|
||||||
let last = indent(nr)
|
|
||||||
let m = matchlist(getline(nr), regex)
|
|
||||||
let m_curr = matchlist(getline(a:lnum), regex)
|
|
||||||
echoe string(m).string(m_curr)
|
|
||||||
if !empty(m_curr) && m_curr[1] == '}' && m[1] == '{'
|
|
||||||
" last was open, current is close, use same indent
|
|
||||||
return last
|
|
||||||
elseif !empty(m_curr) && m_curr[1] == '}' && m[1] == '}'
|
|
||||||
" } line and last line was }: decrease
|
|
||||||
return last - &sw
|
|
||||||
endif
|
|
||||||
if m[1] == '{'
|
|
||||||
" line after {: increase indent
|
|
||||||
return last + &sw
|
|
||||||
else
|
|
||||||
" line after } or { - same indent
|
|
||||||
return last
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
105
build
105
build
@@ -1,12 +1,11 @@
|
|||||||
#!/usr/bin/env zsh
|
#!/bin/sh
|
||||||
|
|
||||||
set -E
|
set -E
|
||||||
setopt extended_glob
|
|
||||||
|
|
||||||
DIRS=(
|
DIRS="
|
||||||
syntax indent ftplugin ftdetect autoload compiler
|
syntax indent ftplugin ftdetect autoload compiler
|
||||||
after/syntax after/indent after/ftplugin after/ftdetect
|
after/syntax after/indent after/ftplugin after/ftdetect
|
||||||
)
|
"
|
||||||
|
|
||||||
copy_dir() {
|
copy_dir() {
|
||||||
if [ -d "$1/$2" ]; then
|
if [ -d "$1/$2" ]; then
|
||||||
@@ -19,59 +18,71 @@ copy_dir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Fetches syntax files from given Github repo
|
# Fetches syntax files from given Github repo
|
||||||
syntax() {
|
|
||||||
dir="tmp/$(echo "$1" | cut -d '/' -f 2)"
|
|
||||||
echo "- [$1](https://github.com/$1)"
|
|
||||||
rm -rf "$dir"
|
|
||||||
git clone -q --recursive "https://github.com/$1.git" "$dir"
|
|
||||||
# which tree > /dev/null && tree tmp
|
|
||||||
|
|
||||||
|
download() {
|
||||||
|
for pack in $1; do
|
||||||
|
dir="tmp/$(echo "$pack" | cut -d '/' -f 2)"
|
||||||
|
echo "- [$pack](https://github.com/$pack)"
|
||||||
|
rm -rf "$dir"
|
||||||
|
git clone -q --recursive "https://github.com/$pack.git" "$dir" &
|
||||||
|
done
|
||||||
|
|
||||||
|
wait
|
||||||
|
}
|
||||||
|
|
||||||
|
extract() {
|
||||||
|
for pack in $1; do
|
||||||
|
dir="tmp/$(echo "$pack" | cut -d '/' -f 2)"
|
||||||
|
# which tree > /dev/null && tree tmp
|
||||||
for subdir in $DIRS; do
|
for subdir in $DIRS; do
|
||||||
copy_dir "$dir" "$subdir"
|
copy_dir "$dir" "$subdir"
|
||||||
done
|
done
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
rm -rf $DIRS
|
rm -rf $DIRS
|
||||||
mkdir -p tmp
|
mkdir -p tmp
|
||||||
|
|
||||||
syntax 'vim-ruby/vim-ruby' &
|
PACKS="
|
||||||
syntax 'kchmck/vim-coffee-script' &
|
vim-ruby/vim-ruby
|
||||||
syntax 'tpope/vim-haml' &
|
kchmck/vim-coffee-script
|
||||||
syntax 'tpope/vim-bundler' &
|
tpope/vim-haml
|
||||||
syntax 'pangloss/vim-javascript' &
|
tpope/vim-bundler
|
||||||
syntax 'leshill/vim-json' &
|
pangloss/vim-javascript
|
||||||
syntax 'mutewinter/tomdoc.vim' &
|
leshill/vim-json
|
||||||
syntax 'mutewinter/nginx.vim' &
|
mutewinter/tomdoc.vim
|
||||||
syntax 'timcharper/textile.vim' &
|
mutewinter/nginx.vim
|
||||||
syntax 'tpope/vim-markdown' &
|
timcharper/textile.vim
|
||||||
syntax 'nono/vim-handlebars' &
|
tpope/vim-markdown
|
||||||
syntax 'acustodioo/vim-tmux' &
|
nono/vim-handlebars
|
||||||
syntax 'groenewege/vim-less' &
|
acustodioo/vim-tmux
|
||||||
syntax 'wavded/vim-stylus' &
|
groenewege/vim-less
|
||||||
syntax 'tpope/vim-cucumber' &
|
wavded/vim-stylus
|
||||||
syntax 'jrk/vim-ocaml' &
|
tpope/vim-cucumber
|
||||||
syntax 'slim-template/vim-slim' &
|
jrk/vim-ocaml
|
||||||
syntax 'vim-scripts/XSLT-syntax' &
|
slim-template/vim-slim
|
||||||
syntax 'vim-scripts/python.vim--Vasiliev' &
|
vim-scripts/XSLT-syntax
|
||||||
syntax 'vim-scripts/octave.vim--' &
|
vim-scripts/python.vim--Vasiliev
|
||||||
syntax 'jnwhiteh/vim-golang' &
|
vim-scripts/octave.vim--
|
||||||
syntax 'spf13/PIV' &
|
jnwhiteh/vim-golang
|
||||||
syntax 'briancollins/vim-jst' &
|
spf13/PIV
|
||||||
syntax 'derekwyatt/vim-scala' &
|
briancollins/vim-jst
|
||||||
syntax 'derekwyatt/vim-sbt' &
|
derekwyatt/vim-scala
|
||||||
syntax 'travitch/hasksyn' &
|
derekwyatt/vim-sbt
|
||||||
syntax 'ajf/puppet-vim' &
|
travitch/hasksyn
|
||||||
syntax 'beyondwords/vim-twig' &
|
ajf/puppet-vim
|
||||||
syntax 'sudar/vim-arduino-syntax' &
|
beyondwords/vim-twig
|
||||||
syntax 'guns/vim-clojure-static' &
|
sudar/vim-arduino-syntax
|
||||||
syntax 'chrisbra/csv.vim' &
|
guns/vim-clojure-static
|
||||||
syntax 'elixir-lang/vim-elixir' &
|
chrisbra/csv.vim
|
||||||
syntax 'jimenezrick/vimerl' &
|
elixir-lang/vim-elixir
|
||||||
syntax 'tpope/vim-git' &
|
jimenezrick/vimerl
|
||||||
syntax 'skwp/vim-rspec' &
|
tpope/vim-git
|
||||||
syntax 'cakebaker/scss-syntax.vim' &
|
skwp/vim-rspec
|
||||||
|
"
|
||||||
|
|
||||||
wait
|
download "$PACKS"
|
||||||
|
extract "$PACKS"
|
||||||
|
|
||||||
rm -rf tmp
|
rm -rf tmp
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
au BufRead,BufNewFile *.scss set filetype=scss.css
|
|
||||||
128
syntax/scss.vim
128
syntax/scss.vim
@@ -1,126 +1,20 @@
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: SCSS (Sassy CSS)
|
" Language: SCSS
|
||||||
" Author: Daniel Hofstetter (daniel.hofstetter@42dh.com)
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Inspired by the syntax files for sass and css. Thanks to the authors of
|
" Filenames: *.scss
|
||||||
" those files!
|
" Last Change: 2010 Jul 26
|
||||||
|
|
||||||
if !exists("main_syntax")
|
if exists("b:current_syntax")
|
||||||
if version < 600
|
|
||||||
syntax clear
|
|
||||||
elseif exists("b:current_syntax")
|
|
||||||
finish
|
finish
|
||||||
endif
|
|
||||||
let main_syntax = 'scss'
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime! syntax/css.vim
|
runtime! syntax/sass.vim
|
||||||
runtime! syntax/css/*.vim
|
|
||||||
|
|
||||||
syn case ignore
|
syn match scssComment "//.*" contains=sassTodo,@Spell
|
||||||
|
syn region scssComment start="/\*" end="\*/" contains=sassTodo,@Spell
|
||||||
|
|
||||||
syn region scssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,scssDefinition,scssComment,scssIdChar,scssClassChar,scssAmpersand,scssVariable,scssInclude,scssExtend,scssDebug,scssWarn,@scssControl,scssInterpolation,scssNestedSelector,scssReturn,scssFn
|
hi def link scssComment sassComment
|
||||||
|
|
||||||
syn region scssInterpolation start="#{" end="}" contains=scssVariable
|
|
||||||
|
|
||||||
" functions from http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html
|
|
||||||
syn region scssFn contained matchgroup=scssFnName start="\<\(rgb\|rgba\|red\|green\|blue\|mix\)\s*(" end=")" oneline keepend
|
|
||||||
syn region scssFn contained matchgroup=scssFnName start="\<\(hsl\|hsla\|hue\|saturation\|lightness\|adjust-hue\)\s*(" end=")" oneline keepend
|
|
||||||
syn region scssFn contained matchgroup=scssFnName start="\<\(lighten\|darken\|saturate\|desaturate\|grayscale\|complement\|invert\)\s*(" end=")" oneline keepend
|
|
||||||
syn region scssFn contained matchgroup=scssFnName start="\<\(alpha\|opacity\|opacify\|transparentize\)\s*(" end=")" oneline keepend
|
|
||||||
syn region scssFn contained matchgroup=scssFnName start="\<\(adjust-color\|scale-color\|change-color\|ie-hex-str\)\s*(" end=")" oneline keepend
|
|
||||||
syn region scssFn contained matchgroup=scssFnName start="\<\(unquote\|quote\)\s*(" end=")" oneline keepend
|
|
||||||
syn region scssFn contained matchgroup=scssFnName start="\<\(percentage\|round\|ceil\|floor\|abs\|min\|max\)\s*(" end=")" oneline keepend
|
|
||||||
syn region scssFn contained matchgroup=scssFnName start="\<\(length\|nth\|join\|append\|zip\|index\)\s*(" end=")" oneline keepend
|
|
||||||
syn region scssFn contained matchgroup=scssFnName start="\<\(type-of\|unit\|unitless\|comparable\)\s*(" end=")" oneline keepend
|
|
||||||
syn region scssFn contained matchgroup=scssFnName start="\<\(if\)\s*(" end=")" oneline keepend
|
|
||||||
|
|
||||||
syn match scssVariable "$[[:alnum:]_-]\+" nextgroup=scssVariableAssignment
|
|
||||||
syn match scssVariableAssignment ":" contained nextgroup=scssVariableValue
|
|
||||||
syn match scssVariableValue ".*;"me=e-1 contained contains=scssVariable,scssOperator,scssDefault "me=e-1 means that the last char of the pattern is not highlighted
|
|
||||||
syn match scssMixin "^@mixin" nextgroup=scssMixinName
|
|
||||||
syn match scssMixinName " [[:alnum:]_-]\+" contained nextgroup=scssDefinition
|
|
||||||
syn match scssFunction "^@function" nextgroup=scssFunctionName
|
|
||||||
syn match scssFunctionName " [[:alnum:]_-]\+" contained nextgroup=scssDefinition
|
|
||||||
syn match scssReturn "@return" contained
|
|
||||||
syn match scssInclude "@include" nextgroup=scssMixinName
|
|
||||||
syn match scssExtend "@extend .*[;}]"me=e-1 contains=cssTagName,scssIdChar,scssClassChar
|
|
||||||
syn keyword scssTodo TODO FIXME NOTE OPTIMIZE XXX contained containedIn=scssComment,cssComment
|
|
||||||
|
|
||||||
syn match scssColor "#[0-9A-Fa-f]\{3\}\>" contained
|
|
||||||
syn match scssColor "#[0-9A-Fa-f]\{6\}\>" contained
|
|
||||||
|
|
||||||
syn match scssIdChar "#[[:alnum:]_-]\@=" nextgroup=scssId contains=scssColor
|
|
||||||
syn match scssId "[[:alnum:]_-]\+" contained
|
|
||||||
syn match scssClassChar "\.[[:alnum:]_-]\@=" nextgroup=scssClass
|
|
||||||
syn match scssClass "[[:alnum:]_-]\+" contained
|
|
||||||
syn match scssAmpersand "&" nextgroup=cssPseudoClass
|
|
||||||
|
|
||||||
syn match scssOperator "+" contained
|
|
||||||
syn match scssOperator "-" contained
|
|
||||||
syn match scssOperator "/" contained
|
|
||||||
syn match scssOperator "*" contained
|
|
||||||
|
|
||||||
syn match scssNestedSelector "[^/]* {"me=e-1 contained contains=cssTagName,cssAttributeSelector,scssIdChar,scssClassChar,scssAmpersand,scssVariable,scssMixin,scssFunction,@scssControl,scssInterpolation,scssNestedProperty
|
|
||||||
syn match scssNestedProperty "[[:alnum:]]\+:"me=e-1 contained
|
|
||||||
|
|
||||||
syn match scssDebug "@debug"
|
|
||||||
syn match scssWarn "@warn"
|
|
||||||
syn match scssDefault "!default" contained
|
|
||||||
|
|
||||||
syn match scssIf "@if"
|
|
||||||
syn match scssElse "@else"
|
|
||||||
syn match scssElseIf "@else if"
|
|
||||||
syn match scssWhile "@while"
|
|
||||||
syn match scssFor "@for" nextgroup=scssVariable
|
|
||||||
syn match scssFrom " from "
|
|
||||||
syn match scssTo " to "
|
|
||||||
syn match scssThrough " through "
|
|
||||||
syn match scssEach "@each" nextgroup=scssVariable
|
|
||||||
syn match scssIn " in "
|
|
||||||
syn cluster scssControl contains=scssIf,scssElse,scssElseIf,scssWhile,scssFor,scssFrom,scssTo,scssThrough,scssEach,scssIn
|
|
||||||
|
|
||||||
syn match scssComment "//.*$" contains=@Spell
|
|
||||||
syn region scssImportStr start="\"" end="\""
|
|
||||||
syn region scssImport start="@import" end=";" contains=scssImportStr,scssComment,cssComment,cssUnicodeEscape,cssMediaType,cssUrl
|
|
||||||
|
|
||||||
hi def link scssVariable Identifier
|
|
||||||
hi def link scssVariableValue Constant
|
|
||||||
hi def link scssMixin PreProc
|
|
||||||
hi def link scssMixinName Function
|
|
||||||
hi def link scssFunction PreProc
|
|
||||||
hi def link scssFunctionName Function
|
|
||||||
hi def link scssFn Constant
|
|
||||||
hi def link scssFnName Function
|
|
||||||
hi def link scssReturn Statement
|
|
||||||
hi def link scssInclude PreProc
|
|
||||||
hi def link scssExtend PreProc
|
|
||||||
hi def link scssComment Comment
|
|
||||||
hi def link scssColor Constant
|
|
||||||
hi def link scssIdChar Special
|
|
||||||
hi def link scssClassChar Special
|
|
||||||
hi def link scssId Identifier
|
|
||||||
hi def link scssClass Identifier
|
|
||||||
hi def link scssAmpersand Character
|
|
||||||
hi def link scssNestedProperty Type
|
|
||||||
hi def link scssDebug Debug
|
|
||||||
hi def link scssWarn Debug
|
|
||||||
hi def link scssDefault Special
|
|
||||||
hi def link scssIf Conditional
|
|
||||||
hi def link scssElse Conditional
|
|
||||||
hi def link scssElseIf Conditional
|
|
||||||
hi def link scssWhile Repeat
|
|
||||||
hi def link scssFor Repeat
|
|
||||||
hi def link scssFrom Repeat
|
|
||||||
hi def link scssTo Repeat
|
|
||||||
hi def link scssThrough Repeat
|
|
||||||
hi def link scssEach Repeat
|
|
||||||
hi def link scssIn Repeat
|
|
||||||
hi def link scssInterpolation Delimiter
|
|
||||||
hi def link scssImport Include
|
|
||||||
hi def link scssImportStr Include
|
|
||||||
hi def link scssTodo Todo
|
|
||||||
|
|
||||||
let b:current_syntax = "scss"
|
let b:current_syntax = "scss"
|
||||||
if main_syntax == 'scss'
|
|
||||||
unlet main_syntax
|
" vim:set sw=2:
|
||||||
endif
|
|
||||||
|
|||||||
Reference in New Issue
Block a user