From: Nicolas Boisselier Date: Sun, 18 Jan 2015 20:37:55 +0000 (+0000) Subject: Vim paths X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=3de685f8bd469828fc082aba89bb2dc36a2563c4;p=nb.git Vim paths --- diff --git a/etc/vim/source/functions.vim b/etc/vim/source/functions.vim index 7132b0ff..d94027d3 100644 --- a/etc/vim/source/functions.vim +++ b/etc/vim/source/functions.vim @@ -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 index 00000000..29a0832d --- /dev/null +++ b/etc/vim/vimplaterc @@ -0,0 +1,65 @@ +# This is an example configuration. +# please see: http://napali.ch/vimplate + +# you can use $Config::opt instead command options: +# -user= -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= +$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 ."; + + $Config::user->{$_} = \%h; +}; +1;