Giter VIP home page Giter VIP logo

advanceddiffoptions's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=4996

DESCRIPTION
Vim provides a nice diff-mode; parameters like case- or whitespace-
insensitivity can be controlled through the 'diffopt' option. However, because
that option controls both the difference filtering itself as well as the
visual appearance within Vim, modifying that option on the fly with `:set`
isn't very comfortable.

This plugin provides a set of :DiffI... commands that enable you to quickly
toggle the built-in diff filtering options, and adds advanced options for
filtering blank lines, complete change hunks, lines, ranges, or patterns of
text.

HOW IT WORKS
When there's a corresponding command-line option for the "diff" tool, this is
passed. The filtering of lines, ranges, and patterns is implemented by
preprocessing the buffers through the external "sed" command.

USAGE
:DiffOptions            List the currently active diff options.

:DiffIClear             Clear all "ignore ..." diff options.

:DiffIWhiteSpace[!]     Ignore changes in whitespace. [!] for undo.

:DiffICase[!]           Ignore changes in case. [!] for undo.

:DiffIBlankLines[!]     Ignore blank lines. [!] for undo.

:DiffIHunks[!] [{expr}] Ignore change hunks whose lines _all_ match {expr}.
                        [!] for undo.

                        The following filters go beyond the capabilities of
                        the diff command itself; they work by preprocessing
                        the compared files before sending them to diff.

:DiffILines[!] [{expr}] Do not consider any lines that match {expr} in the
                        diff. [!] for undo.

:DiffIRange[!] [{range}]
                        Do not consider any lines that match the lines
                        specified by {range} in the diff. [!] for undo.
                        Note that Vim will still highlight additional lines at
                        the end of the longer buffer.

:DiffIPattern[!] [{expr}]
                        Do not consider any text that matches {expr} in the
                        diff (globally, not just the first match).
                        [!] for undo, i.e. removing {expr}, or all previously
                        given patterns.
                        Note that Vim will still highlight the ignored changes
                        (should there be another change in the line that is
                        not covered by {expr}), because it determines that on
                        its own.

EXAMPLE
Filter all diff hunks that only consist of comments in a Perl script:
    :DiffIHunks ^#

Ignore any differences after a line matching "EOF":
    :DiffIRange /^EOF$/,$

Ignore type differences of "char const" vs. "char" in a C program:
    :DiffIPattern [ ]const

advanceddiffoptions's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.