Created
January 21, 2016 19:46
-
-
Save timsuchanek/f2f282e27d53898faaee to your computer and use it in GitHub Desktop.
vim regex for converting from js prop syntax to Immutable.js syntax
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
# converting | |
# lines[1][2] = 'asd' | |
# to | |
# .setIn([1,2], 'asd') | |
# mark the lines with V, then type : | |
# the following will appear: | |
# :'<,'> | |
# continue with | |
# s/\varname\[\(\d\+\)\]\[\(\d\+\)\]\s=\s'\(.*\)'/.setIn([\1, \2, '\3')/g | |
#so you get | |
:'<,'>s/\varname\[\(\d\+\)\]\[\(\d\+\)\]\s=\s'\(.*\)'/.setIn([\1, \2, '\3')/g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment