diff options
author | Jurica Bradaric <jbradaric@gmail.com> | 2016-05-07 21:11:36 +0200 |
---|---|---|
committer | Jurica Bradaric <jbradaric@gmail.com> | 2016-05-08 00:23:42 +0200 |
commit | 2b238814d7c72783db2d541ef642ffd481eb0745 (patch) | |
tree | 98971fd0dd47b7b68621b3b58f0b9cb5000d8865 /src/nvim/eval.c | |
parent | b02ba11cb156e094d3f6f12fc7c79a983b6df68d (diff) | |
download | rneovim-2b238814d7c72783db2d541ef642ffd481eb0745.tar.gz rneovim-2b238814d7c72783db2d541ef642ffd481eb0745.tar.bz2 rneovim-2b238814d7c72783db2d541ef642ffd481eb0745.zip |
vim-patch:7.4.1042
Problem: g-CTRL-G shows the word count, but there is no way to get the word
count in a script.
Solution: Add the wordcount() function. (Christian Brabandt)
https://github.com/vim/vim/commit/ed767a2073ef150971b0439a58e7ee582af6984e
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d84bdfebfe..b5bf87bff4 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6949,6 +6949,7 @@ static struct fst { { "winrestview", 1, 1, f_winrestview }, { "winsaveview", 0, 0, f_winsaveview }, { "winwidth", 1, 1, f_winwidth }, + { "wordcount", 0, 0, f_wordcount }, { "writefile", 2, 3, f_writefile }, { "xor", 2, 2, f_xor }, }; @@ -16910,6 +16911,13 @@ static void f_winwidth(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = wp->w_width; } +/// "wordcount()" function +static void f_wordcount(typval_T *argvars, typval_T *rettv) +{ + rettv_dict_alloc(rettv); + cursor_pos_info(rettv->vval.v_dict); +} + /// "writefile()" function static void f_writefile(typval_T *argvars, typval_T *rettv) { |