Skip to content

vim-scripts/vimdecdef

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

This is a mirror of http://www.vim.org/scripts/script.php?script_id=2570

http://github.com/eddic/vimdecdef

First off I would grab the vimdecdef.vim file from the above address
instead of the tarballed one as it may be out of date.

vimdecdef is a simple vim script that facilitates transitioning between
declarations and definitions in C++. The script can take a declaration and
either find it's definition or create one if it doens't exist. The definitions
will take into account scope and template. All script actions will utilize one
of two files. The header file and the source file. Initilially one should
always load a header file. If for example one executed ':e include/file.hpp'
then the script will automatically assume that the source file is located at
src/file.cpp. The script has a single bindable command that preforms the
following functions based on it's situation:

 * If the cursor is on a normal function activating the script will search the
   source file for it's definition. If the definition does not exist, it will
   append one at the bottom of the source file and leave the cursor there.
 * If the cursor is on an inline or template function activating the script will
   search the source file for it's definition. If it is found in the source
   file, the cursor will be positioned there. If the definition is not found in
   the source file the script will try to find it in the header file. If it is
   found in the header file, the cursor will be positioned there. If it is not
   found, one will be appended to the bottom of the header file insuring that it
   stays within any closing #endif that may exist.
 * If the cursor is on a global object or static data member the script will
   search the source file for it's definition. If the definition does not exist,
   it will append one at the bottom of the source file and leave the cursor
   there.
 * If the script's last action ended in a definition in the header file,
   activating it again will move the cursor back to the original declaration
   that caused the previous move regardless of the cursors current position.
 * Activating the script at any point in the header file that doesn't fall under
   any of the above circumstances will result in switching to the source file at
   it's last cursor position.
 * Activating the script while in the source file will always result in
   switching back to the header file at it's last cursor position.

About

Switch between C++ declarations and definitions

Resources

Stars

Watchers

Forks

Packages

No packages published