Skip to main content

C-Mate : Your companion for C in Sublime Text

What is C-Mate ?

When it comes to writing code then either we choose an IDE like codeblocks or ecllipse, OR we use some text editor like notepad++ or sublime text. Sublime text is a very powerful, flexible and free text editor. You can install any package you want in sublime which help you writing codes easily. C-Mate is also such a sublime package which will help you write C code efficiently on ubuntu. It consists of many useful snippets, pre-coded functions and a powerful build system.



Why C-Mate

Although there is a pre-installed c++ sublime package which helps you writing c as well as c++ codes but the feature it lags is the code running in the terminal. People like writing code in sublime but when it comes to build and run the code then they need to go the directory containing the code file and then build and run it from there. It gets so annoying when we debug the code. No sublime package allows to run the code within the sublime. Here C-Mate makes the exception. Its build system is capable of running the code in terminal from within the sublime.

Also it comes with some pre-coded functions which noone wants to write again and again but need to write them unwillingly. These functions are min(int *), swap(int, int) and much more. You all just need to start typing the name of the function and it will write the function declaration and function body of that function.

C-Mate also consists many useful shortcuts/snippets which speed up you writing. Like include, for loop, while loop, main function, structure, typedef and many more.



How to get it ?

It has not come to the sublime package install yet but it will be there soon. Till that time, you'll need to install it manually. Don't worry, you just need to follow 2 steps.

  1. Download the C-Mate from here. Download C-Mate
  2. Copy the downloaded file to /home/.config/sublime-text-3/Installed Packages/. Thats it
  3. Now just type your c code and press ctrl+b and select C-Mate.



How to use it ?

After the installation, just start typing your code and C-Mate will start helping you. When you are finished your code, just press ctrl+b and select C-Mate. You wont have to select C-Mate every time. Its just for the first time.

Associated keys

  1. ctrl+b : Build the code
  2. ctrl+shift+b : Run the code in the terminal.

Some snippets keywords

  1. main : for main() function
  2. inc : include statement
  3. for : for loop
  4. while : while loop
  5. type : typedef
  6. .......and many more

Note : It is to note that the application file of your code will be create in the same directory in which the code file reside. And its name will be the same as of the code file but without the .c extension. This means that you can create multiple application files in the same directory without the fear of losing the previous one.

In the near future, i'll try to incorporate auto function declaration feature in C-Mate. If you want to contribute to C-Mate then you can visit its github repo. If you have any doubt regarding its functionality then just comment it out below and i'll be happy to solve your query.

Comments

Popular posts from this blog

Image Search Engine Using Python

Images provide a lot more information than audio or text. Image processing is the prime field of research for robotics as well as search engines. In this article we will explore the concept of finding similarity between digital images using python. Then we will use our program to find top 10 search results inside a dataset of images for a given picture. It won't be as good as google's search engine because of the technique we will be using to find similarity between images. But what we are going to make will be pretty cool. So lets start. Setting up the Environment Our Algorithm How the code looks Lets build the GUI Additional Techniques Setting up the Environment The code we are going to write requires a few tools which we need to install first. I will try to be as precise as i can and if you get stuck into installing some tool then you can drop a comment below and i will help you sort out the problem. So here are the tools and the steps to install

Understanding Python Decorators

If you have ever wondered what those @something mean above a python function or method then you are going to have your answers now. This @something line of code is actually called a decorator. I have red from various articles about them but some of them were not able to clarify the concept of a decorator and what we can achieve with them. So in this post we'll learn a lot about python decorators. Here is a list of topics we'll be covering. What is python decorator Understanding the concept Multiple decorators on same function class method decorator Where can we use decorators What is python decorator A python decorator is nothing but a function which accepts your given function as a parameter and returns a replacement function. So its like something this def decorator(your_func): def replacement(your_func_args): #do some other work return replacement @decorator your_func(your_func_args): #your_func code Now when your_func gets called then

Cordova viewport problem solved

Include the viewport settings in Cordova If you are facing the auto zooming problem of cordova then go read on the full article. Cordova actually ignores the viewport meta tag which causes the pixel density problem. So we need to tell cordova that viewport tag is equally important as other tags. To do this, we need to add some code to a file which is specify in the article. Corodva messes with pixels If you are using the latest cordova version or creating the cordova app for latest android versions then you may have faced the zoom malfunctioning.I also faced it when creating an app. Many of you may have already searched the web and found the answer of changing the meta tag attributes to get it working. But adding target-densitydpi=medium-dpi does not solve the problem for latest android versions. It may work for gingerbread but not for kitkat and others. So the final solution which i found was one of the stackexchange answer but rarely found. So i am gonna two things here, i