A REPL is an excellent tool for exploring data or spiking out ideas. We can quickly answer our questions, then get back to our editor to resume feature work. But when we are unable to get answers quickly and complexity mounts, the REPL becomes a hindrance1. Much of our time is spent moving back through the command history, hunting for that one thing we need. If we instead do this exploration within our editor, we can retain every piece of code we write, while maintaining the quick feedback loop. It becomes easier to make adjustments or find that one thing. We'll need to execute these scripts differently, depending on the type, which we can configure Vim to do. We can take advantage of the filetype plugin system to use the same mapping for all our scripts. Let's use <leader>x as the mapping, as a mnemonic for "execute." We'll make use of the clear command to keep our output isolated, so we can focus on it. Create a .vim/ftplugin/ruby.vim file with the following: nnoremap <buffer>…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.