I've recently switched to neovim (NVIM v0.4.4) from vim.
nnoremap <f4> :!node %<CR> nnoremap <f9> :!clear && g++ -std=c++17 % -Wall -g -o %.out && ./%.out<CR>
And the output I get is:
:! node index.js [No write since last change] Press ENTER or type command to continue
then if I press any key it just closes the command panel.
After that I found the following code snippet that allowed me to open the terminal in neo-vim.
"open terminal on ctrl+n" function! OpenTerminalVartically() vsplit term://bash endfunction function! OpenTerminalHorizontally() split term://bash resize 10 endfunction nnoremap <c-n> :call OpenTerminalHorizontally()<CR> nnoremap <c-m> :call OpenTerminalVartically()<CR>
At first it just opened the terminal below the code editor. Then I figured out a way to open it vertically by modifying the function.
As I'm new to vim I don't know much about vim-scripting. Is there any way I can do the following:
nnoremap <f4> :call OpenTerminalVartically(node %)<CR> " I just want to pass the command in the function and execute it in the newly opened terminal.