Last active
January 31, 2017 11:19
-
-
Save canabady/c9ee6803b1dcba4856a6be9a71e83e5f to your computer and use it in GitHub Desktop.
To Add or Delete a block of code in all buffer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
======== | |
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