From 6e9dae11a46223271b1f3f30f1042ebd30582a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Tue, 7 Jun 2016 15:24:27 +0200 Subject: [PATCH] Added VimtexCountLetters Also changed name: VimtexWordCount to VimtexCountWords --- autoload/vimtex.vim | 12 +++++++----- doc/vimtex.txt | 23 +++++++++++++---------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/autoload/vimtex.vim b/autoload/vimtex.vim index 21cb7c8..944c1f2 100644 --- a/autoload/vimtex.vim +++ b/autoload/vimtex.vim @@ -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') @@ -308,10 +309,11 @@ function! s:init_buffer() " {{{1 " " Define commands - command! -buffer -bang VimtexInfo call vimtex#info( == "!") - command! -buffer -bang VimtexWordCount call vimtex#wc( == "!") - command! -buffer VimtexReload call vimtex#reload() - command! -buffer VimtexToggleMain call vimtex#toggle_main() + command! -buffer -bang VimtexInfo call vimtex#info( == "!") + command! -buffer -bang VimtexCountWords call vimtex#wc( == "!") + command! -buffer -bang VimtexCountLetters call vimtex#wc( == "!", 1) + command! -buffer VimtexReload call vimtex#reload() + command! -buffer VimtexToggleMain call vimtex#toggle_main() " Define mappings nnoremap (vimtex-info) :VimtexInfo diff --git a/doc/vimtex.txt b/doc/vimtex.txt index 0f96db7..a4eb70a 100644 --- a/doc/vimtex.txt +++ b/doc/vimtex.txt @@ -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* *(vimtex-imaps-list)*