Skip to content

Latest commit

 

History

History
567 lines (421 loc) · 21.5 KB

options.md

File metadata and controls

567 lines (421 loc) · 21.5 KB

lh-cpp Options

Contents

Options types

Global options: g:{option-name}

They are best set from the .vimrc;

Local/project-wise options: b:{option-name}

They are best set from a local_vimrc file;

Project-wise options with default: (bg):{option-name}

Their default value can be set in the .vimrc, but its best to set them from a local_vimrc file;

lh-dev options: (bg):[{filetype}__]{option-name}

Option list

(bg):cpp_always_a_destructor_when_there_is_a_pointer_attribute'

Boolean option that enforces the expansion of a destructor in classes that have pointer attributes, even when it isn't required.

Default value: 0 (false)

See:

(bg):cpp_std_flavour and $CXXFLAGS

These options are exploited by C++ flavour decoding functions

The expected values for (bg):cpp_std_flavour are "03", "05" (TR1), "11", "14", or "17". Other values will lead into Unspecified Behaviour.

warning: "98" is not a valid value.

If (bg):cpp_std_flavour is not set, the flavour will be extracted from the -std= option in $CXXFLAGS or else from the CMake $CMAKE_CXXFLAGS option. Valid values are -std=c++98, -std=c++03, -std=c++0x, -std=c++11, -std=c++1y, -std=c++14, -std=c++1z, -std=c++17 (the -std=gnu++xx ones are also handled)

