Skip to main content
1 of 3
cxw
  • 974
  • 2
  • 8
  • 17

I found a solution thanks to the lead from @lcd047, which I greatly appreciate! I edited the script to run redraw before the echo per :help :echo-redraw. At least in my particular situation, the message now stays visible until I start scrolling. The relevant portion of the script is below for anyone who would like it.

  func JCWC(line1, line2)
    let wc_start_line = 1
    let wc_end_line = 1
    if a:line2 >= a:line1
      let wc_start_line = a:line1
      let wc_end_line = a:line2
    else
      let wc_start_line = a:line2
      let wc_end_line = a:line1
    endif

    let wc_count = 0

    let stop = ""
    let n = wc_start_line
    while n <= wc_end_line
        let line = getline(n)
        if match(line, "^--------") >= 0
            let stop = " until '^--------'"
            break
        endif
        let c = JCWC_line(line)
        let wc_count = wc_count + c
        let n = n + 1
    endwhile

    redraw " <----- Added this
    echo "counted " . wc_count . " words" . stop

  endfunc

endif
cxw
  • 974
  • 2
  • 8
  • 17