]> git.nbdom.net Git - nb.git/commitdiff
vim, templates, nb.py
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 16 Aug 2015 16:27:12 +0000 (17:27 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 16 Aug 2015 16:27:12 +0000 (17:27 +0100)
etc/vim/source/functions.vim
etc/vim/templates/daemon.tt
lib/python/nb.py
lib/python/nb.pyc

index d190251bac5e3c798e606a75df45b0118232fc85..c32fe7b32bef7fd5042e68ffb274b1983d8df6f1 100644 (file)
@@ -1,6 +1,7 @@
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 "
 " Functions
+" See: http://learnvimscriptthehardway.stevelosh.com/chapters/27.html
 "
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 let $VIMHOME = $HOME.'/.vim'
@@ -34,7 +35,11 @@ func! FileVimplate()
        setloc nomore
        setloc textwidth=0
 
-       let fname = &filetype.'.tt'
+       let ftype = FileGet('type')
+  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
@@ -42,12 +47,7 @@ func! FileVimplate()
                return
        endif
 
-       let cmd = $VIMPLATE . ' -template '.&filetype
-" NB 29.12.12  let cmd = cmd . ' -listtemplates'
-       " let cmd = 'vimplate -user nico -dir '.$VIMHOME.'/vimplaterc -template '.&filetype
-       " let cmd = 'vimplate -user nico' .  -dir '.$VIMHOME.'/vimplaterc -template '.&filetype
-" NB 29.12.12 echo '>>'.cmd
-" NB 29.12.12           execute "!" . cmd . ' && echo OK'
+       let cmd = $VIMPLATE . ' -template '.ftype
   let bashenv = $BASH_ENV
   let $BASH_ENV = ""
   execute "r!" . cmd
index 145150289f48072b0f879fa785a47e389c37ddb4..e355946f790ad30cf08a0f3f6e1fd951081e695f 100644 (file)
@@ -9,10 +9,6 @@
 # Short-Description: [% var.filename %]
 # Description:       [% user.me_now %] - [% user.copyright %]
 ### END INIT INFO
-#################################################################################
-#
-#
-#################################################################################
 
 
 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
@@ -27,11 +23,16 @@ test -x $DAEMON || exit 0
 
 . /lib/lsb/init-functions
 
+START="yes"
 # Source defaults file; edit that file to configure this script.
 if test -e /etc/default/$NAME ; then
   . /etc/default/$NAME
 fi
 
+if [ "$START" != "yes" ]; then
+       echo "$NAME not configured to start, please edit /etc/default/$NAME to enable (START=yes)"
+fi
+
 case "$1" in
   start)
     log_daemon_msg "Starting" "${NAME}"
index 222fbfe71a52babf0fa71d30c239cc8fd2979bef..6c9161c461c0f4546dac1cbbbed1385c63520ded 100644 (file)
@@ -2,9 +2,13 @@ import sys
 import os
 import re
 #INCLUDE_LINES = re.sub('\.py$','-lines.py',os.path.realpath(__file__))
+import pprint
+PP = pprint.PrettyPrinter(indent=4)
 
 # Debug message
 def debug(msg):
+    if (type(msg)) != 'str':
+      msg = PP.pformat(msg)
     print >> sys.stderr, msg
 
 # Return first and last line from a file
index c31091678297c3c8915ac43e09e24539dc6d2bb6..6f3d4bd2ae30d229d5990c31bd6b608db0269c4e 100644 (file)
Binary files a/lib/python/nb.pyc and b/lib/python/nb.pyc differ