New answers tagged


Not sure if it perfectly fits your use case, but it looks like you may as well just use: :g/s\d\+_decoded_block\[/ s/\[/_/ ...unless there are potentially other [ characters in the matching lines preceding the one you want to change. Simpler is better, if it fits your requirements.


You seem to expect a decimal number for "#" in the question. You can do this using a backreference: %s/s\(\d\+\)_decoded_block\[/s\1_decoded_block_/g where \(\d\+\) matches one or more decimal digits and is replaced using the marker \1. You could improve the backreference by moving more of the text inside it: %s/s\(\d\+_decoded_block\)\[/s\1_/g ...


Define a function: fun! App(filename) exec "w !cat - >> " . shellescape(a:filename) endfunc Call a function: call App('/foo/samples')


From :h :w: :w_a :write_a E494 :[range]w[rite][!] [++opt] >> Append the specified lines to the current file. :[range]w[rite][!] [++opt] >> {file} Append the specified lines to {file}. '!' forces the write even if file does ...

Top 50 recent answers are included