aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2020-01-26 02:07:40 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2020-01-26 02:07:40 +0900
commitbb2d8561f8d75cff067853af72cb74ae3c441cc6 (patch)
treed56f06f653db27be3a84075adb61f5f4464bb279
parent13dabdeefdd69d53e68bf9d2f70bdc130d0f5130 (diff)
downloadvim-sonictemplate-bb2d8561f8d75cff067853af72cb74ae3c441cc6.tar.gz
vim-sonictemplate-bb2d8561f8d75cff067853af72cb74ae3c441cc6.tar.bz2
vim-sonictemplate-bb2d8561f8d75cff067853af72cb74ae3c441cc6.zip
Add json
-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": {
+ }
+}