cb6617222dbcac30aaf15bf336b150fed440cc7f
BareCode
A modular code editor built with C++17, Qt6, and CMake.
Designed to compile cleanly on Linux and Windows.
Features (v1.0)
| Feature | Details |
|---|---|
| Project tree | Left panel — shows only the selected project directory |
| Tabbed editor | Open multiple files simultaneously; tabs are movable and closable |
| Syntax highlighting | C / C++ (extensible via HighlighterFactory) |
| Line numbers | Painted in a dedicated gutter |
| Auto-indent | Preserves indentation level on Enter |
| Tab → spaces | Configurable; jumps to next tab stop |
| Persistent settings | Window geometry, font, tab size, last project (INI file) |
Project Structure
BareCode/
├── CMakeLists.txt # Top-level build
├── main.cpp
├── resources/
│ └── resources.qrc
└── src/
├── core/ # MainWindow, ProjectManager, Settings, IPlugin
├── editor/ # EditorPanel, EditorTab, CodeEditor, LineNumberArea
├── filetree/ # FileTreePanel
└── highlighter/ # SyntaxHighlighter, CppHighlighter, HighlighterFactory
Each subdirectory compiles into its own static library, keeping modules independent.
Building
Prerequisites
- CMake ≥ 3.16
- Qt6 (Widgets module)
- A C++17-capable compiler (GCC, Clang, MSVC)
Linux
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
./build/BareCode
Windows (Visual Studio)
cmake -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config Release
build\Release\BareCode.exe
Windows (MinGW)
cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
cmake --build build
build\BareCode.exe
Extending BareCode
Adding a new syntax highlighter
- Create a subclass of
SyntaxHighlighterinsrc/highlighter/. - Populate
m_rulesin the constructor (seeCppHighlighteras a template). - Register the file extension(s) in
HighlighterFactory.cpp.
No other files need to change.
Adding a new panel / plugin
- Implement the
IPlugininterface fromsrc/core/IPlugin.h. - Create a
QWidget-derived class for the UI. - Instantiate and wire it up in
MainWindow.
Code Style
All code uses Allman brace style and C++17 throughout.
Languages
C++
96.9%
CMake
3.1%