Code Monkey home page Code Monkey logo

autoadapt's Introduction

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

DESCRIPTION
This plugin automatically adapts information like "last modified" timestamps
and copyright notices, or applies any other substitution before each file
save. Where and what is replaced can be configured globally and for each
individual buffer.

The plugin ships with configuration defaults which handle the most common
copyright notices, e.g.:
    Copyright: (C) 2011-2014 Ingo Karkat
and modification timestamps such as
    Last Change: Wed 15 Jan 2014 21:38:00 WEST
    Modified: 2014 Jan 15

SOURCE
- The regular expression for updating copyright notices is derived from
    http://vim.wikia.com/wiki/Automatically_Update_Copyright_Notice_in_Files

RELATED WORKS
- autodate.vim (vimscript #291) is an old plugin that can insert and update a
  time stamp (between a prefix and postfix) in a certain format.
- ferallastchange.vim (vimscript #680) is an old plugin that searches for a
  prefix and then updates the timestamp in a certain format.
- timstamp.vim (vimscript #371) takes pattern and replacement parts like this
  plugin (the replacement part also supports some custom tokens e.g. for
  hostname), and is functionally very close.
- timestamp.vim (vimscript #923) is based on timstamp.vim. It allows only one
  pattern and feeds the replacement part to strftime(), making it less
  general.
- header.vim (vimscript #1142) insert or updates a header at the top, in a
  rather primitive way, and limited to shell, Python, Perl, and Vim scripts.
- lastmod.vim (vimscript #3578) is a short and simple plugin for replacing one
  pattern with a timestamp in the first N lines.
- better-header.vim (vimscript #4676) can insert and update a header for
  Python and shell scripts, and requires Python itself.
- update-time (vimscript #4786) searches the first and last lines for a single
  prefix and then automatically updates a following timestamp.

USAGE
The adaptation happens before every buffer save (BufWritePre event), e.g.
with the :write command. No action required. You can configure
(g:AutoAdapt_Rules) and disable this, though:

:NoAutoAdapt            Turn off automatic adapting for the current buffer.

:AutoAdapt[!]           Turn on automatic adapting for the current buffer,
                        after having it turned off via|:NoAutoAdapt|, or to
                        enable adapting for a buffer when the automatic
                        adapting has been configured to exclude the current
                        buffer via g:AutoAdapt_FilePattern, or (with [!]) to
                        override a configured Predicate which disables
                        adaptation for the buffer.

:Adapt[!]               Trigger manual adaptation of the current buffer (when
                        automatic adaption has been turned off via
                        :NoAutoAdapt). With [!] also overrides a configured
                        Predicate which disables adaptation for the buffer.

autoadapt's People

Stargazers

 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.