aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-11-15 12:06:10 -0500
committerJames McCoy <jamessan@jamessan.com>2016-12-28 14:57:38 -0500
commit00466410701802214aba5c95f1cbb2e5086a37f5 (patch)
tree475ac94ef210e89b2a36deb9bbcfc0dbf212c7f0 /src/nvim/option.c
parent99a8cd3be0509e97b649edc1599bfb74bf2b4802 (diff)
downloadrneovim-00466410701802214aba5c95f1cbb2e5086a37f5.tar.gz
rneovim-00466410701802214aba5c95f1cbb2e5086a37f5.tar.bz2
rneovim-00466410701802214aba5c95f1cbb2e5086a37f5.zip
vim-patch:7.4.2204
Problem: It is not easy to get information about buffers, windows and tabpages. Solution: Add getbufinfo(), getwininfo() and gettabinfo(). (Yegappan Lakshmanan) https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 2249ef6e95..817e35d550 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -6923,3 +6923,28 @@ bool signcolumn_on(win_T *wp)
}
return wp->w_buffer->b_signlist != NULL;
}
+
+/// Get window or buffer local options.
+dict_T * get_winbuf_options(int bufopt)
+{
+ dict_T *d = dict_alloc();
+
+ for (int opt_idx = 0; options[opt_idx].fullname; opt_idx++) {
+ struct vimoption *opt = &options[opt_idx];
+
+ if ((bufopt && (opt->indir & PV_BUF))
+ || (!bufopt && (opt->indir & PV_WIN))) {
+ char_u *varp = get_varp(opt);
+
+ if (varp != NULL) {
+ if (opt->flags & P_STRING) {
+ dict_add_nr_str(d, opt->fullname, 0L, *(char_u **)varp);
+ } else {
+ dict_add_nr_str(d, opt->fullname, *varp, NULL);
+ }
+ }
+ }
+ }
+
+ return d;
+}