Skip to content

AlexKordic/SublimeFileBrowser

 
 

Repository files navigation

FileBrowser for SublimeText

Ditch sidebar and browse your files in a normal tab with keyboard, like a pro!

SublimeFileBrowser Screenshot

You can also use it as a sidebar that you can put on right or left side SublimeFileBrowser Screenshot2

Installation

You can install via Sublime Package Control
Or you can clone this repo into your Sublime Text Packages folder and rename the folder to FileBrowser

Commands and Keybindings

This plugin does not add any keybindings for opening a new tab in "Browse mode". Although, the commands to do that are available in command pallete but I recommend binding F1 to open the current file folder in "Browse mode" with this peice of code (that you can add it to your Key Bindings - User file):

{
  "keys": ["f1"],
  "command": "dired",
  "args": { "immediate": true }
}

You also can use optional arguments to tweak behaviour:

  • "single_pane": true — always use a single File Browser view, i.e. prefer to reuse existing one rather than create a new;
  • "other_group": "left" (or "right) — open File Browser in other group, i.e. like sidebar; if you use "left" then all other tabs from left group will be moved into the right one;
  • "project": true — always prefer project’s folder(s) rather than path of current view.

You can mix these arguments as you like (perhaps, even bind several shortcuts for different cases); e.g. to completely mimic sidebar, it would be:

{
  "keys": ["f1"],
  "command": "dired",
  "args": {
    "immediate": true,
    "single_pane": true,
    "other_group": "left",
    "project": true
  }
}
Commands Description
Browse Mode... Asks for a directory to open in browse mode
Browse Mode: Current file or project Open the directory of current file in browse mode

Shortcuts

Command Shortcut
Help page ?
Toggle mark m
Toggle mark and move down shift+↓
Toggle mark and move up shift+↑
Toggle all marks t
Unmark all u
Mark by extension *
Rename R
Move M
Delete D
Send to trash S
Create directory cd
Create file cf
Open file/view directory o
Open file in another group enter
Preview file in another group shift+enter
Open all marked items in new tabs ⌘+enter / ctrl+enter
Open in Finder/File Explorer \
Open in new window w
Go to parent directory backspace
Go to directory g
Quick jump to directory p
Create/Edit/Remove jump point P
Go to first ⌘+↑ or ctrl+home
Go to last ⌘+↓ or ctrl+end
Move to previous k or
Move to next j or
Expand directory
Collapse directory
Jump to /
Find in files s
Refresh view r
Toggle hidden files h
Toggle add folder to project f
Set current folder as only one for the project F
Quicklook for Mac or open in default app on other OSs space

In Rename Mode:

Command Shortcut
Apply changes enter
Discard changes escape

Selecting Files and Directories

You can select files and/or directories by marking them with m, or Shift+up/down or just use the sublime multiple cursor feature and extend your cursor to the line that has those files/directories.

Search

Besides incremental search availibale by /, you also may use build-in ‘Goto Symbol…’ (⌘+r or ctrl+r) for fuzzy search.

‘Find in Files…’ integration

Press s to summon ‘Find in Files…’ panel — if you’ve marked some files they will fill ‘Where’ field, otherwise it’ll be filled by current folder path.

Rename Mode

The rename command puts the view into rename mode. The view is made editable so files can be renamed directly in the view using all of your Sublime Text tools: multiple cursors, search and replace, etc.

After you are done with editing press enter to commit your changes or escape to cancel them.

Open in new window

Selecting a couple of files and/or directories (either by marking them or using the normal multiple cursor feature of sublime) and pressing w will open them in a new SublimeText window.

Close FileBrowser when files have been opened

Add the following code in your user key bindings file:

{
  "keys": ["o"],
  "command": "dired_select", "args": {"and_close": true},
  "context": [
    { "key": "selector", "operator": "equal", "operand": "text.dired" },
    { "key": "setting.dired_rename_mode", "operand": false }
  ]
}

Customizing UI

If you don’t like symbol and want to hide it (then you should use keyboard binding backspace to go to parent directory) you can do it in your user syntax specific settings file (PreferencesPackage SettingsFileBrowserSettings — User) and paste the code below:

{
  "dired_show_parent": false,
}

Hidden files

By default, FileBrowser shows all files in the browsed directory. Pressing h toggles the display of hidden files. For all platforms, any file that starts with a . is considered hidden; additionally, on Windows, files that have the hidden attribute set are also considered hidden.

To set FileBrowser to hide hidden files by default, add the following to your settings:

{
  "dired_show_hidden_files": false
}

You can also customize the patterns used to determine if a file should be hidden with the dired_hidden_files_patterns setting, which should be either a single pattern string or a list of such patterns:

{
  "dired_hidden_files_patterns": [".*", "__pycache__", "*.pyc"]
}

Git integration

In case git status returns a colorable output in current folder, the modified and untracked files will be designated by orange and green icons respectively.
You can use setting "vcs_color_blind": true — untracked files will get vertical line on left side of their icons, modified files will get horizontal line under their icons.
If Git is not presented in your PATH you may set git_path setting (see example in default settings file).

Hijacking New Windows

Filebrowser can hijack new window command and show a new window with a file browsing buffer by default. This feature is only available for ST3 and is disabled by default. You can activate it by setting dired_hijack_new_window to true in you user settings file.

{
  "dired_hijack_new_window": true
}

Changing color scheme

If you don’t like colors used in FileBrowser just copy this file to your User folder, change colors and paste the code below in your user syntax specific settings file:

{
  "color_scheme": "Path to your custom color scheme file. e.g. Packages/User/custom_dired.hidden-tmTheme",
}

Credit

This is a fork of the awesome dired plugin by Michael Kleehammer

License

See the LICENSE file

About

Ditch sidebar and browse your files in a normal tab with keyboard, like a pro!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%