New answers tagged

1

Visit each line that has the key pattern using the global command and do a (global) substitution on that same pattern at each visited line: :g/\.\\\(\S\+\) ()/ s//.\\\1 (\1)/g The pattern, which is used in both the global and substitution operations: \.\\ : period and backslash \(\S\+\) : non-empty, non-space string inside a capturing group (\(...\)) ...


2

Is there a better way? In Vim there are always too many ways. I'd do it like this: " get result as List let output = systemlist('myprog') if v:shell_error echoerr 'Command failed! Error message:' output[0] else " add output on top call append(0, output) " delete the rest call deletebufline("%", len(output) + 1, "$") " go to first ...


Top 50 recent answers are included