Vim/Nvim: Open multiple files in splits
Open multiple files in Vim/Nvim in splits with the -o
(top/bottom) and -O
(side-by-side) CLI flags.
vim -o foo.rb foo_test.rb
nvim -O bar.rb bar_test.rb
Wanna get fancy? Here’s a handy way to work on Exercism.io Ruby exercises in Neovim using the built in terminal emulator along with the rerun gem to watch for changes and, you guessed it, rerun your tests.
nvim -O *.rb term://"rerun -x --dir . --pattern '*.rb' -- ruby -r minitest/pride *_test.rb"
Take it to the next level with aliases for multiple Exercism tracks. Add this to your .bashrc
or .zshrc
to work with Ruby and Python:
alias exrb='nvim -O *.rb term://"rerun -x -b --dir . --pattern \"*.rb\" -- ruby -r minitest/pride *_test.rb"'
alias expy='nvim -O *.py term://"rerun -x -b --dir . --pattern \"*.py\" -- pytest *_test.py"'