Shit I have found useful, recorded for future reference. Focused on tools and workflows I like to use. Feel free to open a PR if you have a good trick, too!
Verb | Meaning |
---|---|
gc (cm ?) |
comment |
cx |
exchange |
gr |
go replace (from register) |
gs |
go sort |
gt |
titlecase NOTE: not mapped as such because of tabs |
cp |
system clipboard |
Text Object | Meaning |
---|---|
ae |
entire file |
i |
contiguous indent level |
l |
line, ignoring leading whitespace |
<C-v><Tab>
Get rid of incorrect HTML-escaping on Pro Git
Fire up the console and copy-paste. >
is but one of many, but it's the most common one I've run into.
$('pre').each(function(idx, pre) {
$(pre).text($(pre).text().replace(/</g, '<'))
$(pre).text($(pre).text().replace(/>/g, '>'))
$(pre).text($(pre).text().replace(/&/g, '&'))
})
- In project root dir:
$ vim $(ack 'bad_variable_name' -l)
- In vim:
:argdo %s/bad_variable_name/good_variable_name/gc | update
Step 1: open every file containing bad_variable_name
in vim.
Step 2: argdo
applies the command to every file given as an argument; c
flag can be left off, but then make sure to git add -p
; piping to update
saves each file after making all substitutions. If you don't do the ack
bit at first, add an e
flag to the :%s
to suppress any errors from files without a match.
s/o https://robots.thoughtbot.com/convert-ruby-1-8-to-1-9-hash-syntax
:%s/:\([^ ]*\)\(\s*\)=>/\1:/g
perl -pi -e 's/:([\w\d_]+)(\s*)=>/\1:/g' **/*.rb