2

中键关闭GVim的标签

 3 years ago
source link: https://blog.lilydjwg.me/posts/19248.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

中键关闭GVim的标签

本文来自依云's Blog,转载请注明。

今天在Vim Talks群群地址)上看到闲耘™问到GVim能否像其它很多程序那样使用中键关闭对应的标签。虽然我自己在Vim鼠标用得比较少,但也曾想过这个问题。现在刚刚考试完毕,所以就去试着改了下Vim的源代码。没想到只需要加六行代码呵~~

#ifndef HAVE_GTK2
else
gtk_notebook_set_page(GTK_NOTEBOOK(gui.tabline),
clicked_page - 1);
#endif
}
/* The following if is added by lilydjwg, to enable closing tab by
* middle-clicking. */
else if (bevent->button == 2)
{
send_tabline_menu_event(clicked_page, (int)(long)TABLINE_MENU_CLOSE);
if (gtk_main_level() > 0)
gtk_main_quit();
}
}
/* We didn't handle the event. */
return FALSE;
}

以上的代码包含了上下文。把原本不存在的部分添加到gui_gtk_x11.c的3303行附近,然后重新编译即可~

PS: 这个只支持GTK版的GVim,所以不适用于Windows平台。

在此还要感谢Ubuntu大学群的Edward提供帮助。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK