https://github.com/jsexpertcoder/vim-cbase
A Vim plugin to quickly add a starter template for C exercises.
https://github.com/jsexpertcoder/vim-cbase
vim vim-plugin vimscript
Last synced: 2 months ago
JSON representation
A Vim plugin to quickly add a starter template for C exercises.
- Host: GitHub
- URL: https://github.com/jsexpertcoder/vim-cbase
- Owner: JsExpertCoder
- License: mit
- Created: 2024-12-17T18:40:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-23T21:05:49.000Z (about 1 year ago)
- Last Synced: 2025-04-04T22:41:31.517Z (12 months ago)
- Topics: vim, vim-plugin, vimscript
- Language: Vim Script
- Homepage:
- Size: 13.7 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CBase
**CBase** is a Vim plugin designed to quickly insert a starter template for C programming exercises, specifically tailored for 42 School projects.
## Features
- Inserts a clean and minimal C starter template one line after the 42 header:
```c
#include
int main(void)
{
return (0);
}
```
- Saves time when setting up repetitive C programming exercises.
## Installation
### Using [vim-plug](https://github.com/junegunn/vim-plug)
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Neovim)
1. Begin the section with `call plug#begin()`
1. List the plugins with `Plug` commands
1. End the section with `call plug#end()`
For example,
```vim
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
### Manual Installation
1. **Open your terminal:**
Open a terminal window on your system.
2. **Download the plugin repository:**
Run the following command in the terminal to download the repository:
```bash
git clone https://github.com/JsExpertCoder/cbase.git
```
3. **Move the plugin to the Vim runtime path:**
Copy the `cbase` folder into the `~/.vim/pack/plugins/start/` directory:
```bash
mv cbase ~/.vim/pack/plugins/start/
```
For Neovim, use this directory instead:
```bash
mv cbase ~/.local/share/nvim/site/pack/plugins/start/
```
4. **Restart Vim or Neovim:**
Close and reopen Vim or Neovim to load the plugin automatically.
## Usage
1. Insert the Header:
Press **F1** or run : **StdHeader** to insert your 42 School project header.
2. Insert the Template:
- Press **F2** to **insert** the C starter template.
- Alternatively, run the command:
```vim
:Cbase
```
### Notes
- 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).