New answers tagged


You could try this: :'<,'>s/\%V\d*\%V\d/\=printf('%.3f', str2nr(submatch(0))*0.7)/ For more info, see: :h /\%V :h printf() Figure could be 5, 5.0, 5.00 or 5.000, 12345678.000, 3 digits at most. How can we define a more general grouped part? Try a more permissive pattern: :'<,'>s/\%V\d*\.\=\d*\%V\d/\=printf('%.3f', str2float(submatch(0))*0....


:B from plugin vis.vim by DrChip: :B s/pattern/becomes/ This plugin provides a general command to make all colon commands to operate only on the visual block selection: :'<,'>B s/\d*/\=printf('%.3f', str2nr(submatch(0))*0.7)


:Substitute for visual block from plugin csv.vim For single-space separated data you have to initialize the plugin csv.vim manually as following: $ vim mydata :setf csv :let g:csv_delim=' ' :CSVInit Now you can use the :Substitute command: Select part of a column with a visual block (e.g. 5\n8) and then run :'<,'>Substitute \d*/\=printf('%.3f', ...


Visual Block: Colon commands will still apply to whole lines You find in the user manual section 10.3 'Command ranges' following note (almost at the end of :h 10.3: Note: When using Visual mode to select part of a line, or using CTRL-V to select a block of text, the colon commands will still apply to whole lines. This might change in a future version ...

Top 50 recent answers are included