為 Vim 加上 Templates

用了Pelican之後,想找一個好方式自動帶入 Title, Date, Tags, Category, Slug, Author, Summary 這些表頭,就想到vim+template。 隨便就找到一個滿不錯的plugin, 簡單也合適,還順便改了template.c 增加了template.pelican...

Simple Vim templates plugin

Get and install [pathogen.vim](https://github.com/tpope/vim-pathogen). You can skip this step if you already have it installed.
cd ~/.vim/bundle
git clone git://github.com/aperezdc/vim-template.git

About pathogen.vim

mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -Sso ~/.vim/autoload/pathogen.vim \
    https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim

update vimrc

execute pathogen#infect()
let g:email="thomas _at_ nchc.org.tw"
let g:username="Yu-Chin Tsai"
let g:license="GPLv2"

update template.c to GPL2

diff --git a/templates/template.c b/templates/template.c
index a6c6305..0e7fd59 100644
--- a/templates/template.c
+++ b/templates/template.c
@@ -3,8 +3,22 @@
  * Copyright (C) %YEAR% %USER% <%MAIL%>
    *
      * Distributed under terms of the %LICENSE% license.
      + *
      + * This program is free software: you can redistribute it and/or modify
      + * it under the terms of the GNU General Public License as published by
      + * the Free Software Foundation, either version 2 of the License, or
      + * (at your option) any later version.
      + *
      + * This program is distributed in the hope that it will be useful,
      + * but WITHOUT ANY WARRANTY; without even the implied warranty of
      + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      + *
      + * You should have received a copy of the GNU General Public License
      + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
      + *
        */

     +
      #include "%FILE%.h"

add template.pelican

Title: %FILE%
Date: %FDATE%
Tags: Blog, Linux
Category: life
Slug: life
Author: %USER%
Summary:


==============


%HERE%
template.pelican (END)

nice plugin for me, Thank you.

reference: 1. here to checkout more template variable 2. plugin Author: Adrian Perez aperez@igalia.com

Comments