--- /dev/null
+# 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;
+use File::Basename;
+
+sub filename {
+ my $f = $ENV{VIMFILE};
+ $f = join(' ',@ARGV) if @ARGV and !$f;
+ #return join(' ',@ARGV) if @ARGV and !$f;
+ return $f unless $f;
+
+ my $root;
+
+ $f =~ s,^$root,\~izideal, if $root = $ENV{IZI_ROOT_DIR};
+ $f =~ s,^$root/?,, if $root = $ENV{NB_ROOT};
+
+ $f =~ s,^$root/,, if $root = $ENV{HOME};
+
+ return $f;
+}
+
+$file = filename() || '?';
+
+$Config::var = {
+#yourArray => [ 'Perl', 'C', 'C++' ],
+ time => sub{ time },
+ programname => 'nico',
+ today => POSIX::strftime("%d.%m.%y", localtime),
+ year => POSIX::strftime("%Y", localtime),
+ filename => $file,
+ basename => basename($file),
+};
+
+$Config::opt = {
+ #dir => ($ENV{VIMHOME} || $ENV{HOME}).'/.vim/templates',
+ dir => $ENV{HOME}.'/.vim/templates',
+ user => 'nico',
+};
+
+$Config::opt{dir} = $ENV{VIMHOME} . '/templates' if $ENV{VIMHOME};
+
+
+# we need $Config::user with the option -user=<name>
+$Config::user = {
+ nico => {
+ me => 'NB',
+ firstname => 'Nicolas',
+ lastname => 'Boisselier',
+ 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;
" See: http://learnvimscriptthehardway.stevelosh.com/chapters/27.html
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-let $VIMHOME = $HOME.'/.vim'
-if !isdirectory($VIMHOME) | let $VIMHOME = '/opt/nb/etc/vim' | endif
-"let $VIMHOME = '/home/nico'.'/.vim'
+" if !isdirectory($VIMHOME) | let $VIMHOME = '/opt/nb/etc/vim' | endif
+" let cur = expend('%:p:h')
-" 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
+" NB 16.08.16 let $VIMPLATERC = $HOME.'/.vimplaterc'
+" NB 16.08.16 if !filereadable($VIMPLATERC) | let $VIMPLATERC = '/opt/nb/etc/vim/.vimplaterc' | endif
+let $VIMPLATERC = '/opt/nb/etc/vim/.vimplaterc'
-let $VIMPLATE = 'vimplate'
-
-" NB 18.01.15 let $VIMPLATE = $VIMPLATE . ' -user nico'
-
-let $VIMPLATE = $VIMPLATE . ' -config '.$VIMPLATERC
-
-let $VIMPLATE = $VIMPLATE . ' -dir '.$VIMPLATE_DIR
+" We change HOME beacuse vimplate look for HOME/.vimplaterc
+let $VIMPLATE = 'env HOME=' . $VIMHOME . ' vimplate' . ' -config '.$VIMPLATERC . ' -dir '.$VIMPLATE_DIR
au VimLeave * if filereadable($VIMHOME."/.netrwhist")|call delete($VIMHOME."/.netrwhist")|endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if $VIMFILE =~ 'init\.d'
let ftype = 'daemon'
endif
+
let fname = ftype.'.tt'
+
let ffind = findfile(fname,$VIMPLATE_DIR)
if ffind == ''
" if ffind != $VIMPLATE_DIR . '/' . fname
endif
let cmd = $VIMPLATE . ' -template '.ftype
+
let bashenv = $BASH_ENV
let $BASH_ENV = ""
execute "r!" . cmd
let $BASH_ENV = bashenv
+
endfunc
let $FileInit = ''
endfunc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-let Cmd = $HOME . '/.vim/vim-shortcurts'
+let Cmd = $VIMHOME . '/vim-shortcurts'
let FilePath = expand('%:p')
let Debug = $VIMRC_DEBUG
endfunc
func! Stats()
- let stats = expand("$HOME/.vim/stats")
+ let stats = expand("$VIMHOME/stats")
if ! isdirectory(stats)
call mkdir(stats)
endif
call Debug("VimrcReload: Start")
call Debug("VimrcReload: ".$MYVIMRC)
- " source plugin/*.vim
exec "source $MYVIMRC"
call Debug("VimrcReload: End")
" set encoding=utf-8
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" NB 22.07.12 " Remember last line
-" NB 22.07.12 set viminfo='10,\"100,:20,%,n~/.viminfo
-" NB 22.07.12 au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
-" NB 22.07.12
-" NB 22.07.12 " I know it's horrible for a vi master but useful for newbies. - NB 04.11.03
-" NB 22.07.12 imap <C-a> <Esc>I
-" NB 22.07.12 imap <C-e> <ESC>A
-" NB 22.07.12 map <C-Tab> <C-W>w
-" NB 22.07.12 imap <C-Tab> <C-O><C-W>w
-" NB 22.07.12 cmap <C-Tab> <C-C><C-Tab>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" F2 - Script, formated text verification
map <F2> :call FileCheck()<CR>
-" map <F2> :!~/.vim/checkscript.sh %<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" F3 - Choose email signature
" - Prog Create
" map <F8> :call VimShortcurtsInteractive()<CR>
" vmap <F8> :call VimShortcurtsInteractive()<CR>
-
-
-" Start the find and replace command across the entire file
-" vmap <leader>z <Esc>:%s/<c-r>=GetVisual()<cr>/
-" Interactif
-" You can call this function with: :10,30call Count_words()
-" map <F7> o<C-R>=VimShortcurtsAuto('all_choose')<CR>
-" NB 09.11.11 map <F8> :.!~/.vim/vim-shortcurts-stdin<CR>
-" vmap <F8> !~/.vim/vim-shortcurts<CR>
-" vmap <F8> .!~/.vim/vim-shortcurts all_choose<CR>
-" map <F8> :s/^\(.*\)$/\=VimShortcurtsAuto('all_choose','\1')/<CR>
-" map <F8> :s/^/\=VimShortcurtsAuto('all_choose')/<CR>
-" vmap <F8> :s/^/\=VimShortcurtsAuto('all_choose')/<CR>
-" nmap <silent> <F8> :set opfunc=CountSpaces<CR>g@
-" vmap <silent> <F8> :<C-U>call CountSpaces(visualmode(), 1)<CR>
-
-
-
+++ /dev/null
-# 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;
-use File::Basename;
-
-sub filename {
- my $f = $ENV{VIMFILE};
- $f = join(' ',@ARGV) if @ARGV and !$f;
- #return join(' ',@ARGV) if @ARGV and !$f;
- return $f unless $f;
-
- my $root;
-
- $f =~ s,^$root,\~izideal, if $root = $ENV{IZI_ROOT_DIR};
- $f =~ s,^$root/?,, if $root = $ENV{NB_ROOT};
-
- $f =~ s,^$root/,, if $root = $ENV{HOME};
-
- return $f;
-}
-
-$file = filename();
-
-$Config::var = {
-#yourArray => [ 'Perl', 'C', 'C++' ],
- time => sub{ time },
- programname => 'nico',
- today => POSIX::strftime("%d.%m.%y", localtime),
- year => POSIX::strftime("%Y", localtime),
- filename => $file,
- basename => basename($file),
-};
-
-$Config::opt = {
- dir => $ENV{HOME}.'/.vim/templates',
- user => 'nico',
-};
-
-
-# we need $Config::user with the option -user=<name>
-$Config::user = {
- nico => {
- firstname => 'Nicolas',
- lastname => 'Boisselier',
- me => 'NB',
- 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;
" Require ln -s /opt/nb/etc/vim ~/.vim !!!
-runtime! source/*.vim
+" let $VIMHOME = $HOME.'/.vimZZ'
+" if !isdirectory($VIMHOME) | let $VIMHOME = expand("%:p:h") | endif
+" if !isdirectory($VIMHOME) | let $VIMHOME = '/opt/nb/etc/vim' | endif
+let $VIMHOME = '/opt/nb/etc/vim'
+" echo expand("%:p:h")
+" runtime! expand("%:p:h") . '/vim/source/*.vim'
+" runtime! $VIMHOME . '/source/*.vim'
+" runtime! 'source/*.vim'
+for file in split(globpath($VIMHOME . '/source/', '*.vim'), '\n')
+ execute 'source' fnameescape(file)
+endfor