aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/sonictemplate.vim4
-rw-r--r--template/json/file-package.json15
2 files changed, 17 insertions, 2 deletions
diff --git a/autoload/sonictemplate.vim b/autoload/sonictemplate.vim
index f411ada..14838cb 100644
--- a/autoload/sonictemplate.vim
+++ b/autoload/sonictemplate.vim
@@ -170,7 +170,7 @@ function! sonictemplate#getvar(name) abort
endfunction
function! s:dir() abort
- let l:name = expand('%:t:r:')
+ let l:name = expand('%:p:h:t:r')
if empty(l:name)
let l:name = fnamemodify(getcwd(), ':t')
endif
@@ -178,7 +178,7 @@ function! s:dir() abort
endfunction
function! s:name(default) abort
- let l:name = expand('%:t:r:')
+ let l:name = expand('%:t:r')
if empty(l:name)
let l:name = a:default
endif
diff --git a/template/json/file-package.json b/template/json/file-package.json
new file mode 100644
index 0000000..0aa1535
--- /dev/null
+++ b/template/json/file-package.json
@@ -0,0 +1,15 @@
+{
+ "name": "{{_dir_}}",
+ "description": "{{_cursor_}}",
+ "license": "",
+ "version": "1.0.0",
+ "bin": "./cli.js",
+ "main": "index.js",
+ "scripts": {
+ "start": "node index.js"
+ },
+ "dependencies": {
+ },
+ "devDependencies": {
+ }
+}