Skip to content

Instantly share code, notes, and snippets.

@canabady
Last active January 31, 2017 11:19
Show Gist options
  • Save canabady/c9ee6803b1dcba4856a6be9a71e83e5f to your computer and use it in GitHub Desktop.
Save canabady/c9ee6803b1dcba4856a6be9a71e83e5f to your computer and use it in GitHub Desktop.
To Add or Delete a block of code in all buffer
========
VIM TIPS
========
Adding a block of code inside a function in all opened buffer
-------------------------------------------------------------
// Disable literals
$this->setup(array('phqlLiterals' => true ));
Suppose you want to add above two lines inside the below function (in all opened buffer)
----------------------------------------------------------------------------------------
public function initialize()
{
$this->hasOne("point_id", "Point", "id");
}
Use the command
---------------
:bufdo g/initialize()/sil.+1 put a | update
To delete a block of code in all opened buffer
----------------------------------------------
// Disable literals
$this->setup(array('phqlLiterals' => true ));
If you want to remove above two lines from the below function (in all opened buffer)
------------------------------------------------------------------------------------
public function initialize()
{
// Disable literals
$this->setup(array('phqlLiterals' => true ));
$this->hasOne("point_id", "Point", "id");
}
Use the command
---------------
:bufdo g/literals/d2 | update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment