Easily adds brief author info and license headers
Preferred installation method is Pathogen
cd ~/.vim/bundle
git clone https://github.com/alpertuna/vim-headerOr you can use your own way
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.
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>
*/Adding Headers
:AddHeaderAdds brief author information or updates if exists:AddMinHeaderAdds minified version of author information
Adding Licenses
:AddMITLicenseAdds MIT License:AddApacheLicenseAdds Apache License:AddGNULicenseAdds GNU GP License v3:AddAGPLicenseAdds GNU Affero GP License v3:AddLGPLLicenseAdds GNU Lesser GP License:AddMPLLicenseAdds Mozilla Public License:AddWTFPLLicenseAdds WTFPL License:AddZlibLicenseAdds zlib License
These settings are for your $MYVIMRC (vim: .vimrc, neovim:
.config/nvim/init.vim)
Settings related to headers:
Settings related to headers' fields:
g:header_field_filenameg:header_field_projectg:header_field_filename_pathg:header_field_authorg:header_field_author_emailg:header_field_copyrightg:header_field_timestampg:header_field_modified_timestampg:header_field_modified_byg:header_field_timestamp_formatg:header_field_license_idg:header_field_last_separator
Settings related to supported filetypes:
let g:header_auto_add_header = 1Toggles 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.
let g:header_auto_update_header = 1Toggles automatic headers' update. 0 by default.
Ignore this option if g:header_auto_add_header is enabled
let g:header_alignment = 0Aligns headers' values. 1 by default.
let g:header_max_size = 20Sets 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.
let g:header_field_filename = 0Toggles File: header field. 1 by default.
let g:header_field_project = 'Your Project'Sets defined value for Project: field. Empty string
disables it. '' by default.
let g:header_field_filename_path = 1Uses filename instead of full path in File: header field. 0 by default.
let g:header_field_author = 'Your Name'Sets defined value for Author: and Last Modified By: fields. Empty string
disables it. '' by default.
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.
let g:header_field_copyright = ''Adds custom copyright lines. '' by default.
let g:header_field_timestamp = 0Toggles Date: header field. 1 by default.
let g:header_field_modified_timestamp = 0Toggles Last Modified Date: header field. 1 by default.
let g:header_field_modified_by = 0Toggles 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.
let g:header_field_timestamp_format = '%d.%m.%Y'Sets timestamp format. %d.%m.%Y by default.
let g:header_field_license_id = 'BSD-3-Clause'Sets license field. '' by default.
let g:header_field_last_separator = 0Toggles ----- header field. 0 by default.
let g:header_cfg_comment_char = ';'Sets cfg's filetype comment character as this filetype supports multiple set of
comment characters (;, //, #, ...). # by default.
Supported filetypes are:
- ada
- arduino
- asm
- c
- cfg
- clojure
- coldfusion(cfc,cfml)
- cpp
- cs
- cuda
- 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
- svelte
- tcl
- tex
- tmux
- tsx
- vhdl
- verilog
- vim
- xdefaults
- yacc
- yaml
- vimwiki
And licenses are:
- Apache
- SHL
- 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.