Skeletons on vim

This commit is contained in:
Frank Villaro-Dixon 2013-06-02 21:31:03 +02:00
parent f3ec2b6deb
commit 8318f2283e
15 changed files with 272 additions and 1 deletions

View file

@ -2,6 +2,8 @@
WAI=`pwd`
#simple files
cd ~/
ln -s $WAI/bashrc ./.bashrc
ln -s $WAI/vimrc ./.vimrc
@ -9,10 +11,13 @@ ln -s $WAI/gitconfig ./.gitconfig
ln -s $WAI/xinitrc ./.xinitrc
#SSH
if [ ! -d "~/.ssh" ]; then mkdir .ssh/; fi;
cd ~/.ssh
ln -s $WAI/ssh/config ./
#VIM
if [ ! -d "~/.vim" ]; then mkdir ~/.vim/; fi;
cd ~/.vim
@ -20,3 +25,8 @@ if [ ! -d "./colors" ]; then mkdir colors; fi;
cd colors
ln -s $WAI/vim/colors/wombat256modv1.vim ./wombat256modv1.vim
cd ..
if [ ! -d "./skeletons" ]; then mkdir skeletons; fi;
cd skeletons
for i in `ls $WAI/vim/skeletons`; do ln -s $WAI/vim/skeletons/$i ./$i; done

17
vim/skeletons/skel.c Normal file
View file

@ -0,0 +1,17 @@
/**
* <+FILENAME+> - <+DESC+>
*
* (C) 2010 - Gillieron Kevin <kevin.gillieron@gw-computing.net>
*/
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
<+CODE+>
return EXIT_SUCCESS;
}

14
vim/skeletons/skel.cpp Normal file
View file

@ -0,0 +1,14 @@
/*
* <+FILENAME+>
*
* <+DESC+>
*/
#include <iostream>
using namespace std;
int
main(int argc, char *argv[])
{
<+CODE+>
}

14
vim/skeletons/skel.go Normal file
View file

@ -0,0 +1,14 @@
/**
* <+FILENAME+> - <+DESC+>
*
* (C) 2010 - Gillieron Kevin <kevin.gillieron@gw-computing.net>
*/
package <+NAME+>
import "fmt"
func main()
{
<+CODE+>
}

12
vim/skeletons/skel.h Normal file
View file

@ -0,0 +1,12 @@
/**
* <+FILENAME+> - <+DESC+>
*
* (C) 2010 - Gillieron Kevin <kevin.gillieron@gw-computing.net>
*/
#ifndef <+HEADERNAME+>
#define <+HEADERNAME+>
<+CODE+>
#endif /* ndef <+HEADERNAME+> */

13
vim/skeletons/skel.html Normal file
View file

@ -0,0 +1,13 @@
<html>
<!-- vim: set ts=4 sw=4 noet: -->
<head>
<title><+TITLE+></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="<+DESCRIPTION+>" />
<meta name="keywords" content="<+KEYWORDS+>" />
<link rel="stylesheet" media="screen" type="text/css" href="./style/design.css" />
</head>
<body>
<+CODE+>
</body>
</html>

15
vim/skeletons/skel.java Normal file
View file

@ -0,0 +1,15 @@
/*
* <+FILENAME+>
*
* <+DESC+>
*/
class <+CLASSNAME+> {
public static void main(String[] argv) {
<+CODE+>
}
}
/* vim: set ts=4 sw=4 noet: */

View file

@ -0,0 +1,13 @@
/*
* <+FILENAME+>
*
* <+DESC+>
*/
int
main(int argc, char *argv[])
{
<+CODE+>
}
/* vim: set filetype=objc: */

11
vim/skeletons/skel.pas Normal file
View file

@ -0,0 +1,11 @@
(**
* <+FILENAME+> - <+DESC+>
*
* (C) 2010 - Gillieron Kevin <kevin.gillieron@gw-computing.net>
*)
program <+PROGNAME+>;
begin
<+CODE+>
end.

12
vim/skeletons/skel.php Normal file
View file

@ -0,0 +1,12 @@
<?php
/*
* <+FILENAME+>
*
* Author : Kevin Gillieron <kevin.gillieron@gw-computing.net>
* Description : <+DESC+>
*
* vim: set ts=4 sw=4 noet:
*/
<+CODE+>
?>

10
vim/skeletons/skel.pl Normal file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env perl
use strict;
use utf8;
<+CODE+>
# vim: set ts=4 sw=4 noet:

6
vim/skeletons/skel.py Normal file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
<+CODE+>
# vim: set ts=4 sw=4 noet:

5
vim/skeletons/skel.rb Normal file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env ruby
<+CODE+>
# vim: set ts=4 sw=4 noet:

