Skip to main content
9 events
when toggle format what by license comment
Jun 20, 2020 at 14:11 vote accept dinskid
Jun 20, 2020 at 13:53 comment added Luc Hermitte You can run your executable with :term ./% -- I usually separate compilation from execution. But if you really want it, a little work is required, see the link I've provided in order to prevent execution is compilation fails.
Jun 20, 2020 at 13:26 comment added dinskid I understand your answer properly now. I understand that you ask to use make instead of running the g++ command directly. Yes, now the make works. The issue that I have now is I want to be able to give input to the executable file and I am not able to do that from within vim. How should I got about this?
Jun 20, 2020 at 13:08 comment added dinskid I set it up the way you said now. The problem I have now is I am not able to interact with it. I want to run the executable the way it runs in a terminal(it should receive inputs and be interactive). I am sorry, I am a newbie
Jun 18, 2020 at 21:53 comment added Luc Hermitte (Indirectly) Using the terminal as you are doing is what we had to do with Vi. Not Vim. Vi! Vim provides (from the very beginning) a way to integrate compilation. See :h :make. If you follow the link I gave you'll have explanations. Regarding ftplugin, they are a dedicated mechanism since Vim 6.0 to define filetype related things (mappings, etc). :h filetype for more. I gave the minimum required code snippets for your ~/.vimrc (or neovim equivalent), and a simplified content for ~/ftplugin/cpp.vim. Autocommands are the low level feature, that have some side-effects sometimes.
Jun 18, 2020 at 20:54 comment added dinskid I'm sorry for the confusion. I am saying the same vimrc works as shown in vim but doesn't work the same way as vim in nvim. The problem was me expecting the same terminal from both vim and nvim. Can you please expand on your answer as to what you meant by the ftplugin/cpp.vim.. I am a newbie to vim and nvim
Jun 17, 2020 at 19:30 comment added Luc Hermitte By "tested this way"? You mean you've tested the 3 points I've suggested: with an explicit path to the executable, and the quickfix feature, and with an ftplugin to avoid poor side effects from direct use of autocommands?
Jun 17, 2020 at 17:16 comment added dinskid No. I've tested it this way. I have the same vimrc set up both for neovim and vim. It works in vim but not in neovim My init.vim: https://pastebin.com/ZrgGajG0 FYI: The autocommands are in the end
Jun 14, 2020 at 13:28 history answered Luc Hermitte CC BY-SA 4.0