]> git.nbdom.net Git - nb.git/commitdiff
Vim paths
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 18 Jan 2015 20:37:55 +0000 (20:37 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 18 Jan 2015 20:37:55 +0000 (20:37 +0000)
etc/vim/source/functions.vim
etc/vim/vimplaterc [new file with mode: 0644]

index 7132b0ff18a749e7c5e5c0dcdb8b2047a17ce0fd..d94027d3338a679966e3bc44f357e381739c5cc8 100644 (file)
@@ -4,15 +4,20 @@
 "
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 let $VIMHOME = $HOME.'/.vim'
+if !isdirectory($VIMHOME) | let $VIMHOME = '/opt/nb/etc/vim' | endif
 "let $VIMHOME = '/home/nico'.'/.vim'
 
 " let vimhome = '/home/nico/.vim'
 let $VIMPLATE_DIR = $VIMHOME . '/templates'
+
+let $VIMPLATERC = $HOME.'/vimplaterc'
+if !filereadable($VIMPLATERC) | let $VIMPLATERC = '/opt/nb/etc/vim/vimplaterc' | endif
+
 let $VIMPLATE = 'vimplate'
 
-let $VIMPLATE = $VIMPLATE . ' -user nico'
+" NB 18.01.15 let $VIMPLATE = $VIMPLATE . ' -user nico'
 
-let $VIMPLATE = $VIMPLATE . ' -config '.$VIMHOME.'/vimplaterc'
+let $VIMPLATE = $VIMPLATE . ' -config '.$VIMPLATERC
 
 let $VIMPLATE = $VIMPLATE . ' -dir '.$VIMPLATE_DIR
 
diff --git a/etc/vim/vimplaterc b/etc/vim/vimplaterc
new file mode 100644 (file)
index 0000000..29a0832
--- /dev/null
@@ -0,0 +1,65 @@
+# This is an example configuration.
+# please see: http://napali.ch/vimplate
+
+# you can use $Config::opt instead command options:
+#   -user=<user> -dir=<dir>
+#warn @ARGV;
+use POSIX;
+
+sub filename {
+       my $f = $ENV{VIMFILE};
+       return $f unless $f;
+       my $root = $ENV{IZI_ROOT_DIR};
+       return $f unless $root;
+       $f =~ s,^$root,\~izideal,;
+       return $f;
+}
+
+$Config::var = {
+       #yourArray => [ 'Perl', 'C', 'C++' ],
+       time   => sub{ time },
+       programname => 'nico',
+       today => POSIX::strftime("%d.%m.%y", localtime),
+       year => POSIX::strftime("%Y", localtime),
+       filename => &filename(),
+};
+
+$Config::opt = {
+                  dir  => $ENV{HOME}.'/.vim/templates',
+                  #dir  => '/usr/share/vim-scripts/vimplate-templates',
+                  user => 'nico',
+};
+
+
+# we need $Config::user with the option -user=<name>
+$Config::user = {
+       nico  => {
+               firstname => 'Nicolas',
+               lastname  => 'Boisselier',
+               me       => 'NB',
+               #mail      => 'icolas@free.fr',
+               mail => 'nicolas.boisselier@gmail.com',
+       },
+};
+
+for (keys %$Config::user) {
+       my %h = %{$Config::user->{$_}};
+
+       $h{name} = $h{firstname}.' '.$h{lastname};
+       $h{author} = $h{name}.' '.$h{mail};
+
+       $h{me_now} = $h{me}.' '.$Config::var->{today};
+
+       $h{copyright} = "(C) ".$Config::var->{year}." ".$h{name};
+
+       $h{copyright_laius} = "Copyright $h{copyright}
+
+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 3 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.  See the GNU General Public License for more details.
+
+See <http://www.gnu.org/licenses/>.";
+
+       $Config::user->{$_} = \%h;
+};
+1;