Code Monkey home page Code Monkey logo

vim-header's Introduction

vim-header

Easily adds brief author info and license headers

Table of Contents

Install

Preferred installation method is Pathogen

cd ~/.vim/bundle
git clone https://github.com/alpertuna/vim-header

Or you can use your own way

Usage

This is a general usage example. You can add these lines into your .vimrc

let g:header_field_author = 'Your Name'
let g:header_field_author_email = 'your@mail'
map <F4> :AddHeader<CR>

Pressing F4 in normal mode will add a brief author information at the top of your buffer.

Examples

For example, when you open a file named start.sh and press F4 after above settings, plugin will add these lines at the top of your buffer

#!/bin/bash
# File: start.sh
# Author: Your Name <your@mail>
# Date: 13.03.2016
# Last Modified Date: 13.03.2016
# Last Modified By: Your Name <your@mail>

or for a file named index.php

<?php
/*
 * File: index.php
 * @author: Your Name <your@mail>
 * Date: 13.03.2016
 * Last Modified Date: 13.03.2016
 * Last Modified By: Your Name <your@mail>
 */

⬆ back to top

Commands

Adding Headers

  • :AddHeader Adds brief author information or updates if exists
  • :AddMinHeader Adds minified version of author information

Adding Licenses

  • :AddMITLicense Adds MIT License
  • :AddApacheLicense Adds Apache License
  • :AddGNULicense Adds GNU GP License v3
  • :AddAGPLicense Adds GNU Affero GP License v3
  • :AddLGPLLicense Adds GNU Lesser GP License
  • :AddMPLLicense Adds Mozilla Public License
  • :AddWTFPLLicense Adds WTFPL License
  • :AddZlibLicense Adds zlib License

⬆ back to top

Settings

These settings are for your $MYVIMRC (vim: .vimrc, neovim: .config/nvim/init.vim)

Settings List

Settings related to headers:

Settings related to headers' fields:

Settings related to supported filetypes:

g:header_auto_add_header

let g:header_auto_add_header = 1

Toggles automatic headers' addition. 0 by default. If enable this feature and there is already header in current file, this plugin will update it automaically. But if you only want to update the header, look at the option below.

g:header_auto_update_header

let g:header_auto_update_header = 1

Toggles automatic headers' update. 0 by default. Ignore this option if g:header_auto_add_header is enabled

g:header_alignment

let g:header_alignment = 0

Aligns headers' values. 1 by default.

g:header_max_size

let g:header_max_size = 20

Sets the range from which vim-header will search for required headers (ones sets in global options) to determinate if it should update existing headers or add new ones.

This options is used to prevent text replacement if your file contains text matching headers (for instance File:). See #20 for more explanations. 7 by default.

g:header_field_filename

let g:header_field_filename = 0

Toggles File: header field. 1 by default.

g:header_field_filename_path

let g:header_field_filename_path = 1

Uses filename instead of full path in File: header field. 0 by default.

g:header_field_author

let g:header_field_author = 'Your Name'

Sets defined value for Author: and Last Modified By: fields. Empty string disables it. '' by default.

g:header_field_author_email

let g:header_field_author_email = 'your@mail'

Adds defined value surrounded by <, > after author name in Author: and Last Modified By: fields. g:header_field_author must be set and not be empty in order to add email to its value. Empty string disables adding email value. '' by default.

g:header_field_copyright

let g:header_field_copyright = ''

Adds custom copyright lines. '' by default.

g:header_field_timestamp

let g:header_field_timestamp = 0

Toggles Date: header field. 1 by default.

g:header_field_modified_timestamp

let g:header_field_modified_timestamp = 0

Toggles Last Modified Date: header field. 1 by default.

g:header_field_modified_by

let g:header_field_modified_by = 0

Toggles Last Modified By: header field. This header value relies on g:header_field_author value. In order to shows up g:header_field_author must be set and not be empty. 1 by default.

g:header_field_timestamp_format

let g:header_field_timestamp_format = '%d.%m.%Y'

Sets timestamp format. %d.%m.%Y by default.

g:header_field_license_id

let g:header_field_license_id = 'BSD-3-Clause'

Sets license field. '' by default.

g:header_cfg_comment_char

let g:header_cfg_comment_char = ';'

Sets cfg's filetype comment character as this filetype supports multiple set of comment characters (;, //, #, ...). # by default.

⬆ back to top

Filetypes support

Supported filetypes are:

  • ada
  • arduino
  • asm
  • c
  • cfg
  • clojure
  • coldfusion(cfc,cfml)
  • cpp
  • cs
  • css
  • dart
  • dosini
  • elixir
  • erlang
  • go
  • groovy
  • haskel
  • java
  • javascript
  • jsx
  • kotlin
  • less
  • lex
  • lisp
  • lua
  • make
  • matlab/octave
  • ocaml
  • perl
  • php
  • plaintex
  • pug
  • proto
  • python
  • racket
  • rst
  • ruby
  • rust
  • sass
  • scala
  • scheme
  • sh
  • tcl
  • tex
  • tmux
  • tsx
  • vhdl
  • verilog
  • vim
  • xdefaults
  • yacc
  • yaml
  • vimwiki

And licenses are:

  • Apache
  • EUP
  • GNU GPL
  • GNU AGPL
  • GNU LGPL
  • MIT
  • MPL
  • WTFPL
  • zlib

If you want more filetypes or licenses, you can open issues or provide any improvements by pull requests on alpertuna/vim-header. Also you can correct my English on README file or at comments in source code.

Thanks to Contributors

Contributors List

⬆ back to top

vim-header's People

Contributors

alpertuna avatar tang9ian avatar iomonad avatar shoichiaizawa avatar anickaburova avatar samerickson avatar kerkmann avatar excaliburzero avatar scafir avatar hiberabyss avatar mike96265 avatar fffed avatar asclepius avatar nathanwycoff avatar mnabila avatar johnnygox17 avatar derweh avatar thindil avatar daixijun avatar vbrinnel avatar voldikss avatar anchnk avatar robinkrens avatar deadbaed avatar nissimlahav78 avatar nathan-gilbert avatar imcylon avatar mrbeardad avatar golubov-andrey avatar lucklyric 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.