HotKey Roundup for Everything

As I’m now using MAC (use Windows before) for learning the coding and later on development, I find hotkeys for MAC and other new things I’m learning a must-used now.  Just Google some useful hotkey and I will put them here for regular referencing and update.

MAC

# basic
HOME:  command-left arrow
END:  command-right arrow

# browser
New_tab:  command-T
Close_tab:  command-W
New_window:  command-N
Close_window:  shift-command-N

# screen capture
capture the entire desktop: command-Shift-3.
copy the entire desktop: command-Control-Shift-3
capture a portion of the desktop: command-Shift-4
capture a specific application window: command-Shift-4, then Spacebar

It’s not finished yet and I’ll keep adding new hotkeys that I should repeatedly using on my code learning way, not necessary only for MAC.


					

Use Solarized Theme In MAC Terminal For Ruby On Rails Development

Image

I am now working on 2 machines, one is a Ubuntu 12.04 and another one is MBP.  By comparison, the stock Terminal.app of Mac is too boring and hard to read (Though I’m not saying the Ubuntu’s one is good enough).  Since I like the Soda theme I set in Sublime Text in both machines, and I prefer a dark background for the terminal, so I change it to make my dev learning happier and funnier.

So here’s how.

First go to this page to download the Solarized theme file.  In my case I choose the Dark one.

Second, open the terminal app and find in menu Preferences… >> Setting.  In the bottom left under ‘Profiles’, find the cog icon and select ‘Import…’ to import the theme file you just download.

Image

Image

After Importing the file, you will have the Solarized theme in ‘Profile’, select it and make it Default (by clicking ‘Default’ besides the cog icon).

Image

Finally, place the following command into your ~/.bash_profile to bring out the ansi color.  Otherwise you’ll just have the three colors showed on the right of the ‘Text’ options in the above window.

export PS1="\[33[36m\]\u\[33[m\]@\[33[32m\]\h:\[33[33;1m\]\w\[33[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'

Save it then you’ll have the Solarized color terminal for your dev.

Setup Sublime Text 2 on OSX Mavericks for Ruby on Rails

1. Install Sublime Text 2.

I choose ST2 instead of ST3 simply because I don’t like using beta app for my work.

2. Verify ST2 installation works.  The follow steps refers to the good post at stackoverflow: Sublime Text 3 .subl command

In terminal, go to a folder with a few documents and type:

/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl .

If ST2 opens the folder with documents showed in the left pane, then move on to the next step.  If not, go to the post I provided link and see what you miss.

3. Modify “.bash_profile”

In terminal, type

nano ~/.bash_profile

The file will be showed in terminal, add the following 2 lines in the end of file, then save and exit.

export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH↲
export EDITOR='subl -w'

enable the newly edited .bash_profile by typing:

source ~/.bash_profile

4. Create a symlink subl for Sublime Text:

ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

Please note I follow the post exactly to place the link file in /usr/local/bin

Now you should be able to use subl to open any text file.

5. Install Package Control, by following this instruction.

6. Install Packages via Package Control (⌘⇧P):

My picks here: Soda Theme, RailCasts Color Scheme, CoffeeScript, Git Gutter, and RubyTest (Ruby test cannot be installed by Package Control but manually, following their instruction on their github page).

7. Edit the Settings – User in Preference.

Mine is as follow:

{
 "caret_style": "solid",
 "color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
 "font_face": "Menlo",
 "font_options":
 [
 "no_round"
 ],
 "font_size": 12,
 "ignored_packages":
 [
 "Vintage"
 ],
 "soda_folder_icons": true,
 "theme": "Soda Light.sublime-theme",
 "wide_caret": true
}

Then restart ST2 to activate the setting.

That’s it.  I’ll keep this post updated as I move further in my development.

UPDATE: 2013/11/29

As you know that .scss/.less file for CSS showed in Sublime is pure white by default, we can open a such file and form the menu, go to View > Syntax > [Optional: Open all with current extension as…] > CSS, then all .scss/.less will looks like the other CSS file with color theme.  [Source: Sublime Text 2: How to get scss and Less files to have color?]