Este es un plugin de Vim basado en el trabajo original de gicamerl.
Se ha modificado para generar archivos .hpp y .cpp con la Orthodox Canonical Form en C++.
- Inserta automáticamente un header en
.hppy.cpp. - Genera clases con la Orthodox Canonical Form en archivos
.hpp. - Crea la implementación de la clase en archivos
.cppcon el#includecorrespondiente. - Compatible con Vim y Neovim.
Para instalar el plugin, copia el archivo ocf_header.vim en la carpeta de plugins de Vim:
mkdir -p ~/.vim/plugin
cp ocf.vim ~/.vim/plugin/Para Neovim, colócalo en:
mkdir -p ~/.config/nvim/plugin
cp ocf.vim ~/.config/nvim/plugin/Puedes ejecutar el plugin de dos maneras:
-
Atajo de teclado:
- Pulsa
f2en modo normal para generar automáticamente el header y la clase en archivos.hppo la implementación en.cpp.
- Pulsa
-
Comando manual:
- Escribe
:OcfHeadery presionaEnter.
- Escribe
Si creas un archivo WrongCat.hpp y ejecutas :OcfHeader, se generará:
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* WrongCat.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tu_usuario <tu_email> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/09 12:00:00 by tu_usuario #+# #+# */
/* Updated: 2025/03/09 12:00:00 by tu_usuario ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef WRONGCAT_HPP
#define WRONGCAT_HPP
class WrongCat {
public:
WrongCat();
WrongCat(const WrongCat &other);
WrongCat& operator=(const WrongCat &other);
~WrongCat();
};
#endifSi creas un archivo WrongCat.cpp y ejecutas :OcfHeader, se generará:
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* WrongCat.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tu_usuario <tu_email> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/09 12:00:00 by tu_usuario #+# #+# */
/* Updated: 2025/03/09 12:00:00 by tu_usuario ### ########.fr */
/* */
/* ************************************************************************** */
#include "WrongCat.hpp"
WrongCat::WrongCat() {
// Constructor por defecto
}
WrongCat::WrongCat(const WrongCat &other) {
// Constructor de copia
*this = other;
}
WrongCat& WrongCat::operator=(const WrongCat &other) {
// Operador de asignación
if (this != &other) {
// Copiar los atributos necesarios
}
return *this;
}
WrongCat::~WrongCat() {
// Destructor
}Este código es una modificación de un trabajo originalmente publicado por 42 bajo dominio público. Puedes usarlo, modificarlo y distribuirlo libremente.
¡Las contribuciones son bienvenidas! Si tienes mejoras, siéntete libre de abrir un Pull Request.