aziz / SublimeFileBrowser

Ditch sidebar and browse your files in a normal tab with keyboard, like a pro!
MIT License
395 stars 45 forks source link

Use specific icons for each file type #153

Open gwenzek opened 4 years ago

gwenzek commented 4 years ago

Hi, this PR is more a proof of concept right now I haven't properly tested it, particularly with ST2. I'm opening this to check the interest and get early feedback on how this should be implemented and what can possibly go wrong.

The idea is to replace the generic file prefix with something that depends on the file extension. Using this with Nerd fonts it can results in a menu like this:

Screen Shot 2019-11-29 at 16 35 11

Here is what my settings file looks like (which render as garbage unless you have the correct font):

{
    "color_scheme": "Packages/User/scalaSublimeSyntax/Espresso2.tmTheme",
    "dired_icons":
    {
        "gitignore": "",
        "hidden-tmLanguage": "謹",
        "json": "",
        "LICENSE": "",
        "md": "",
        "py": "",
        "sublime-keymap": "\ue7aa",
        "sublime-menu": "\ue7aa",
        "sublime-settings": "\ue7aa",
        "sublime-syntax": "\ue7aa",
        "tmLanguage": "謹",
        "tmPreferences": "謹",
        "txt": "",
        "xml": "謹",
        "zip": ""
    },
    "font_face": "FuraCode Nerd Font Mono"
}

The mixed unicode characters and escape is because settings files are overriden by FileBrowser plugin in a way that doesn't preserved the escaping. I'm not sure what the best way to share this. You can find unicode for an icon with the Nerd Fonts search tool.

gwenzek commented 4 years ago

I fixed a bug that was happening in the rename mode. I accidentally changed how the space after the icon was scoped which make the rename mode go crazy. I also updated the regex in the backspace keybinding to prevent the users from deleting the icon.

gwenzek commented 4 years ago

I had an issue where folding folder didn't work as expected in some specific circumstances. Sometimes _get_name_point returns the folder icon instead of the start of the file name. I added a specific test for that.