Last active
May 4, 2020 07:06
-
-
Save HelioCampos/c908fceb7ed192b16cfc to your computer and use it in GitHub Desktop.
vim_commands
This file contains hidden or 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 COMMANDS | |
## SUBSTITUTIONS | |
### Substitute [:<WORD>] by ['<WORD>'] on chef recipes | |
:1,$ s/[[]:\([^]]\+\)[]]/['\1']/gc | |
### Substitute pattern in mutiple lines to another thing | |
:1,$ s/local_action:\n module: \([^\n]\+\)/\1:/gc | |
### Substitute WORD => , to :WORD => node[\'fm_redis\'][\'confs\'][\'general\'][\'WORD\'], on lines 18 to 42 | |
18,42 s/\([a-z_]\+\) => ,/:\1 => node[\'fm_redis\'][\'confs\'][\'general\'][\'\1\'],/gc | |
### Substitute node\['fm_redis']['confs']['WORD'] to WORD | |
35,56 s/node\[\'fm_redis\'\]\[\'confs\'\]\[\'\([^']\+\)\'\]/\1/gc | |
## MOVING THINGS | |
### Move types from position | |
:3 s/\(FIXED_PATTERN\)\([^-]\+-\)\([^-]\+-\)\([^-]\+-\)/\1\3\4\2/gc | |
## DELETION COMMANDS | |
### delete a line | |
dd | |
### delete n lines | |
dnd | |
### delete partf of a word starting from where the cursor is in (delete word from) | |
dw | |
### delete a complete word where the cursor is positioned over (delete inside word) | |
diw | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment