How do I determine whether the current buffer is modified or not?

You can check the value of the ‘modified’ option to determine whether the current buffer is modified:

    :set modified?

From a Vim script, you can check the value of the ‘modified’ option:

    if &modified

        echo "File is modified"

    endif

Read free Software Algorithms and Computer Science Books by CodeAhoy Learn.

Introduction to Recursion and Backtracking

Sorting Algorithms

Introduction to C Programming Language

And More...

Speak Your Mind