Friday, January 15, 2016

Use FileBrowser package as the right sidebar of Sublime Text 3

Do you want to move the sidebar of Sublime Text from the left to the right like me? Unfortunately, you can not do that. The sidebar is not movable. But, the good news is there is an alternative solution which is great:

FileBrowser for SublimeText

Github repo: https://github.com/aziz/SublimeFileBrowser

What we are going to do to have a right sidebar is to use FileBrowser package in a split windows mode (and you should hide the default sidebar via menu View > Sidebar > Hide sidebar).

1. Install SublimeText's Package Control:

a. Open the console by enter "CTRL + `" combination keys

b. Paste this into the console:

import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

Note: you'd better refer to this page to have the latest installation code.

c. Press enter to install

2. Install the FileBrowser package:

a. Open the Command Palette by pressing "CTRL + SHIFT + P" keys
b. Search for FileBrowser
c. Select the package to install

3. Go to Preferences >> Package Settings >> FileBrowser >> Key Bindings - User, add this:

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

]

4. Now press Shift+Alt+2 to change the layout of your Sublime Text editor into 2 panels

5. Select the panel on the right and press F1. It will open the filebrowser and act like a sidebar navigation now.