Note: The $CMAKE_CXXFLAGS option is obtained thanks to lh-cmake. BTW, this plugin is not automatically installed with lh-cpp (if you are using a dependencies aware plugin manager like VAM or vim-flavor ; with dependencies unaware plugin managers, you'll will also have to install it as well)

(bg):({ft}_)FunctionPosArg, (bg):({ft}_)FunctionPosition

Determines where the default implementation, for a function not yet defined, should be placed by :GOTOIMPL. We are placed ...

  • 0 -> ... at cpp_FunctionPosArg lines from the end of the file.
  • 1 -> ... at the line after the first occurrence of the pattern cpp_FunctionPosArg. By default, we are placed after: >
/*============*/
/*===[ «» ]===*/
/*============*/

That I use to insert with :BLINES

  • 2 -> ... according the hook (user-defined VimL-function) cpp_FunctionPosArg. By default, we are asked for a title (actually a regex pattern), and placed after:
/*=====================*/
/*===[ {the_title} ]===*/
/*=====================*/

... That I still use to insert with |:BLINES|

  • 3 -> ... nowhere, and nothing is inserted. The insertion must be done manually thanks to :PASTEIMPL .

(bg):ProjectVersion

Version of the project. Can be used in Doxygen comment through API function lh#dox#since().

(bg):({ft}_)ShowDefaultParams, (bg):({ft}_)ShowExplicit, (bg):({ft}_)ShowStatic, (bg):({ft}_)ShowVirtual

Boolean options used by :GOTOIMPL. They tells whether the C++ keywords explicit, static or virtual shall be kept in the empty implementation skeleton generated for a function declaration. Same thing for default parameter values.

Default values to all: 1 (true)

(bg):accessor_comment_get, (bg):accessor_comment_set, (bg):accessor_comment_ref

Strings to customize the comments inserted on :ADDATTRIBUTE.

"%a" will be substituted with the name of the attribute.

(bg):({ft}_)alternateSearchPath

Tells how to alternate between a source file and a header file.

Default value: 'sfr:../source,sfr:../src,sfr:../include,sfr:../inc'

According to alternate.vim documentation:

A path with a prefix of "wdr:" will be treated as relative to the working directory (i.e. the directory where vim was started.) A path prefix of "abs:" will be treated as absolute. No prefix or "sfr:" will result in the path being treated as relative to the source file (see sfPath argument).

A prefix of "reg:" will treat the pathSpec as a regular expression substitution that is applied to the source file path. The format is:

reg:<sep><pattern><sep><subst><sep><flag><sep>
  • <sep> seperator character, we often use one of [/|%#]
  • <pattern> is what you are looking for
  • <subst> is the output pattern
  • <flag> can be g for global replace or empty

EXAMPLE: 'reg:/inc/src/g/' will replace every instance of 'inc' with 'src' in the source file path. It is possible to use match variables so you could do something like:

'reg:|src/\([^/]*\)|inc/\1||'

(see help :substitute, help pattern and help sub-replace-special for more details)

NOTE: a.vim uses , (comma) internally so DON'T use it in your regular expressions or other pathSpecs unless you update the rest of the a.vim code to use some other seperator.mentation:

(bg):({ft}_)begin_end_style

Tells which style to use to generate a couple of calls to begin()/end():

  • "c++98": -> container.begin()
  • "std": -> std::begin(container)
  • "boost": -> boost::begin(container)
  • "adl": -> begin(container)

See: CTRL-X_be, CTRL-X_cbe, CTRL-X_rbe, CTRL-X_crbe, cpp/b-e snippet

(bg):c_menu_name, (bg):c_menu_priority, (bg):cpp_menu_name, (bg):cpp_menu_priority

These options tells where the |menu| for all C and C++ item goes. See :h :menu

(bg):cpp_defaulted

String option.

Default Value: = default

See: API function lh#cpp#snippets#defaulted()

(bg):cpp_defines_to_ignore

Regex (default: none) that specifies which patterns (#define) shall be ignored when parsing the source code to detect the current scope (ns1::..::nsn::cl1::.....cln).

See: API functions

(bg):cpp_deleted

String option.

Default Value: = delete

See: API function lh#cpp#snippets#deleted()

(bg):cpp_noexcept

String format option (for lh#fmt#printf())

Default Value: noexcept%1 in C++11, throw() in C++98

See:

(bg):cpp_noncopyable_class

Policy option that is used to tell how classes are made non-copyable.

  • by inheriting from a dedicated noncopyable class.
{"name": "ITK::NonCopyable", "include": "<itkNoncopyable.h>"}

If the class is known by the type database , there is no need to explicit which file shall be included:

{"name": "boost:noncopyable"}
  • by explictly deleting copy operations (with = delete in C++11, or with declared but undefined private copy operations). This done by setting the option to an empty string.

Default value: {"name": "boost:noncopyable"}

See:

(bg):cpp_explicit_default

Boolean option that forces to explicitly add = default in snippets when C++11 is detected.

Warning: For now, this option has priority over (bg):cpp_noncopyable_class. i.e. deleted copy operations will still appear even if the class inherits from a non-copyable class.

Default value: undefined (=> ask the user)

See:

(bg):cpp_make_ptr

String format option for lh#fmt#printf()).

It tells how pointers are best created. Used only from cpp/clonable-clas.template snippet.

Default Value:

  • C++14: std::make_unique(%3)
  • C++11: std::unique_ptr<%2>(new %2(%3))
  • C++98: std::auto_ptr<%1>(new %2(%3))

See:

(bg):cpp_noexcept

String format option (for lh#fmt#printf())

Default Value: override in C++11, /* override */ in C++98

See:

(bg):cpp_return_ptr_type

String format option for printf() (TODO: migrate to lh#fmt#printf())).

It tells how pointers are best returned from functions. Used only from cpp/clonable-clas.template snippet.

Default Value:

  • C++11: std::unique_ptr<>
  • C++98: std::auto_ptr<>

See:

(bg):cpp_root_exception

TDB

(bg):cpp_use_copy_and_swap

Boolean option that suggest to use copy-and-swap idiom when expanding assignment-operator snippet directly, or indirectly through value classes snippets.

Default value: 0 (false)

See:

(bg):cpp_use_nested_namespaces

Boolean option that enables the generation of nested namespaces in C++17 codes with namespace snippet.

Default value: is 1 (true).

g:c_no_assign_in_condition

Boolean option that disables syntax highlighting that detects assignments in conditions.

Default value: is 0 (false).

g:c_no_hl_fallthrough_case

Boolean option that disables syntax highlighting that detects uses of case that fall through other cases.

This feature isn't detecting correctly situation like: break; } case, that why it's disabled for the moment.

Default value: is 1 (true).

g:cpp_no_catch_by_reference

Boolean option that disables syntax highlighting that detects exceptions caught by value.

Default value: is 0 (false).

g:cpp_no_hl_c_cast

Boolean option that disables syntax highlighting that detects C casts in C++.

Default value: is 0 (false).

g:cpp_no_hl_funcdef

Boolean option that disables syntax highlighting that hightlight function definitions.

Default value: is 0 (false).

g:cpp_no_hl_throw_spec

Boolean option that disables syntax highlighting that detects throw specifications in C++.

Default value: is 0 (false).

(bg):({ft}_)dox_CommentLeadingChar

Tells which character to use on each line of a Doxygen comment.

Default value: "*"

Wrapped in API function lh#dox#comment_leading_char()

(bg):({ft}_)dox_TagLeadingChar

Tells which character to use on each line of a Doxygen comment.

Default value: "*". Other typical value: "!"

Wrapped in API function lh#dox#tag_leading_char()

(bg):({ft}_)dox_author_tag

Tells which tag to use to introduce authors.

Default value: "author".

Wrapped in API function lh#dox#author()

(bg):({ft}_)dox_author

Returns the default value to use as the author tagged in Doxygen comments.

Default value: None

Wrapped in API function lh#dox#author()

(bg):({ft}_)dox_brief

Tells if brief tag shall be used.

Default value: "short".

Other possible values: "yes"/"always"/"1", "no"/"never"/"0"/"short"

Wrapped in API function lh#dox#brief()

(bg):({ft}_)dox_group

Default Doxygen group name used in snippets and templates.

Default value: the placeholder «Project»

See:

(bg):({ft}_)dox_ingroup

Tells if ingroup tag shall be used.

Default value: "0".

Other possible values: "yes"/"always"/"1", "no"/"never"/"0", or a group name to use.

Wrapped in API function lh#dox#ingroup()

(bg):({ft}_)dox_throw

Tells which tag name to use to document exceptions.

Default value: "throw". Other typical value: "exception"

Wrapped in API function lh#dox#throw()

(bg):({ft}_)exception_args

Arguments to inject in the exception called in throw snippet.

(bg):({ft}_)exception_type

Exception type to use in snippets like the throw snippet.

Default is std::runtime_error

(bg):({ft}_)ext_4_impl_file

Tells the extension to use when :GOTOIMPL generates a new implementation skeleton for a function.

Default is ".cpp".

(bg):({ft}_)file_regex_for_inclusion

Regex used by API function lh#cpp#tags#fetch() to filter filenames to keep.

Default value: "\.h"

(bg):({ft}_)filename_simplify_for_inclusion

Tells API function lh#cpp#tags#strip_included_paths() how to simplify filenames with |fnamemodify()|.

Default value: ":t"

(bg):({ft}_)gcov_files_path

This option tells where gcov files are expected. The default value is the same path as the one where the current file is.

See: <localleader>g which permits to swap between a .gcov file and its source.

(bg):({ft}_)implPlace

Tells where a generated accessor shall go (with :ADDATTRIBUTE):

  • 0 -> Near the prototype/definition (Java's way)
  • 1 -> Within the inline section of the header/inline/current file
  • 2 -> Within the implementation file (.cpp)
  • 3 -> Use the pimpl idiom (In the Todo-List)

g:inlinesPlace

Where inlines are written on :ADDATTRIBUTE

  • 0 -> In the inline section of the header/current file
  • 1 -> In the inline section of a dedicated inline file

(bg):({ft}_)includes

Option used by the C-ftplugin that completes the names of files to include. The options tells which directories shall be searched.

Default value: is vim option &path

See: <PlugCompleteIncludes> (i_CTRL-X_I) and <Plug>OpenIncludes (n_CTRL_L)

(bg):({ft}_)multiple_namespaces_on_same_line

Boolean option wrapped into API function lh#cpp#option#multiple_namespaces_on_same_line().

Default value: 1 (true)

Permits snippets like namespace to write all names on a same line (when nested namespaces aren't supported). i.e:

// If true
namespace ns1 { namespace ns2 {
} } // namespaces ns1::ns2

// If false
namespace ns1 {
namespace ns2 {
} // namespace ns1::ns2
} // namespace ns1

(bg):({ft}_)nl_before_bracket (deprecated)

(bg):({ft}_)nl_before_curlyB (deprecated)

(bg):({ft}_)pre_desc_ordered_tags, (bg):({ft}_post_desc_ordered_tags)

In function-comment snippet, these |List| options tell in which order the various documentation information are inserted around the description the user will have to type:

The default before the user typed information is:

  • "ingroup", "brief", "tparam", "param", "return", "throw", "invariant", "pre", "post"

The default after the user typed information is:

  • "note", "warning"

(bg):({ft}_)project_namespace

Name of the project namespace used by the snippet namespace.

Default value: the placeholder «ns»

This is also what is returned by API function lh#cpp#snippets#current_namespace() -- in that case, the default value used is an empty string.

(bg):({ft}_)tag_kinds_for_inclusion

Regex used by API function lh#cpp#tags#fetch() to filter tags kind to keep.

Default value: "[dfptcs]"

(bg):tags_select

Tags selection policy used by API function lh#cpp#tags#fetch().

Default value: "expand('<cword>')".

(bg):({ft}_)template_expand_doc

Boolean option used in snippets to tell whether documentation generation is required.

See:

(bg):xsltproc

Path to where the executable xsltproc is.

Default Value: xsltproc.

This options is used by the C-ftplugin that converts PVS-studio output into a format compatible with quickfix.

See: :PVSLoad, :PVSIgnore, :PVSShow and :PVSRedraw