Beispiel #1
0
/*
 * List placed signs for "rbuf".  If "rbuf" is NULL do it for all buffers.
 */
    static void
sign_list_placed(buf_T *rbuf, char_u *sign_group)
{
    buf_T	*buf;
    signlist_T	*sign;
    char	lbuf[MSG_BUF_LEN];
    char	group[MSG_BUF_LEN];

    msg_puts_title(_("\n--- Signs ---"));
    msg_putchar('\n');
    if (rbuf == NULL)
	buf = firstbuf;
    else
	buf = rbuf;
    while (buf != NULL && !got_int)
    {
	if (buf->b_signlist != NULL)
	{
	    vim_snprintf(lbuf, MSG_BUF_LEN, _("Signs for %s:"), buf->b_fname);
	    msg_puts_attr(lbuf, HL_ATTR(HLF_D));
	    msg_putchar('\n');
	}
	FOR_ALL_SIGNS_IN_BUF(buf, sign)
	{
	    if (got_int)
		break;
	    if (!sign_in_group(sign, sign_group))
		continue;
	    if (sign->group != NULL)
		vim_snprintf(group, MSG_BUF_LEN, _("  group=%s"),
							sign->group->sg_name);
	    else
		group[0] = '\0';
	    vim_snprintf(lbuf, MSG_BUF_LEN,
			   _("    line=%ld  id=%d%s  name=%s  priority=%d"),
			   (long)sign->lnum, sign->id, group,
			   sign_typenr2name(sign->typenr), sign->priority);
	    msg_puts(lbuf);
	    msg_putchar('\n');
	}
	if (rbuf != NULL)
	    break;
	buf = buf->b_next;
    }
}
Beispiel #2
0
/*
 * Recursively show the mappings associated with the menus under the given one
 */
static void show_menus_recursive(vimmenu_T *menu, int modes, int depth)
{
  int i;
  int bit;

  if (menu != NULL && (menu->modes & modes) == 0x0)
    return;

  if (menu != NULL) {
    msg_putchar('\n');
    if (got_int)                /* "q" hit for "--more--" */
      return;
    for (i = 0; i < depth; i++)
      MSG_PUTS("  ");
    if (menu->priority) {
      msg_outnum((long)menu->priority);
      MSG_PUTS(" ");
    }
    /* Same highlighting as for directories!? */
    msg_outtrans_attr(menu->name, hl_attr(HLF_D));
  }

  if (menu != NULL && menu->children == NULL) {
    for (bit = 0; bit < MENU_MODES; bit++)
      if ((menu->modes & modes & (1 << bit)) != 0) {
        msg_putchar('\n');
        if (got_int)                    /* "q" hit for "--more--" */
          return;
        for (i = 0; i < depth + 2; i++)
          MSG_PUTS("  ");
        msg_putchar(menu_mode_chars[bit]);
        if (menu->noremap[bit] == REMAP_NONE)
          msg_putchar('*');
        else if (menu->noremap[bit] == REMAP_SCRIPT)
          msg_putchar('&');
        else
          msg_putchar(' ');
        if (menu->silent[bit])
          msg_putchar('s');
        else
          msg_putchar(' ');
        if ((menu->modes & menu->enabled & (1 << bit)) == 0)
          msg_putchar('-');
        else
          msg_putchar(' ');
        MSG_PUTS(" ");
        if (*menu->strings[bit] == NUL)
          msg_puts_attr((char_u *)"<Nop>", hl_attr(HLF_8));
        else
          msg_outtrans_special(menu->strings[bit], FALSE);
      }
  } else {
    if (menu == NULL) {
      menu = root_menu;
      depth--;
    } else
      menu = menu->children;

    /* recursively show all children.  Skip PopUp[nvoci]. */
    for (; menu != NULL && !got_int; menu = menu->next)
      if (!menu_is_hidden(menu->dname))
        show_menus_recursive(menu, modes, depth + 1);
  }
}