Skip to main content
4 of 4
added 100 characters in body
SergioAraujo
  • 1.2k
  • 11
  • 13

I would suggest something like:

fun! SubstiTute()
    let l = 1
    let limit = line('$')
    while l < limit
        call setline(l, substitute(getline(l), 'this', 'that' , 'gc'))
        let l = l + 1
    endwhile
endfun

Using setline() in conjunction with substitute() your jumplist and changelist will not be messed up.

SergioAraujo
  • 1.2k
  • 11
  • 13