feat: add first-class Neovim support with enhanced formatting

- Add modern Lua implementation with modular architecture
- Implement HEREDOC preservation and smart comment indentation
- Create dual implementation (Neovim Lua + VimScript fallback)
- Add comprehensive health check and configuration system
- Enhance formatting engine with state machine for context awareness
- Update documentation with Lua configuration examples
- Add memory files for development workflow and conventions
This commit is contained in:
2025-09-09 21:13:38 +03:00
parent 710f68a6e5
commit ce620cd035
18 changed files with 1656 additions and 52 deletions

View File

@@ -8,22 +8,37 @@ if exists('g:loaded_shellspec')
endif
let g:loaded_shellspec = 1
" Commands
command! ShellSpecFormat call shellspec#format_buffer()
command! -range ShellSpecFormatRange call shellspec#format_selection()
" Detect Neovim and use appropriate implementation
if has('nvim-0.7')
" Use modern Neovim Lua implementation
lua require('shellspec.autocmds').setup()
" Auto commands
augroup ShellSpec
autocmd!
autocmd FileType shellspec setlocal commentstring=#\ %s
autocmd FileType shellspec setlocal foldmethod=indent
autocmd FileType shellspec setlocal shiftwidth=2 tabstop=2 expandtab
augroup END
" Create commands that delegate to Lua
command! ShellSpecFormat lua require('shellspec').format_buffer()
command! -range ShellSpecFormatRange lua require('shellspec').format_selection(0, <line1>, <line2>)
" Optional: Auto-format on save
if get(g:, 'shellspec_auto_format', 0)
augroup ShellSpecAutoFormat
" Optional: Auto-format on save (handled in Lua)
" This is now managed by the Lua autocmds module based on configuration
else
" Fallback to VimScript implementation for older Vim
" Commands
command! ShellSpecFormat call shellspec#format_buffer()
command! -range ShellSpecFormatRange call shellspec#format_selection()
" Auto commands
augroup ShellSpec
autocmd!
autocmd BufWritePre *.spec.sh,*_spec.sh ShellSpecFormat
autocmd FileType shellspec setlocal commentstring=#\ %s
autocmd FileType shellspec setlocal foldmethod=indent
autocmd FileType shellspec setlocal shiftwidth=2 tabstop=2 expandtab
augroup END
" Optional: Auto-format on save
if get(g:, 'shellspec_auto_format', 0)
augroup ShellSpecAutoFormat
autocmd!
autocmd BufWritePre *.spec.sh,*_spec.sh ShellSpecFormat
augroup END
endif
endif