sheerun / vim-polyglot

A solid language pack for Vim.
5.54k stars 292 forks source link
language-packs plugin vim

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.

*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:

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:

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.