/vim-polyglot

A solid language pack for Vim.

Primary LanguageVim Script

This is my top-starred repository on Github, so I've decided to put this ad here:

If you work for big corp and seek consulting, please visit following repository: https://github.com/sheerun/consultation

vim-polyglot

build Maintenance

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 598 packages it consists of.
  • It is also more secure (scripts loaded for every filetype are generated by vim-polyglot)
  • Best syntax and indentation support (no other features). Hand-selected language packs.
  • Automatically detects indentation (includes performance-optimized version of vim-sleuth, can be disabled)

*To be completely honest, optimized ftdetect script takes around 10ms to load.

Installation

  1. Install Pathogen, Vundle, NeoBundle, or Plug package manager for Vim.
  2. Use this repository as submodule or package.

For example when using Plug (which I recommend):

set nocompatible

call plug#begin()

Plug 'sheerun/vim-polyglot'

call plug#end()

Optionally download one of the releases and unpack it directly under ~/.vim directory.

You can also use Vim 8 built-in package manager:

git clone --depth 1 https://github.com/sheerun/vim-polyglot ~/.vim/pack/plugins/start/vim-polyglot

Language packs

On top of all language packs from vim repository, vim-polyglot includes:

  • acpiasl (Syntax highlighting for asl and dsl files)
  • ansible
  • apiblueprint (API Blueprint syntax highlighting for apib files)
  • applescript (AppleScript syntax highlighting for applescript and scpt files)
  • arduino (Processing syntax highlighting for pde and ino files)
  • asciidoc (AsciiDoc syntax highlighting for asciidoc, adoc and asc files)
  • autohotkey (AutoHotkey syntax highlighting for ahk and ahkl files)
  • bicep (Syntax highlighting for bicep files)
  • blade (Blade syntax highlighting for blade and blade.php files)
  • brewfile
  • c/c++ (C++ and C syntax highlighting for cpp, c++, cc, cp, cxx and 18 more files)
  • caddyfile
  • carp (Syntax highlighting for carp files)
  • cjsx
  • clojure (Clojure syntax highlighting for clj, bb, boot, cl2, cljc and 6 more files)
  • cmake (CMake syntax highlighting for cmake and cmake.in files)
  • coffee-script (CoffeeScript and Literate CoffeeScript syntax highlighting for coffee, cake, cjsx, iced, coffeekup, cson, litcoffee and coffee.md files)
  • cpp-modern
  • cql (Syntax highlighting for cql files)
  • cryptol (Syntax highlighting for cry, cyl, lcry and lcyl files)
  • crystal (Crystal and HTML+ECR syntax highlighting for cr and ecr files)
  • csv (CSV syntax highlighting for csv, tsv and tab files)
  • cucumber (Gherkin syntax highlighting for feature and story files)
  • cue (Syntax highlighting for cue files)
  • dart (Dart syntax highlighting for dart and drt files)
  • dhall (Dhall syntax highlighting for dhall files)
  • dlang (D syntax highlighting for d, di, lst, dd, ddoc and sdl files)
  • docker-compose
  • elixir (Elixir and HTML+EEX syntax highlighting for ex, exs, eex, html.heex, html.leex and leex files)
  • elm (Elm syntax highlighting for elm files)
  • emberscript (EmberScript syntax highlighting for em and emberscript files)
  • emblem (Syntax highlighting for emblem and em files)
  • erlang (Erlang syntax highlighting for erl, app.src, es, escript, hrl, xrl, yrl, app and yaws files)
  • fennel (Syntax highlighting for fnl files)
  • ferm (Syntax highlighting for ferm files)
  • fish (fish syntax highlighting for fish files)
  • flatbuffers (Syntax highlighting for fbs files)
  • fsharp (F# syntax highlighting for fs, fsi and fsx files)
  • git (Git Config syntax highlighting for gitconfig files)
  • gitignore
  • gleam (Syntax highlighting for gleam files)
  • glsl (GLSL syntax highlighting for glsl, fp, frag, frg, fs and 18 more files)
  • gmpl (Syntax highlighting for mod files)
  • gnuplot (Gnuplot syntax highlighting for gp, gnu, gnuplot, p, plot, plt and gpi files)
  • go (Go syntax highlighting for go and tmpl files)
  • gradle
  • graphql (GraphQL syntax highlighting for graphql, gql and graphqls files)
  • haml (Haml syntax highlighting for haml, haml.deface, hamlc and hamlbars files)
  • handlebars (Mustache and Handlebars syntax highlighting for mustache, hogan, hulk, hjs, handlebars, hbs, hdbs and hb files)
  • haproxy (HAProxy syntax highlighting)
  • haskell (Haskell syntax highlighting for hs, hs-boot, hsc, bpk and hsig files)
  • haxe (Haxe and HXML syntax highlighting for hx, hxsl, hxml and hss files)
  • helm
  • help
  • hive (HiveQL syntax highlighting for q, hql and ql files)
  • hjson (Syntax highlighting for hjson files)
  • html5
  • icalendar (Syntax highlighting for ics files)
  • idris2 (Syntax highlighting for idr, ipkg and lidr files)
  • idris (Idris syntax highlighting for idr and lidr files)
  • ion (Syntax highlighting for ion files)
  • javascript-sql
  • javascript (JavaScript syntax highlighting for js, bones, cjs, es, es6 and 20 more files)
  • jenkins (Syntax highlighting for jenkinsfile and Jenkinsfile files)
  • jq (JSONiq syntax highlighting for jq files)
  • json5 (JSON5 syntax highlighting for json5 files)
  • json (JSON syntax highlighting for json, 4DForm, 4DProject, avsc, geojson and 15 more files)
  • jsonc (Syntax highlighting for cjson and jsonc files)
  • jsonnet (Jsonnet syntax highlighting for jsonnet and libsonnet files)
  • jst (EJS syntax highlighting for ejs, ect, ejs.t and jst files)
  • jsx (Syntax highlighting for jsx files)
  • julia (Julia syntax highlighting for jl files)
  • just (Syntax highlighting for just files)
  • kotlin (Kotlin syntax highlighting for kt, ktm and kts files)
  • ledger (Syntax highlighting for ldg, ledger and journal files)
  • lilypond (LilyPond syntax highlighting for ly and ily files)
  • livescript (LiveScript syntax highlighting for ls files)
  • llvm (LLVM syntax highlighting for ll and td files)
  • log (Syntax highlighting for log and LOG files)
  • lua (Lua syntax highlighting for lua, fcgi, nse, p8, rbxs, rockspec and wlua files)
  • mako (Mako syntax highlighting for mako and mao files)
  • markdown (Markdown syntax highlighting for md, livemd, markdown, mdown, mdwn and 6 more files)
  • mathematica (Mathematica syntax highlighting for mathematica, cdf, m, ma, mt and 6 more files)
  • mdx (Syntax highlighting for mdx files)
  • mermaid (Syntax highlighting for mermaid, mm and mmd files)
  • meson (Meson syntax highlighting for wrap files)
  • mint (Syntax highlighting for mint files)
  • moonscript (MoonScript syntax highlighting for moon files)
  • nftables (Syntax highlighting for nft files)
  • nginx (Nginx syntax highlighting for nginx, nginxconf and vhost files)
  • nim (Nim syntax highlighting for nim, nim.cfg, nimble, nimrod and nims files)
  • nix (Nix syntax highlighting for nix files)
  • objc (Objective-C syntax highlighting for m and h files)
  • ocaml (OCaml syntax highlighting for ml, eliom, eliomi, ml4, mli and 13 more files)
  • octave (Syntax highlighting for oct and m files)
  • odin (Odin syntax highlighting for odin files)
  • opencl (OpenCL syntax highlighting for cl and opencl files)
  • openscad (Syntax highlighting for scad files)
  • org (Syntax highlighting for org files)
  • perl (Perl syntax highlighting for pl, al, cgi, fcgi, perl and 12 more files)
  • pest (Syntax highlighting for pest files)
  • pgsql (PLpgSQL syntax highlighting for pgsql files)
  • php (PHP syntax highlighting for php, aw, ctp, fcgi, inc and 7 more files)
  • plantuml (PlantUML syntax highlighting for puml, iuml, plantuml, uml and pu files)
  • pony (Pony syntax highlighting for pony files)
  • powershell (PowerShell syntax highlighting for ps1, psd1, psm1, pssc and ps1xml files)
  • protobuf (Protocol Buffer syntax highlighting for proto files)
  • pug (Pug syntax highlighting for jade and pug files)
  • puppet (Puppet syntax highlighting for pp and epp files)
  • purescript (PureScript syntax highlighting for purs files)
  • python-compiler
  • python-indent
  • python (Python syntax highlighting for py, cgi, fcgi, gyp, gypi and 14 more files)
  • qmake (QMake syntax highlighting for pro and pri files)
  • qml (QML syntax highlighting for qml and qbs files)
  • r-lang (R syntax highlighting for r, rsx, s, S and rd files)
  • racket (Racket syntax highlighting for rkt, rktd, rktl and scrbl files)
  • ragel (Ragel syntax highlighting for rl files)
  • raku (Raku syntax highlighting for 6pl, 6pm, nqp, p6, p6l and 12 more files)
  • raml (RAML syntax highlighting for raml files)
  • razor (HTML+Razor syntax highlighting for cshtml and razor files)
  • reason (Reason syntax highlighting for re and rei files)
  • requirements (Syntax highlighting for pip files)
  • rspec
  • rst (reStructuredText syntax highlighting for rst, rest, rest.txt and rst.txt files)
  • ruby (Ruby and HTML+ERB syntax highlighting for rb, builder, eye, fcgi, gemspec and 26 more files)
  • rust (Rust syntax highlighting for rs and rs.in files)
  • scala (Scala syntax highlighting for scala, kojo and sc files)
  • scss (SCSS syntax highlighting for scss files)
  • sh (Shell syntax highlighting for sh, bash, bats, cgi, command and 8 more files)
  • slim (Slim syntax highlighting for slim files)
  • slime (Syntax highlighting for slime files)
  • smt2 (SMT syntax highlighting for smt2 and smt files)
  • solidity (Solidity syntax highlighting for sol files)
  • stylus (Stylus syntax highlighting for styl and stylus files)
  • svelte (Svelte syntax highlighting for svelte files)
  • svg-indent
  • svg (SVG syntax highlighting for svg files)
  • sway (Syntax highlighting for swayconfig and sway.config files)
  • swift (Swift syntax highlighting for swift files)
  • sxhkd (Syntax highlighting for sxhkdrc files)
  • systemd (Syntax highlighting for automount, dnssd, link, mount, netdev and 9 more files)
  • terraform (HCL syntax highlighting for tf, tfvars, hcl, nomad and workflow files)
  • textile (Textile syntax highlighting for textile files)
  • thrift (Thrift syntax highlighting for thrift files)
  • tmux
  • toml (TOML syntax highlighting for toml files)
  • tptp (Syntax highlighting for p, tptp and ax files)
  • twig (Twig syntax highlighting for twig and xml.twig files)
  • typescript (TypeScript and TSX syntax highlighting for ts, cts, mts and tsx files)
  • unison (Syntax highlighting for u and uu files)
  • v (V syntax highlighting for v, vv and vsh files)
  • vala (Vala syntax highlighting for vala, vapi and valadoc files)
  • vbnet (Visual Basic .NET syntax highlighting for vb and vbhtml files)
  • vcl (VCL syntax highlighting for vcl files)
  • velocity (Syntax highlighting for vm files)
  • vue (Vue syntax highlighting for vue and wpy files)
  • xdc (Syntax highlighting for xdc files)
  • xml (XML syntax highlighting for xml, adml, admx, ant, axaml and 97 more files)
  • xsl (XSLT syntax highlighting for xslt and xsl files)
  • yard
  • zephir (Zephir syntax highlighting for zep files)
  • zig (Zig syntax highlighting for zir, zig and zir files)
  • zinit

Updating

You can either wait for new patch release with updates or run make by yourself.

Troubleshooting

Please make sure you have set nocompatible in your .vimrc (or use something like sheerun/vimrc)

Individual language packs can be disabled by setting g:polyglot_disabled as follows:

Please declare this variable before polyglot is loaded (at the top of .vimrc)

let g:polyglot_disabled = ['markdown']

The list of available languages to disable is shown above.

If you wish to use filetype detection by Vim Polyglot but you'd like to use your own syntax-highlighting plugin, you can append .plugin to disabled entry, like below. Disabling Vim Polyglot filetype plugin won't disable native Vim filetype plugin.

let g:polyglot_disabled = ['markdown.plugin']

Please note that disabling a language won't make in your vim startup any faster / slower (only for specific this specific filetype). All plugins are lazily loaded only when they are really needed.

Autoindent

Vim Polyglot tries to automatically detect indentation settings (just like vim-sleuth). If this feature is not working for you for some reason, please file an issue and disable it temporarily with:

let g:polyglot_disabled = ['autoindent']

Reindent

If you want to disable reindenting of the current line in insert mode (see vim 'indentkeys') you can turn it off with:

autocmd BufEnter * set indentexpr=

This will not affect smart autoindenting when starting a new line.

Default settings

Vim Polyglot sets defaults of some settings that are relevant for good language support. You can disable them by:

let g:polyglot_disabled = ['sensible']

These defaults include:

  • Use utf-8 encoding by default
  • Automatically reload file if changed somewhere else
  • Disable existing swapfile warnings, instead just create multiple swapfiles
  • Don't create swapfiles in current directory, instead in data directory
  • Whitespace characters when using :set list
  • Delete comment character when joining commented lines
  • Search upwards for tags file(s) instead only locally
  • Fix issues with fish shell
  • Increase history size to 1000 items
  • Allow for up to 50 opened tabs on Vim start.
  • Reduce updatetime from 4000 to 300 to avoid issues with coc.nvim
  • Always save upper case variables to viminfo file
  • Don't save options in sessions and views
  • Allow color schemes to do bright colors without forcing bold
  • Load vim's built-in matchit plugin

No ftdetect

If you want to use vim-polyglot plugins, but not ftdetect autocommands, the you can disable it as so:

let g:polyglot_disabled = ['ftdetect']

Contributing

Language packs are periodically updated using automated scripts/build script.

Feel free to add your language to packages.yaml + heuristics.yaml, and send pull-request. You can run make test to run rough tests. And make dev for easy development.

License

See linked repositories for detailed license information. This repository is MIT-licensed.