91
vim/skeletons/skel.tex Normal file
View file

@ -0,0 +1,91 @@
% <+FILENAME+>
% Gillieron Kevin <kevin.gillieron@gw-computing.net>
% (C) 2011 - All rights reserved
\documentclass[a4paper,11pt]{report}
\usepackage[utf8x]{inputenc}
\usepackage[french]{babel}
\usepackage{lmodern}
\usepackage{hyperref}
\usepackage[pdftex]{graphicx}
\usepackage{listings}
\usepackage{version}
\usepackage[top=2.5cm, bottom=2.5cm, left=2cm, right=2cm]{geometry}
\usepackage{color}
\usepackage[Lenny]{fncychap}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[LE,RO]{\slshape \rightmark}
\fancyhead[LO,RE]{\slshape \leftmark}
\fancyfoot[C]{\thepage}
\fancyfoot[L]{\copyright 2010 - Gillieron Kevin}
\fancyfoot[R]{Années 2010-2011}
% Title Page
\title{<+TITLE+>}
\author{Gillieron Kevin $<$kevin.gillieron@gw-computing.net$>$}
%Customization of href
\hypersetup{
bookmarks = true, % show bookmarks bar?
unicode = false, % non-Latin characters in Acrobats bookmarks
colorlinks = true, % false: boxed links; true: colored links
linkcolor = black, % color of internal links
citecolor = green, % color of links to bibliography
filecolor = magenta, % color of file links
urlcolor = blue % color of external links
}
% Source Code Highlighting Settings
\lstset{ %
language=C, % choose the language of the code
basicstyle=\footnotesize, % the size of the fonts that are used for the code
numbers=left, % where to put the line-numbers
numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
stepnumber=1, % the step between two line-numbers. If it's 1 each line
% will be numbered
numbersep=5pt, % how far the line-numbers are from the code
backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
frame=single, % adds a frame around the code
tabsize=8, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
title=\lstname, % show the filename of files included with \lstinputlisting;
% also try caption instead of title
escapeinside={\%*}{*)}, % if you want to add a comment within your code
morekeywords={*,...} % if you want to add more keywords to the set
}
%New commands
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\begin{document}
%\maketitle
\begin{titlepage}
\begin{center}
% Upper part of the page
\textsc{\LARGE <+TITLEDOC+>}\\[1.5cm]
% Title
\HRule \\[0.4cm]
{ \huge \bfseries <+TITLEDOC2+>}\\[0.4cm]
\HRule \\[5.5cm]
\includegraphics[width=0.3\textwidth]{<+IMAGE+>}\\[1cm]
\vfill
% Bottom of the page
{
\large
% Author
\textit{Par} \textbf{\href{mailto:kevin.gillieron.kevin@gw-computing.net}{Kevin \textsc{Gillieron} $<$kevin.gillieron@gw-computing.net$>$}}
\textit{, le} \today
}
\end{center}
\end{titlepage}
\tableofcontents
\chapter{Introduction}
<+CONTENT+>
\end{document}

30
vimrc
View file

@ -80,8 +80,8 @@ noremap k gk
"inoremap #ifn #ifndef<space>
cmap Q q
command W w
"nnoremap . :
set list
"set listchars=tab:▸\
@ -117,3 +117,31 @@ autocmd BufWinEnter * call matchadd('ErrorMsg', '\%>80v.\+', -1)
"MAKEFILES
map <F5> :make
"TIPS : :copen :cclose :cw
"SKELETONS
" When editing a new file, load skeleton if any.
" If we find <+FILENAME+> in skeleton, replace it by the filename.
" If we find <+HEADERNAME+> in skeleton, replace it by the filename
" uppercase with . replaced by _ (foo.h become FOO_H).
autocmd BufNewFile *
\ let skel = $HOME . "/.vim/skeletons/skel." . expand("%:e") |
\ if filereadable(skel) |
\ execute "silent! 0read " . skel |
\ let fn = expand("%") |
\ let hn = substitute(expand("%"), "\\w", "\\u\\0", "g") |
\ let hn = substitute(hn, "\\.", "_", "g") |
\ let hn = substitute(hn, "/", "_", "g") |
\ let cn = expand("%:t:r") |
\ %s/<+FILENAME+>/\=fn/Ige |
\ %s/<+HEADERNAME+>/\=hn/Ige |
\ %s/<+CLASSNAME+>/\=cn/Ige |
\ unlet fn hn cn |
\ endif |
\ unlet skel |
\ goto 1
" skeleton template use <+KEY+>
nnoremap § <esc>/<+.\{-1,}+><return>c/+>/e<return>
inoremap § <esc>/<+.\{-1,}+><return>c/+>/e<return>