Skip to content

Commit

Permalink
Add g:clang_trailing_placeholder option
Browse files Browse the repository at this point in the history
To add an extra placeholder at the and of function snippet.

See #176
  • Loading branch information
xaizek committed Jul 28, 2012
1 parent 443fe68 commit 742694b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion autoload/snippets/clang_complete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ function! snippets#clang_complete#add_snippet(fullname, args_pos)
endfor

let l:res .= a:fullname[l:prev_idx : ]
if g:clang_trailing_placeholder == 1 && len(a:args_pos) > 0
let l:res .= '<##>'
endif

return l:res
endfunction
Expand Down Expand Up @@ -88,7 +91,7 @@ endfunction
function! MoveToCCSnippetEnd()
let l:line = getline('.')
let l:pattern = '#>'
let l:startpos = col('.') + 2
let l:startpos = col('.') + 1

call cursor(line('.'), match(l:line, l:pattern, l:startpos) + 1)
endfunction
Expand Down
14 changes: 11 additions & 3 deletions doc/clang_complete.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*clang_complete.txt* For Vim version 7.3. Last change: 2012 Jul 09
*clang_complete.txt* For Vim version 7.3. Last change: 2012 Jul 29


clang_complete plugin documentation
Expand Down Expand Up @@ -120,8 +120,9 @@ Default: "clang_complete"

*clang_complete-conceal_snippets*
*g:clang_conceal_snippets*
If equal to 1, vim will use vim 7.3 conceal feature to hide <# and #> which
delimit a snippets.
Note: This option is specific to clang_complete snippets engine.
If equal to 1, clang_complete will use vim 7.3 conceal feature to hide <#
and #> which delimit snippet placeholders.

Example of conceal configuration (see |'concealcursor'| and |'conceallevel'|
for details): >
Expand All @@ -132,6 +133,13 @@ for details): >
Default: 1 (0 if conceal not available)

*clang_complete-clang_trailing_placeholder*
*g:clang_trailing_placeholder*
Note: This option is specific to clang_complete snippets engine.
If equal to 1, clang_complete will add a trailing placeholder after functions
to let you add you continue writing code faster.
Default: 0

*clang_close-preview*
*g:clang_close_preview*
If equal to 1, the preview window will be close automatically after a
Expand Down
6 changes: 5 additions & 1 deletion plugin/clang_complete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ function! s:ClangCompleteInit()
endif

if !exists('g:clang_conceal_snippets')
let g:clang_conceal_snippets= has('conceal')
let g:clang_conceal_snippets = has('conceal')
endif

if !exists('g:clang_trailing_placeholder')
let g:clang_trailing_placeholder = 0
endif

" Only use libclang if the user clearly show intent to do so for now
Expand Down

0 comments on commit 742694b

Please sign in to comment.