From bb2d8561f8d75cff067853af72cb74ae3c441cc6 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Sun, 26 Jan 2020 02:07:40 +0900 Subject: Add json --- autoload/sonictemplate.vim | 4 ++-- template/json/file-package.json | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 template/json/file-package.json 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": { + } +} -- cgit v1.2.3-54-g00ecf