https://github.com/pinaki82/code_connector
The Code Connector plugin is designed to enhance the Vim editing experience by providing advanced features such as function parameter completion, code snippets, and more. It leverages LLVM Clang for code completion and is optimised for seamless integration with C/C++ projects.
https://github.com/pinaki82/code_connector
autocomplete autocompletion llvm-clang snippet snippets vim-plugin vim-snippets
Last synced: about 2 months ago
JSON representation
The Code Connector plugin is designed to enhance the Vim editing experience by providing advanced features such as function parameter completion, code snippets, and more. It leverages LLVM Clang for code completion and is optimised for seamless integration with C/C++ projects.
- Host: GitHub
- URL: https://github.com/pinaki82/code_connector
- Owner: Pinaki82
- License: mit-0
- Created: 2025-03-12T23:01:22.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-03-20T14:07:20.000Z (about 2 months ago)
- Last Synced: 2025-03-20T15:24:36.202Z (about 2 months ago)
- Topics: autocomplete, autocompletion, llvm-clang, snippet, snippets, vim-plugin, vim-snippets
- Language: C
- Homepage:
- Size: 6.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: history.tar.lrz
- License: LICENSE
Awesome Lists containing this project
README
# Code Connector Vim Plugin Documentation
## Overview
The Code Connector plugin is designed to enhance the Vim editing experience by providing advanced features such as function parameter completion, code snippets, and more. It leverages LLVM Clang for code completion and is optimised for seamless integration with C/C++ projects.
## Installation
1. **Using vim-plug**:
Add the following line to your `.vimrc` file:
```vimscript
Plug 'https://github.com/Pinaki82/code_connector.git'
```
Then run `:PlugInstall` in Vim to install the plugin.2. **Manual Installation**:
Place the `code_connector` folder in your Vim plugin directory (e.g., `~/.vim/plugin`) and the help file in the `~/.vim/doc` directory.3. **Project Configuration**:
Create two files in the project root directory: `.ccls` and `compile_flags.txt`. For detailed instructions on generating these files, refer to the [CCLS_GEN](https://github.com/Pinaki82/Tulu-C-IDE/tree/main/CCLS_GEN) directory of the [Tulu-C-IDE](https://github.com/Pinaki82/Tulu-C-IDE) repository.
NOTE: The `.ccls` and `compile_flags.txt` files should be placed at least one directory level up from the source files, not alongside the source. A blank project, `blankTuluCIDEproj.zip`, is provided for reference to the correct directory structure.## Usage
- **Function Parameter Completion**:
Press `` (Ctrl+Enter) to complete function parameters with placeholders once the function name completion is obtained from a LLVM Clang-based completion plugin.
- Add the first bracket, i.e., `(` after the function name in Insert Mode, such as `double result = remainderf(`, and hit Enter. Placeholders can be selected by pressing Ctrl+Enter. For convenience, remove the portion after the first bracket previously generated by autocompletion. Delete by pressing and continuing to type x. The cursor should come after the first bracket. You can enter Insert Mode by pressing I (lower-case). Press the 'CTRL + Enter' key to fill up the function with placeholders.
- **NOTE: Always press the Enter key after the first opening bracket of a function to trigger completion.**- **Code Snippets**:
Press `` followed by `` ('CTRL + x' and then 'CTRL + Enter') to get a list of available code snippets. Select a snippet using the Up/Down Arrow keys. Snippet names are abbreviated.
- NOTE: After typing a **snippet** abbreviation, **do not include a bracket**. Expanding it doesn't require a bracket, and doing so will result in unintended outcomes.
- TIP: [vim-jsnippets](https://github.com/Pinaki82/vim-jsnippets.git) and this Vim plugin is an ideal combination.- **Reloading the Buffer**:
If an undesirable output gets in the way, reload the buffer using the [Reload-Button](https://github.com/Pinaki82/Reload-Button) plugin or press `u` in the Normal Mode.## Configuration
- `g:disable_codeconnector`: Disable the Code Connector plugin (default: enabled).
- `g:completekey`: The key used to complete function parameters and keywords (default: ``).
- `g:rs` and `g:re`: Region start and stop markers (can be changed as needed).
- `g:user_defined_snippets`: File name of user-defined snippets.
- `g:CodeComplete_Ignorecase`: Use ignore case for keywords (default: disabled).## Repository
For more information, visit the [Tulu-C-IDE](https://github.com/Pinaki82/Tulu-C-IDE) repository.
## Building and Running
### Linux:
```bash
mkdir -p build
cd build
cmake ..
make config=Debug platform=Linux
# Or,
make config=Release platform=Linux
```### Windows:
```bash
mkdir build
cd build
cmake -G "MinGW Makefiles" ..
mingw32-make config=Debug
# Or,
mingw32-make config=Release
```### Post-Build Steps:
Enter `code_connector/build/plugin`.
Copy the following files to the `code_connector/plugin` directory:
- `code_connector_executable`
- `libcode_connector_shared.so` (on Linux systems)
- `code_connector_executable.exe`
- `ccls_index_gen_windows.exe`
- `code_connector_shared.dll`Binary files for Intel 64-bit Linux and Microsoft Windows architectures are provided.
### Receiving Automatic Updates:
After receiving an update via a plugin manager, please copy the binary files to the plugin directory (`code_connector/plugin`).
## Example Commands
### Linux:
```bash
./code_connector_executable file.c 12 24
./code_connector_executable file1.c 10 13
./code_connector_executable file2.c 9 13
```### Windows:
```bash
code_connector_executable.exe file.c 12 24
code_connector_executable.exe file1.c 10 13
code_connector_executable.exe file2.c 9 13
```## CMakeLists.txt
The `CMakeLists.txt` file is used to configure the build process for the plugin. It supports both Linux and Windows platforms and includes settings for different build types (Debug and Release).
## Source Files
- `code_connector_executable.c`: Main executable for code completion.
- `code_connector_executable_windows.c`: Windows-specific implementation for code completion.
- `ccls_index_gen_windows.c`: Windows-specific implementation for generating CCLS index.
- `code_connector_shared.c`: Shared library for common functionality.
- `code_connector_shared_windows.c`: Windows-specific implementation for shared library.## Header Files
- `code_connector_shared.h`: Header file for shared library.
## Snippets and Templates
The plugin includes a variety of code snippets and templates for C and C++ languages. These can be customised and extended to fit specific needs.
## Logging
The plugin includes a logging mechanism to help with debugging and monitoring its unexpected behaviour. Logs are written to `/tmp/vim_parser_log.txt` on Linux and `C:\Temp\vim_parser_log.txt` on Windows.
## Vim Help
Ensure this file is placed in the `doc/` directory of Vim or the `doc/` directory of your plugin (e.g., `$HOME/.vim/plugged/code_connector/doc/`). To access the plugin's help documentation within Vim, use the following commands:
```vimscript
:helptags $HOME/.vim/doc
:h code_connector
```## Screencast:
[code_connector_screencast.webm](https://github.com/user-attachments/assets/b5fe08c6-8c23-4f27-b3ea-f2816d9b88c7)
## Contributing
Contributions are welcome! Please follow the guidelines in the repository for submitting pull requests and reporting issues.
## Maintenance
Maintainers are encouraged to look at this document: [working-principles.md](https://github.com/Pinaki82/code_connector/blob/main/working-principles.md)