Why?
In a heavy IDE, you need to click a button or some keyboard shortcuts. Unless you frequently use the keystrokes, you'll likely forget them since they are usually non-transferable IT skills.It's different in Vim. Since it's an F/OSS programmable editor, you can add whatever plugins and extra functions you like. You can adjust you .vimrc file so that the editing environment won't have too many undesirable changes.
Vim is lightweight. If your computer collapses (or even gives you the notorious BoD before RiP) due to loading IDE, Vim is your choice since it may still work with some good design and functions.
What are the good things?
- Diminished role of mouse and more use of keyboard due to modes
- Syntax highlighting and file type detection and more from my previous blog post
How? (Doesn't need c.vim)
- Set up
makefile
(simple tutorial about makefile) - Run
:make
- Run
:!./%<
on *nix (or simply:!%<
on M$ Win*) [1]
set makeprg=mingw32-make
in vimrc for MinGW make (more details aboutmakeprg
)%
stands for the current file, and<
stands for the file name without extension.
- In the whole process, you don't have to leave Vim and keyboard.
- The commands are the same whatever your files are (already determined by
makefile
), so you don't waste time to think and type in the correct name.
"The battle is not in the hands of who give the most shots. It should be those who shot the best."
"A good soldier can fire 3-4 rounds a minute."
My sample
makefile
:hello : hello.c gcc -o hello hello.c clean: rm -f helloNote: Insert tabs for indentation, not whitespaces.
If the compiled program is
hello.exe
, perhaps the extension name is also needed for rm
. (I have never tested it.)
With c.vim
Follow the menu and you'll be also good.Reference:
[1]: How do I run a C program from Vim?
No comments:
Post a Comment