# Neovim ShellSpec DSL Support Advanced language support and formatter for ShellSpec DSL testing framework with first-class Neovim support. ## Installation ### With [lazy.nvim](https://github.com/folke/lazy.nvim) ```lua { "ivuorinen/nvim-shellspec", ft = "shellspec", config = function() require("shellspec").setup({ auto_format = true, indent_size = 2, indent_comments = true, }) end, } ``` ### With [vim-plug](https://github.com/junegunn/vim-plug) ```vim Plug 'ivuorinen/nvim-shellspec' ``` ### Manual Installation ```bash git clone https://github.com/ivuorinen/nvim-shellspec.git ~/.config/nvim/pack/plugins/start/nvim-shellspec ``` ## Features - **🚀 First-class Neovim support** with modern Lua implementation - **🎨 Syntax highlighting** for all ShellSpec DSL keywords - **📐 Smart indentation** for block structures - **📄 Enhanced filetype detection** for `*_spec.sh`, `*.spec.sh`, `spec/*.sh`, and `test/*.sh` - **✨ Advanced formatting** with HEREDOC and comment support - **⚡ Async formatting** to prevent blocking (Neovim 0.7+) - **🔄 Backward compatibility** with Vim and older Neovim versions ### Advanced Formatting Features - **HEREDOC Preservation**: Maintains original formatting within `<sf', 'ShellSpecFormat', { desc = 'Format ShellSpec buffer' }) vim.keymap.set('v', 'sf', 'ShellSpecFormatRange', { desc = 'Format ShellSpec selection' }) ``` ### Vim/Legacy Configuration ```vim " Enable auto-formatting on save let g:shellspec_auto_format = 1 " Enable comment indentation (default: 1) let g:shellspec_indent_comments = 1 " Custom keybindings autocmd FileType shellspec nnoremap f :ShellSpecFormat autocmd FileType shellspec vnoremap f :ShellSpecFormatRange ``` ## Examples ### HEREDOC Formatting The formatter intelligently handles HEREDOC blocks: ```shellspec Describe "HEREDOC handling" It "preserves original formatting within HEREDOC" When call cat < ## License MIT License - see repository for details. ## Related - [ShellSpec](https://github.com/shellspec/shellspec) - BDD testing framework for shell scripts