Neovim Code Runner
In this article, let’s explore the different ways to run our code, with and without plugins.
We are going to
- Use the built-in
compiler
andftplugin
features to have a consistent way to build or run our code for different programming languages. - Configure Lua-based code runner plugins to run our code.
- Explore plugins to run our code interactively and partially.
- Use terminal-integration plugins to run our code.
- Explore language-specific and test plugins.
Compiler and File Type Plugins
In this article, we walked through how to run, debug and monitor a Python application using different key mappings.
E.g. to run a Python application, we use the following mapping.
nnoremap <leader>rr ":update<CR>:exec '!python3' shellescape(@%, 1)<CR>
For debugging, we use the built-in terminal and pdb
.
nnoremap <leader>rd :update<CR>:sp term://python3 -m pdb %<CR>
To monitor the application, we can use nodemon
.
nnoremap <leader>rn :update<CR>:sp term://nodemon -e py %<CR>