About: Run Vim command on current C/C++/Java function   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

maps the keystrokes ;tf (this function) to the range of the function in which the cursor is currently located. It works by searching backwards for a { occurring in the first column, and then for a ( to find the start of the function. A } in the first column ends the function body. For example, suppose you want to change the name of a function argument in the current function from i to ii: int foo(int i, int j) { // ... i++; return i; } In normal mode, type :;tf followed by the subsitution command s/\ /ii/g \>. The command line now reads: :?^{??(?,/^}/s/\/ii/g This tip assumes that:

AttributesValues
rdfs:label
  • Run Vim command on current C/C++/Java function
rdfs:comment
  • maps the keystrokes ;tf (this function) to the range of the function in which the cursor is currently located. It works by searching backwards for a { occurring in the first column, and then for a ( to find the start of the function. A } in the first column ends the function body. For example, suppose you want to change the name of a function argument in the current function from i to ii: int foo(int i, int j) { // ... i++; return i; } In normal mode, type :;tf followed by the subsitution command s/\<i\> /ii/g </i\>. The command line now reads: :?^{??(?,/^}/s/\/ii/g This tip assumes that:
Version
  • 5(xsd:double)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 944(xsd:integer)
Category
  • C
  • C++
Author
  • Lorenz Wegener
Complexity
  • basic
Created
  • 2005(xsd:integer)
ID
  • 945(xsd:integer)
NEXT
  • 946(xsd:integer)
Rating
  • 4(xsd:integer)
abstract
  • maps the keystrokes ;tf (this function) to the range of the function in which the cursor is currently located. It works by searching backwards for a { occurring in the first column, and then for a ( to find the start of the function. A } in the first column ends the function body. For example, suppose you want to change the name of a function argument in the current function from i to ii: int foo(int i, int j) { // ... i++; return i; } In normal mode, type :;tf followed by the subsitution command s/\<i\> /ii/g </i\>. The command line now reads: :?^{??(?,/^}/s/\/ii/g Press Enter to execute the command. The function changes to: int foo(int ii, int j) { // ... ii++; return ii; } The range can be used with other commands too. This tip assumes that: * Your source code is indented, so that curly braces on the first column always open or close a function body. * A function name is followed by a (. This is true in C, mostly true in C++ and Java, and true to a limited extend in Perl. This tip does not work for constructor definitions in C++ and Java, since they can contain many parentheses, for example: Foo(int bar, int baz): mBar(bar), mBaz(baz) {}
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software