Saturday, 24 October 2015

Install latest version of Geany in Ubuntu and some customizations

Geany is a great editor, but the version in the reops is at version 1.23.1. If you'd like a more up to date version (1.25 at the time of writing) you can simply add a ppa.


To add the latest builds, add this ppa by opening a terminal and typing:

sudo apt-add-repository ppa:geany-dev/ppa

Then update and install it with:

sudo apt-get update && sudo apt-get install geany


You should now be running Geany 1.25














Customizing the layout



I like to make a few customizations to all the programs I use and Geany is no different. Some changes I like to make are:
Remove the toolbar
Install extra theme and change to a dark theme
Remove long line marker

Remove the toolbar

This is a simple step to do by toggling View>Show toolbar and it's gone, same for sidebar and messages bar.

Install new themes
There are a bunch of brilliant themes hosted on github, the ones I like are available here (geany-themes) and here (base-16-geany). I like the geany-themes and it has all I'll ever need, so heres how to install that.
Either download the zip from github or copy the following command:

wget https://github.com/geany/geany-themes/archive/master.zip

then unzip it in your file manager or via the command line with:

unzip geany-themes-master.zip

then cd into the directory:

cd geany-themes-master

In there, you will find a simple bash script to install the themes to your ~/.config/geany directory. To install the themes type the following command:

./install.sh

Then restart Geany. To select your theme, go to View>Change Color Scheme and select whichever suits your taste.







Remove long line marker

As you can see from the screenshot left, the long line marker is the vertical line right of the dialog box and is where the word-wrap setting will kick in.
I find it a bit distracting, so to disable it go to;
Edit>Preferences then
Editor>Display and toggle "Long line marker" on or off.

Monday, 12 October 2015

Some emacs tips



I've finally bit the bullet and decided it's time to learn Emacs.
In the past, I've avoided learning this behemoth because of it's steep learning curve. Only thing, it's not that hard.

I should've attempted to learn it ages ago, but better late never. After using Emacs for a while, I'm starting to learn how powerful it is but still in the infancy of the learning curve and looking forward to becomming better at using it. One thing I've noticed is that it's far more capable than any text editor I've ever used, it's more like a complete OS.

So, on to some quick customizations..




Choosing a theme

I prefer a dark theme that is easy on the eyes and saves eyestrain. To do this, go to Options > Customize Emacs > Custom Themes and I use the "Deeper Blue" theme.

Be sure to click the "Save theme settings" so the changes are persistant.





Adding a repository

One of the first things I do is add the Melpa repositories to give it far more plug-ins. To do this, open Emacs and then your emacs config file:

ctrl x, ctrl f then open your ~/.emacs file.

We then need to copy the repository from Melpa into your .emacs config file.

To save the file, use ctrl x, crtl s

Then we restart Emacs for the changes to take effect.




Removing the toolbar

I'm not a fan of toolbars, I'd rather use shortcuts of get to the command via the menu, so I remove that. Here's how.

Go to Options > Show/Hide > Toolbar and select "None"

You can hide and un-hide other elements to your liking here also.

Buffer switching

Switching buffers in Emacs is a hassle to start off with, I'm still getting my head around different methods. But in the mean time, I've found a shortcut that emulates the way we do it in the normal world. You can use plain old ctrl tab to cycle forwards and ctrl shift tab to cycle backwards.
Simply add these two lines to your  ~/.emacs config

(global-set-key (kbd "C-<tab>") 'next-buffer)
(global-set-key (kbd "C-S-<tab>") 'previous-buffer)

I've found that it helps the transition to Emacs a bit easier than typing the buffers out in ctrl x, ctrl b


Line numbers

Displaying line numbers is, to me; essential in programming, to quickly find errors and focus where you need to look. For some reason, Emacs doesn't display this out of the box so heres how to get it going.


Open your ~/.emacs config file and add the following line to the bottom:

(global-linum-mode t)

(Dont forget that paste in Emacs is ctrl y)

And now we have line numbers along the left of the screen, brilliant.




Changing the default font and size

I find it hard to see at times and I'm always increasing the size of the fonts, maybe it's time for glasses.

So if you also need to adjust the default font and font size in Emacs, heres how...

Open M-x (the meta key is usually your alt key) and type customize

That will bring you to the custimization settings, grab yourself a beverage because there are loads of settings to be toggled off and on.

Whenever you do change something, always remember to click "State" and if you want it to be remembered, then
click "Save for future sessions"

Emacs measures font size in points, so play around till you find whatever suits you best.

I use Deja Vu Sans 135, works for me.
Another way to increase/decrease font size is ctrl x ctrl +/ctrl x, ctrl -



Other things
If you get confused withe the key bindings and Emacs groans at you, cancel the current command with ctrl g.


You can find an abundance of further tweaks by the shortcut meta x, customize.
I haven't got my head around all the options yet and I'm sure it'll take a long time to understand it fully.