VIM:如何使'saveas'浏览窗口文件类型.txt



当我在 VIM 中打开一个新的空缓冲区(在 Windows 上)时,我通常会给自己写一个注释。 如何使另存为浏览窗口中的默认文件类型.txt

我尝试将浏览过滤器设置为无济于事:

:let b:browsefilter="Textt*.txtn"

建议?

编辑:我几乎放弃了。 我分解并查看了GVIM 7源代码-在" gui_gtk.c"中,它具有以下内容:

 /*
  * Put up a file requester.
  * Returns the selected name in allocated memory, or NULL for Cancel.
  * saving,         select file to write
  * title           title for the window
  * dflt                default name
  * ext             not used (extension added)
  * initdir         initial directory, NULL for current dir
  * filter          not used (file name filter)
  */
     char_u *
 gui_mch_browse(int saving UNUSED,
           char_u *title,
           char_u *dflt,
           char_u *ext UNUSED,
           char_u *initdir,
           char_u *filter UNUSED)
 {

这向我表明,执行 GUI 提示浏览以保存的函数明确表示它忽略了ext参数 - 所以我无法指定默认类型。

我已经确定了一个糟糕的自定义保存命令,并在实际的 SaveAs 命令之前预先提示文件名 - 如此临时,以至于我脸红地将其包含在这里。

无论如何,谢谢大家。

你很接近b:需要g:

:let g:browsefilter="Textt*.txtn"

最新更新