Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions autoload/coc/source/template.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let s:dict = [
\ 'CLASS',
\ 'MACROCLASS',
\ 'CAMELCLASS',
\ 'SPACECLASS',
\ 'HERE',
\ ]

Expand Down
5 changes: 5 additions & 0 deletions doc/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ templates:
File name, without extension, with the first character of
every work capitalised, and underscores removed.

`%SPACECLASS%`
File name, without extension, with the first character of
every work capitalised, and underscores and dashed replaced
with space.

`%HERE%`
Expands to nothing, but ensures that the cursor will be placed in
the position where this variable appears after expanding the template.
Expand Down
2 changes: 2 additions & 0 deletions plugin/templates.vim
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ function <SID>TExpandVars()
let l:class = substitute(l:filen, "\\([a-zA-Z]\\+\\)", "\\u\\1\\e", "g")
let l:macroclass = toupper(l:class)
let l:camelclass = substitute(l:class, "_", "", "g")
let l:spaceclass = substitute(l:class, "[_,-]", " ", "g")

" Define license variable
if executable('licensee') && g:templates_use_licensee
Expand Down Expand Up @@ -402,6 +403,7 @@ function <SID>TExpandVars()
call <SID>TExpand("CLASS", l:class)
call <SID>TExpand("MACROCLASS", l:macroclass)
call <SID>TExpand("CAMELCLASS", l:camelclass)
call <SID>TExpand("SPACECLASS", l:spaceclass)
call <SID>TExpand("LICENSE", l:license)

" Perform expansions for user-defined variables
Expand Down
2 changes: 1 addition & 1 deletion syntax/vim-template.vim
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if b:vim_template_subtype != ""
unlet b:current_syntax
endif

syn match vimtemplateVariable "%\%(DAY\|YEAR\|MONTH\|MONTHSHORT\|MONTHFULL\|DATE\|TIME\|FILE\|FFILE\|EXT\|MAIL\|USER\|HOST\|GUARD\|CLASS\|MACROCLASS\|CAMELCLASS\|HERE\)%" containedin=ALL
syn match vimtemplateVariable "%\%(DAY\|YEAR\|MONTH\|MONTHSHORT\|MONTHFULL\|DATE\|TIME\|FILE\|FFILE\|EXT\|MAIL\|USER\|HOST\|GUARD\|CLASS\|MACROCLASS\|CAMELCLASS\|SPACECLASS\|HERE\)%" containedin=ALL

let b:current_syntax = "vim-template"

Expand Down