SublimeText Macros made easy!

Creating sublimetext macro,

I am suing RSpec and it deals with lot of commands that my sublime text wasn’t recognizing or giving me a snippet so what I thought of is writing sublimetext macros which is a great underused tool by all the developers.

  1. So first step was recording the snippet and then save it as macro suing the UI.
  2. Second step is to cleanup the file.

    Navigate to place where the macros live, for macOS its:

    ~Library/Application Support/Sublime Text 3/Packages/User

    Then I opened Sublime and tried to clean up the file where sometimes it would end up dividing same command into parts. :/ not sure why though but my understanding is due to typing speed??

  3. Create key bindings to the macros that you have just created.
    Key binding is the way you can invoke the macros that you have just defined.
  4. Reopen sublime and user your key combination to invoke the macro that you want to use!

 

Files:

  1. rspec-describe.sublime-macro
  2. Default (OSX).sublime-keymap

Future work:

While i see that I am happy with the way I have defined the macros to my editor. Sometimes indentation is not right which I need to work on.

recording the macro doesn’t give the relative indentation, the problem which I am facing now with the above macros.

If incase you have a solution please comment below!

http://docs.sublimetext.info/en/latest/extensibility/macros.html

Advertisements

Get started with LaTeX

LaTeX is one the typesetting languages out there that lets you create documents very easily!

I find the following books particularly helpful if you want to learn LaTeX

https://www.tug.org/twg/mactex/tutorials/ltxprimer-1.0.pdf

https://www.cs.princeton.edu/courses/archive/spr10/cos433/Latex/latex-guide.pdf

http://www.docs.is.ed.ac.uk/skills/documents/3722/3722-2014.pdf

Hope you find these helpful! Happy LaTeXing! 🙂

 

Adding Emojis to your Mac terminal

If you have to ssh to work and have the local system and get confused every now and then. Then you might add some visual indicators in the bash shell so you can easily spot where you are!

1. Open your .bash_profile and add the following line.

PS1="\h  🍀  \W "

To Open emoji’s in Mac, you need to go to ‘Edit’ > ‘Emojis & Symbols’ and add your desired emoji. Be it in twitter, notes or anywhere this is the way to do in a Mac.

2. Save the bash_profile file,

3. Reopen terminal and BOOM!

Note: while Adding PS1=” ” remember that you shouldn’t have a space between = and “.

This artical was inspired by one of Ruby programmers having vidcast. And idea is borrowed from http://itsras.blogspot.com/2013/04/os-x-daily-customize-command-line-by.html

Let me know what other emoji’s you like the most to have them on terminal.

Cheers!

Commandline tricks

Installing ‘ll’ in mac osx:

Sometimes you will notice that the ‘ll’ command is not found in MAC OSX. To enable it do something like this:

alias ll='ls -lG'

Bingo!

http://unix.stackexchange.com/a/28426/97013

Know more about Running Processes and killing them in Unix:

https://www.digitalocean.com/community/tutorials/how-to-use-ps-kill-and-nice-to-manage-processes-in-linux

To see all the processes on the system:

ps -af

ps -af | more

You can also search for particular sorts of process using the grep command. grep searches for a given string of characters within a file. If you “pipe” the output from ps into grep it will search for a string and only display those lines on which the string occurs.

ps -af | grep pine

To get a list of the current environment variables and their values

env

https://www.st-andrews.ac.uk/ITS/training/unix/unix7.html


If I know the PID number of a process, how can I get its name?

On all POSIX-compliant systems, and with Linux, you can use ps:

ps -p 1337 -o comm=

Here, the process is selected by its PID with -p. The -o option specifies the output format, comm meaning the command name.

http://superuser.com/a/632987/314977

http://pubs.opengroup.org/onlinepubs/009696799/utilities/ps.html

http://pubs.opengroup.org/onlinepubs/9699919799/