简体   繁体   English

恢复 sublime-text 默认状态栏

[英]Restore sublime-text default status bar

I installed a couple of plugins to add more features to sublime's status-bar, but it resulted in removing some basic features of it like getting number of matches of a specific word in Find.我安装了几个插件来为 sublime 的状态栏添加更多功能,但这导致删除了它的一些基本功能,例如在 Find 中获取特定单词的匹配数。 [check screenshot] [检查截图]
Plugin link: https://github.com/shagabutdinov/sublime-status-message插件链接: https : //github.com/shagabutdinov/sublime-status-message
I tried removing all relevant plugins, no success.我尝试删除所有相关插件,但没有成功。
So, how can I restore default settings of status bar, I tried writing a script to restore or shift the items in status bar with no fruitful result so far那么,如何恢复状态栏的默认设置,我尝试编写一个脚本来恢复或移动状态栏中的项目,到目前为止没有取得任何成果

在此处输入图片说明

There isn't any mechanism by which a plugin can remove items from the status bar, they can only add extra items to it.没有任何机制可以让插件从状态栏中删除项目,他们只能向其中添加额外的项目。 Such added items appear to the left of the status bar items that Sublime generates on it's own such as the cursor position information or the find information that you're currently unable to see.这些添加的项目出现在 Sublime 自己生成的状态栏项目的左侧,例如光标位置信息或您当前无法看到的查找信息。

As such what you're actually experiencing is not that the default information has been removed but instead it's been pushed to the right of the status bar.因此,您实际遇到的并不是默认信息已被删除,而是被推到了状态栏的右侧。 If there is a lot of extra status information added or the window is narrow, that would have the effect of having those items appear to be gone because they're off the edge of the window.如果添加了很多额外的状态信息或窗口很窄,则会导致这些项目看起来消失了,因为它们超出了窗口的边缘。

Items added to the status bar remain for the current session until the plugin that added them removes them again.添加到状态栏的项目会保留在当前会话中,直到添加它们的插件再次删除它们。 Most plugins that add items to the status bar likely don't track their own removal and remove any status items that they added.大多数将项目添加到状态栏的插件可能不会跟踪他们自己的删除并删除他们添加的任何状态项目。

To be fully rid of status items you don't want, after removing the offending plugin (to make sure it doesn't add them back) you need to either close and reopen all of the affected files (status bar items are specific to the tab they were added to) or quit and restart Sublime.为了完全摆脱您不想要的状态项,在删除有问题的插件(以确保它不会将它们添加回来)后,您需要关闭并重新打开所有受影响的文件(状态栏项目特定于标签)或退出并重新启动 Sublime。

I solved the issue, it's related to the plugin in question which does hide default items of sublime's status-bar, the items don't show up back even after removing the plugin.我解决了这个问题,它与有问题的插件有关,该插件确实隐藏了 sublime 状态栏的默认项目,即使删除插件后这些项目也不会显示回来。 So, you have to use the plugin's API to restore status bar to default again.因此,您必须使用插件的 API 再次将状态栏恢复为默认值。
The following script from their API can restore the default items back:他们的 API 中的以下脚本可以恢复默认项目:

import sublime
import sublime_plugin
from StatusMessage import status_message

class RestoreDefaultStatus(sublime_plugin.TextCommand):
  def run(self, edit):
    status_message.hide_default_status = not status_message.hide_default_status
    status_message.refresh(self.view)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM