Untitled.mov
This is a simple plugin that helps to end certain structures automatically. In Ruby, this means adding end after if, do, def, etc.
Supported Languages: Ruby, Lua, Vimscript, Bash, Elixir, Fish, Julia
You can install this plugin using your favorite plugin manager or packages
feature in Neovim.
Note
This plugin does not support lazy loading.
After installing the plugin, make sure that you install the Treesitter parsers for the languages. For example, if you use nvim-treesitter:
:TSInstall ruby lua vim bash elixir fish julia
Also make sure that you have enabled Treesitter highlighting for the filetypes you want to use this plugin with.
vim.api.nvim_create_autocmd('FileType', {
pattern = {'ruby', 'lua', 'vim', 'bash', 'elixir', 'fish', 'julia'},
callback = function()
vim.treesitter.start()
end
})
If you want to enable this plugin for some filetypes only, you can use the following code:
vim.g.treesitter_endwise_filetypes = {'ruby', 'lua', 'vim', 'bash', 'elixir', 'fish', 'julia'}
Or to disable it for some filetypes:
vim.g.treesitter_endwise_filetypes_disable = {'fish'}
Please open an issue for new languages, right now I'm open PRs but I won't be implementing other languages myself (except for maybe shell script). See RRethy#2 (comment) for more information on adding support for a new language.
This is just a rewrite of https://github.com/tpope/vim-endwise to leverage Treesitter so it can be more accurate and work without having to run Neovim's slow regex based highlighting along with nvim-treesitter highlighting.
Special thanks to
- @jasonrhansen who added support for injected languages and Vimscript.
- @simonmandlik who added support for Julia.