Added VimtexCountLetters

Also changed name: VimtexWordCount to VimtexCountWords
This commit is contained in:
Karl Yngve Lervåg 2016-06-07 15:24:27 +02:00
parent e70c0b469c
commit 6e9dae11a4
2 changed files with 20 additions and 15 deletions

View File

@ -109,10 +109,11 @@ function! vimtex#info(global) " {{{1
endfunction
" }}}1
function! vimtex#wc(detailed) " {{{1
function! vimtex#wc(detailed, ...) " {{{1
" Run texcount, save output to lines variable
let cmd = 'cd ' . vimtex#util#shellescape(b:vimtex.root)
let cmd .= '; texcount -nosub -sum '
let cmd .= a:0 > 0 ? '-letter ' : ''
let cmd .= a:detailed > 0 ? '-inc ' : '-merge '
let cmd .= vimtex#util#shellescape(b:vimtex.base)
let lines = split(system(cmd), '\n')
@ -309,7 +310,8 @@ function! s:init_buffer() " {{{1
" Define commands
command! -buffer -bang VimtexInfo call vimtex#info(<q-bang> == "!")
command! -buffer -bang VimtexWordCount call vimtex#wc(<q-bang> == "!")
command! -buffer -bang VimtexCountWords call vimtex#wc(<q-bang> == "!")
command! -buffer -bang VimtexCountLetters call vimtex#wc(<q-bang> == "!", 1)
command! -buffer VimtexReload call vimtex#reload()
command! -buffer VimtexToggleMain call vimtex#toggle_main()

View File

@ -1085,19 +1085,22 @@ Commands~
:VimtexReload Reload |vimtex| scripts. This is primarely useful
when developing and debugging |vimtex| itself.
*VimtexWordCount*
:VimtexWordCount Shows the number of words in the current project.
The count is created with `texcount` through a call
on the main project file similar to: >
*VimtexCountLetters*
*VimtexCountWords*
:VimtexCountLetters Shows the number of letters/characters or words in
:VimtexCountWords the current project. The count is created with
`texcount` through a call on the main project file
similar to: >
texcount -nosub -sub -merge FILE
texcount -nosub -sub [-letter] -merge FILE
<
*VimtexWordCount!*
:VimtexWordCount! Similar to |VimtexWordCount|, but show separate
reports for included files. I.e. presents the
result of >
*VimtexCountLetters!*
*VimtexCountWords!*
:VimtexCountLetters! Similar to |VimtexCountLetters|/|VimtexCountWords|, but
:VimtexCountWords! show separate reports for included files. I.e.
presents the result of >
texcount -nosub -sub -inc FILE
texcount -nosub -sub [-letter] -inc FILE
<
*VimtexImapsList*
*<plug>(vimtex-imaps-list)*