mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33: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.
|
||||
|
||||
- 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.
|
||||
- No support for esoteric languages (there is for modern ones like `slim` though).
|
||||
- It **installs 40x faster** (unparallelized), as language packs are not submoduled, but merged.
|
||||
- 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
|
||||
|
||||
|
||||
@@ -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
|
||||
109
build
109
build
@@ -1,12 +1,11 @@
|
||||
#!/usr/bin/env zsh
|
||||
#!/bin/sh
|
||||
|
||||
set -E
|
||||
setopt extended_glob
|
||||
|
||||
DIRS=(
|
||||
DIRS="
|
||||
syntax indent ftplugin ftdetect autoload compiler
|
||||
after/syntax after/indent after/ftplugin after/ftdetect
|
||||
)
|
||||
"
|
||||
|
||||
copy_dir() {
|
||||
if [ -d "$1/$2" ]; then
|
||||
@@ -19,15 +18,25 @@ copy_dir() {
|
||||
}
|
||||
|
||||
# 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
|
||||
|
||||
for subdir in $DIRS; do
|
||||
copy_dir "$dir" "$subdir"
|
||||
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
|
||||
copy_dir "$dir" "$subdir"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
@@ -35,43 +44,45 @@ rm -rf tmp
|
||||
rm -rf $DIRS
|
||||
mkdir -p tmp
|
||||
|
||||
syntax 'vim-ruby/vim-ruby' &
|
||||
syntax 'kchmck/vim-coffee-script' &
|
||||
syntax 'tpope/vim-haml' &
|
||||
syntax 'tpope/vim-bundler' &
|
||||
syntax 'pangloss/vim-javascript' &
|
||||
syntax 'leshill/vim-json' &
|
||||
syntax 'mutewinter/tomdoc.vim' &
|
||||
syntax 'mutewinter/nginx.vim' &
|
||||
syntax 'timcharper/textile.vim' &
|
||||
syntax 'tpope/vim-markdown' &
|
||||
syntax 'nono/vim-handlebars' &
|
||||
syntax 'acustodioo/vim-tmux' &
|
||||
syntax 'groenewege/vim-less' &
|
||||
syntax 'wavded/vim-stylus' &
|
||||
syntax 'tpope/vim-cucumber' &
|
||||
syntax 'jrk/vim-ocaml' &
|
||||
syntax 'slim-template/vim-slim' &
|
||||
syntax 'vim-scripts/XSLT-syntax' &
|
||||
syntax 'vim-scripts/python.vim--Vasiliev' &
|
||||
syntax 'vim-scripts/octave.vim--' &
|
||||
syntax 'jnwhiteh/vim-golang' &
|
||||
syntax 'spf13/PIV' &
|
||||
syntax 'briancollins/vim-jst' &
|
||||
syntax 'derekwyatt/vim-scala' &
|
||||
syntax 'derekwyatt/vim-sbt' &
|
||||
syntax 'travitch/hasksyn' &
|
||||
syntax 'ajf/puppet-vim' &
|
||||
syntax 'beyondwords/vim-twig' &
|
||||
syntax 'sudar/vim-arduino-syntax' &
|
||||
syntax 'guns/vim-clojure-static' &
|
||||
syntax 'chrisbra/csv.vim' &
|
||||
syntax 'elixir-lang/vim-elixir' &
|
||||
syntax 'jimenezrick/vimerl' &
|
||||
syntax 'tpope/vim-git' &
|
||||
syntax 'skwp/vim-rspec' &
|
||||
syntax 'cakebaker/scss-syntax.vim' &
|
||||
PACKS="
|
||||
vim-ruby/vim-ruby
|
||||
kchmck/vim-coffee-script
|
||||
tpope/vim-haml
|
||||
tpope/vim-bundler
|
||||
pangloss/vim-javascript
|
||||
leshill/vim-json
|
||||
mutewinter/tomdoc.vim
|
||||
mutewinter/nginx.vim
|
||||
timcharper/textile.vim
|
||||
tpope/vim-markdown
|
||||
nono/vim-handlebars
|
||||
acustodioo/vim-tmux
|
||||
groenewege/vim-less
|
||||
wavded/vim-stylus
|
||||
tpope/vim-cucumber
|
||||
jrk/vim-ocaml
|
||||
slim-template/vim-slim
|
||||
vim-scripts/XSLT-syntax
|
||||
vim-scripts/python.vim--Vasiliev
|
||||
vim-scripts/octave.vim--
|
||||
jnwhiteh/vim-golang
|
||||
spf13/PIV
|
||||
briancollins/vim-jst
|
||||
derekwyatt/vim-scala
|
||||
derekwyatt/vim-sbt
|
||||
travitch/hasksyn
|
||||
ajf/puppet-vim
|
||||
beyondwords/vim-twig
|
||||
sudar/vim-arduino-syntax
|
||||
guns/vim-clojure-static
|
||||
chrisbra/csv.vim
|
||||
elixir-lang/vim-elixir
|
||||
jimenezrick/vimerl
|
||||
tpope/vim-git
|
||||
skwp/vim-rspec
|
||||
"
|
||||
|
||||
wait
|
||||
download "$PACKS"
|
||||
extract "$PACKS"
|
||||
|
||||
rm -rf tmp
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
au BufRead,BufNewFile *.scss set filetype=scss.css
|
||||
130
syntax/scss.vim
130
syntax/scss.vim
@@ -1,126 +1,20 @@
|
||||
" Vim syntax file
|
||||
" Language: SCSS (Sassy CSS)
|
||||
" Author: Daniel Hofstetter (daniel.hofstetter@42dh.com)
|
||||
" Inspired by the syntax files for sass and css. Thanks to the authors of
|
||||
" those files!
|
||||
" Language: SCSS
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Filenames: *.scss
|
||||
" Last Change: 2010 Jul 26
|
||||
|
||||
if !exists("main_syntax")
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let main_syntax = 'scss'
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! syntax/css.vim
|
||||
runtime! syntax/css/*.vim
|
||||
runtime! syntax/sass.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
|
||||
|
||||
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
|
||||
hi def link scssComment sassComment
|
||||
|
||||
let b:current_syntax = "scss"
|
||||
if main_syntax == 'scss'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
Reference in New Issue
Block a user