summaryrefslogtreecommitdiffstats
path: root/bitbake/contrib/vim/plugin/newbb.vim
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/contrib/vim/plugin/newbb.vim')
-rw-r--r--[-rwxr-xr-x]bitbake/contrib/vim/plugin/newbb.vim14
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/contrib/vim/plugin/newbb.vim b/bitbake/contrib/vim/plugin/newbb.vim
index 874e338059..3a42027361 100755..100644
--- a/bitbake/contrib/vim/plugin/newbb.vim
+++ b/bitbake/contrib/vim/plugin/newbb.vim
@@ -10,7 +10,7 @@
10" 10"
11" Will try to use git to find the user name and email 11" Will try to use git to find the user name and email
12 12
13if &compatible || v:version < 600 13if &compatible || v:version < 600 || exists("b:loaded_bitbake_plugin")
14 finish 14 finish
15endif 15endif
16 16
@@ -25,7 +25,7 @@ endfun
25fun! <SID>GetUserEmail() 25fun! <SID>GetUserEmail()
26 let l:user_email = system("git config --get user.email") 26 let l:user_email = system("git config --get user.email")
27 if v:shell_error 27 if v:shell_error
28 return "unknow@user.org" 28 return "unknown@user.org"
29 else 29 else
30 return substitute(l:user_email, "\n", "", "") 30 return substitute(l:user_email, "\n", "", "")
31endfun 31endfun
@@ -41,6 +41,10 @@ fun! BBHeader()
41endfun 41endfun
42 42
43fun! NewBBTemplate() 43fun! NewBBTemplate()
44 if line2byte(line('$') + 1) != -1
45 return
46 endif
47
44 let l:paste = &paste 48 let l:paste = &paste
45 set nopaste 49 set nopaste
46 50
@@ -48,7 +52,7 @@ fun! NewBBTemplate()
48 call BBHeader() 52 call BBHeader()
49 53
50 " New the bb template 54 " New the bb template
51 put ='DESCRIPTION = \"\"' 55 put ='SUMMARY = \"\"'
52 put ='HOMEPAGE = \"\"' 56 put ='HOMEPAGE = \"\"'
53 put ='LICENSE = \"\"' 57 put ='LICENSE = \"\"'
54 put ='SECTION = \"\"' 58 put ='SECTION = \"\"'
@@ -58,7 +62,7 @@ fun! NewBBTemplate()
58 62
59 " Go to the first place to edit 63 " Go to the first place to edit
60 0 64 0
61 /^DESCRIPTION =/ 65 /^SUMMARY =/
62 exec "normal 2f\"" 66 exec "normal 2f\""
63 67
64 if paste == 1 68 if paste == 1
@@ -76,7 +80,7 @@ if v:progname =~ "vimdiff"
76endif 80endif
77 81
78augroup NewBB 82augroup NewBB
79 au BufNewFile *.bb 83 au BufNewFile,BufReadPost *.bb
80 \ if g:bb_create_on_empty | 84 \ if g:bb_create_on_empty |
81 \ call NewBBTemplate() | 85 \ call NewBBTemplate() |
82 \ endif 86 \ endif