Git Product home page Git Product logo

tsepepevim's Introduction

TsepepeVim plugin for Vim

This is a tiny C++ refactoring plugin which currently supports:

  • function definition generation from a function declaration (works as well for multiple declarations using the visual mode),
  • implementing an interface (extending a class with an abstract class)
  • switching to the corresponding (paired) C++ file, with the same stem

This plugin uses Tsepepe toolset, which must be compiled along with the bundled plugin to properly work. This is explained later in the Installing section.

Uses libclang. May be slow in large codebases, but everything is lazy evaluated, so the only slowness you might experience while explicitly invoking the plugin's commands.

NOTE: Requires compilation database.

Features

Function definition generation

  • Finds corresponding (paired) C++ file and appends the definition to it.
  • Takes into account all the specifiers, attributes, default parameters, namespaces, nested classes, nested types, etc. Knows what to skip and what to keep.
  • Handles generation of multiple function definitions from a visual selection.

Tsepepe Function definition generator presentation

More sophisticated example: using visual selection to generate multiple definitions:

Tsepepe Multiple function definitions generation presentation

Implement interface

  • Finds the interface (abstract class) with the specifed name within the project.
  • Adds an include statement, if not yet present, extends the base-clause with the qualified name of the interface, and adds override declarations of the pure virtual methods.
  • Handles compound interfaces (interfaces which are created by inheritance from other interfaces).
  • Resolves all the types properly, so the code shall be compilable.

Tsepepe Implement interface presentation

Go to corresponding file

This feature is similar to the clangd's "Switch between source/header".

Requirements

System-wide:

  • GCC 12.1.0+
  • CMake 3.22
  • libclang-14-dev+ and libllvm-14-dev+
  • libboost-1.74+
  • ripgrep

Installing

With vim-plug, put that inside inside .vimrc:

Plug 'KKoovalsky/TsepepeVim', { 'do': './build.py' }

When installing other way, remember that the Tsepepe toolset must be built within the directory where the plugin is dropped:

cd to/the/plugins/dir
git submodule update --init --recursive
./build.py

Documentation

See doc/tsepepe.txt.

Running tests

cd tests
behave compile_command_database_directory_path_getter/

TODO

  • Generate declaration from a definition, or a function call (invocation).
  • Update function definition / declaration.

tsepepevim's People

Contributors

kkoovalsky avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.