CBase is a Vim plugin designed to quickly insert a starter template for C programming exercises, specifically tailored for 42 School projects.
- Inserts a clean and minimal C starter template at line 14 (after you insert the header):
#include <unistd.h>
int main(void)
{
return (0);
}
- Saves time when setting up repetitive C programming exercises.
Using vim-plug
Add a vim-plug section to your ~/.vimrc
(or ~/.config/nvim/init.vim
for Neovim)
- Begin the section with
call plug#begin()
- List the plugins with
Plug
commands - End the section with
call plug#end()
For example,
call plug#begin()
" List your plugins here
Plug 'JsExpertCoder/cbase'
call plug#end()
Reload the file or restart Vim, then you can,
:PlugInstall
to install the plugins:PlugUpdate
to install or update the plugins:PlugDiff
to review the changes from the last update:PlugClean
to remove plugins no longer in the list
-
Open your terminal:
Open a terminal window on your system.
-
Download the plugin repository:
Run the following command in the terminal to download the repository:
git clone https://github.com/JsExpertCoder/cbase.git
-
Move the plugin to the Vim runtime path:
Copy the
cbase
folder into the~/.vim/pack/plugins/start/
directory:mv cbase ~/.vim/pack/plugins/start/
For Neovim, use this directory instead:
mv cbase ~/.local/share/nvim/site/pack/plugins/start/
-
Restart Vim or Neovim:
Close and reopen Vim or Neovim to load the plugin automatically.
- Insert the Header: Press F1 or run : StdHeader to insert your 42 School project header.
- Insert the Template:
-
Press F2 to insert the C starter template.
-
Alternatively, run the command:
:Cbase
- Ensure that your header is inserted first to maintain 42 School coding standards.
- This plugin assumes the C code starts after line 14 (common for projects at 42 School).