Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 comments
  • 1 contributor

Showing 2 changed files with 25 additions and 10 deletions. Show diff stats Hide diff stats

  1. +15 6 autoload/templator.vim
  2. +10 4 doc/templator.txt
21 autoload/templator.vim
... ... @@ -1,7 +1,7 @@
1 1 " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
2 2 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
3 3 " @Last Change: 2012-12-05.
4   -" @Revision: 285
  4 +" @Revision: 288
5 5
6 6
7 7 if !exists('g:templator#verbose')
@@ -17,9 +17,16 @@ if !exists('g:templator#drivers')
17 17 endif
18 18
19 19
20   -if !exists('g:templator#edit')
21   - " The command used for opening files.
22   - let g:templator#edit = 'hide edit' "{{{2
  20 +if !exists('g:templator#edit_new')
  21 + " The command used for editing newly created files.
  22 + let g:templator#edit_new = 'hide edit' "{{{2
  23 +endif
  24 +
  25 +
  26 +if !exists('g:templator#edit_again')
  27 + " The command used for editing files that already existed.
  28 + " If empty, don't open already existing files.
  29 + let g:templator#edit_again = g:templator#edit_new "{{{2
23 30 endif
24 31
25 32
@@ -104,14 +111,16 @@ function! templator#Setup(name, ...) "{{{3
104 111 echom "Templator: File already exists: " outfile
105 112 echohl NONE
106 113 endif
107   - exec g:templator#edit fnameescape(outfile)
  114 + if !empty(g:templator#edit_again)
  115 + exec g:templator#edit_again fnameescape(outfile)
  116 + endif
108 117 else
109 118 let lines = readfile(filename)
110 119 if writefile(lines, outfile) != -1
111 120 let fargs = copy(args)
112 121 let fargs.filename = outfile
113 122 if !s:RunHook('', tname, 'Edit', args)
114   - exec g:templator#edit fnameescape(outfile)
  123 + exec g:templator#edit_new fnameescape(outfile)
115 124 endif
116 125 let b:templator_args = args
117 126 call templator#expander#{ttype}#Expand()
14 doc/templator.txt
@@ -151,7 +151,8 @@ Contents~
151 151
152 152 :Templator .............................. |:Templator|
153 153 g:templator#verbose ..................... |g:templator#verbose|
154   - g:templator#edit ........................ |g:templator#edit|
  154 + g:templator#edit_new .................... |g:templator#edit_new|
  155 + g:templator#edit_again .................. |g:templator#edit_again|
155 156 g:templator#sep ......................... |g:templator#sep|
156 157 templator#Setup ......................... |templator#Setup()|
157 158 g:templator#expander#tvim#enable ........ |g:templator#expander#tvim#enable|
@@ -183,9 +184,14 @@ g:templator#verbose (default: 1)
183 184 If true, show some warnings (e.g. when opening an already existing
184 185 file that wasn't created by templator).
185 186
186   - *g:templator#edit*
187   -g:templator#edit (default: 'hide edit')
188   - The command used for opening files.
  187 + *g:templator#edit_new*
  188 +g:templator#edit_new (default: 'hide edit')
  189 + The command used for editing newly created files.
  190 +
  191 + *g:templator#edit_again*
  192 +g:templator#edit_again (default: g:templator#edit_new)
  193 + The command used for editing files that already existed.
  194 + If empty, don't open already existing files.
189 195
190 196 *g:templator#sep*
191 197 g:templator#sep (default: exists('+shellslash') && !&shellslash ? '\' : '/')

No commit comments for this range

Something went wrong with that request. Please try again.