File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,4 +26,9 @@ vim.g.sigma_skeleton_dir = '~/.vim/templates'
2626vim .g .sigma_skeleton_fill = 0
2727```
2828
29- This is a very early version, it might not work as expected.
29+ This is a very early version, it might not work as expected, but it should.
30+ Feel free to create issues if something goes wrong.
31+
32+ ## Similar projects / inspirations
33+
34+ - [ vim-skeleton] ( https://github.com/noahfrederick/vim-skeleton )
Original file line number Diff line number Diff line change 99function ! skeleton#load (file_path)
1010 if ! filereadable (a: file_path ) || (g: sigma_skeleton_fill == 1 && getfsize (a: file_path ) < 1 )
1111 let s: file_name = split (a: file_path , ' /' )[-1 ]
12- let s: file_dir = split (s : file_path , ' /' )[-2 ]
13- let s: file_ext = split (s: file_name , ' .' )[-1 ]
12+ let s: file_dir = split (a : file_path , ' /' )[-2 ]
13+ let s: file_ext = split (s: file_name , ' \ .' )[-1 ]
1414 let s: template_path = expand (g: sigma_skeleton_dir .. ' /' .. s: file_name )
1515 let s: template_by_dir = expand (g: sigma_skeleton_dir .. ' /' .. s: file_dir .. ' /skel.' .. s: file_ext )
1616 let s: template_default = expand (g: sigma_skeleton_dir .. ' /skel.' .. s: file_ext )
1717
1818 if filereadable (s: template_path )
19- return s: template_path
19+ execute ' 0read ' .. s: template_path
2020 elseif filereadable (s: template_by_dir )
21- return s: template_by_dir
21+ execute ' 0read ' .. s: template_by_dir
2222 elseif filereadable (s: template_default )
23- return s: template_default
23+ execute ' 0read ' .. s: template_default
2424 endif
2525 endif
26-
27- return ' '
2826endfunction
2927
Original file line number Diff line number Diff line change 2121
2222augroup sigma_skeleton
2323 au !
24- autocmd BufNewFile *.* silent ! 0 r skeleton#load (% :p )
24+ autocmd BufEnter * silent ! if & buftype == ' ' | call skeleton#load (expand ( ' %:p' )) | endif
2525augroup END
You can’t perform that action at this time.
0 commit comments