This repository contains a .clang-format
configuration file for formatting C, C++, and other related source code files. This file can be used with various editors and IDEs to ensure consistent code style across your projects.
-
Clone this repository to your local machine:
git clone https://github.com/Davphla/clang-format-epitech.git cd ./clang-format-epitech
-
Ensure you have
clang-format
installed. You can install it via your package manager:- Ubuntu:
sudo apt install clang-format
- macOS:
brew install clang-format
- Windows: Download from the LLVM releases page.
- Ubuntu:
- Install the Clang-Format extension from the Extensions Marketplace.
- Open your workspace settings (
.vscode/settings.json
) and add the following configuration:{ "C_Cpp.clang_format_style": ".clang-format" }
- Now, you can format your code using the command palette (
Ctrl + Shift + P
) and typingFormat Document
. - You can also use
Ctrl + Shift + I
to format the current document.
- Install the
clang-format
package if you haven't already. - Add the following to your Emacs configuration file (
.emacs
orinit.el
):(require 'clang-format) (global-set-key (kbd "C-c C-f") 'clang-format-region)
- You can format the current region or buffer by using
C-c C-f
.
- Install the
clang-format
plugin using your preferred plugin manager (e.g.,vim-plug
):Plug ("sbdchd/neoformat")
- Add the following configuration to your
init.vim
orinit.lua
:vim.cmd("autocmd FileType c,cpp setlocal formatprg=clang-format")
- You can format your code by running
:Neoformat
.
You can also use clang-format
directly from the command line. Navigate to your project directory and run:
clang-format -i <filename>
Replace <filename>
with the name of the file you want to format. The -i
flag edits the file in place.
You can customize the .clang-format
file to suit your coding style preferences. Refer to the Clang-Format Style Options for a comprehensive list of available options.
Contributions are welcome! Please feel free to submit a pull request or open an issue if you have suggestions or improvements.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to modify this README to better fit your project's needs!