Archive

Posts Tagged ‘editor’

Change The Default Editor

September 9th, 2009 2 comments

If you spend any amount of time in a terminal you very likely end up needing to use a text editor. Text editors can be very powerful tools, and therein introduces the age-old editor wars. Vim vs Emacs, etc. No matter what your preferred editor is, it helps if it is the default. It is always a pain to be presented with an editor you’re not used to when trying to configure your system. This short article will outline how to change the default editor for your system, ensuring you’re always presented with your preference.

Alternatives

Linux provides a system tool called alternatives, which allows us to have multiple tools installed that each provide the same functionality. Using this tool we can tell the system which one we would like to use as the default, leaving the others available but not primary. To use the alternatives tool to change your default editor, use the command:

sudo update-alternatives –-config editor

You should be presented with a menu similar to this:


There are 4 alternatives which provide `editor'.
Selection    Alternative
-----------------------------------------------
1    /usr/bin/vim.tiny
2    /bin/ed
3    /bin/nano
*+        4    /usr/bin/vim.gnome
Press enter to keep the default[*], or type selection number:

Your options may vary depending on which editors you have installed. No matter what your options are, simply select the number you would like to use and your default editor is updated.

To test these new changes use a command that will call the default editor such as visudo or crontab -e.

Categories: Linux Tags: ,

How To Make The Best Of Ubuntu Text Editor (gedit)

March 7th, 2007 13 comments

I have been using Text Editor (gedit) for quite some time to take simple notes and write basic documents. Sometimes I’ll write a blog post in Text Editor to save for later, or when I’m actually able to get online. Today, however, I found that Text Editor has some great features that I was never aware of. I may even come out of my hermit-like use of vim and use this as a replacement.

/me ducks and hides from the barrage of vim lovers.

At first glance Text Editor (Applications > Accessories > Text Editor) looks like a basic text editor. Nothing fancy, nothing out of the ordinary. Some of the base features that are lacking in other editors (or have been lacking) are:

  • Tabs and Tab re-ordering
  • Spell Check
  • Document Stats (number of words, characters, etc)

Some of the awesome features that I wasn’t previously aware of however are outlined below. I hope I’m not the only person that has been in the dark about these or else I’m going to feel like quite the idiot. In any event, to find some of the cooler features you can navigate to Edit > Preferences.

The first tab you’ll see is the View tab. The default settings here are:

  • Enable Text Wrapping
  • Do not split words over two lines

The other options, and I think these would be really useful if you’re working with code are listed below. I now have activated these options:

  • Display line numbers
  • Highlight current line
  • Highlight matching bracket

It is always nice to know the line numbers within your file, particularly if you’re doing any kind of coding. Errors come up in code even for the best of us and finding the guilty line number is the key. Displaying or highlighting the current line is nice, for me, to know where my cursor is. After hours of staring at text and code some days things can become a bit of a blur. Also,highlighting matching brackets sure is nice to make sure you’ve closed that last div or ended that if statement.

The next thing that I’m really excited about is the Syntax Highlighting tab. This is on by default but you can define the language that you’d like it to specifically highlight. I saw just about everything in this list from Ada to XML. Perfect for when I’m working on PHP or perl (which I’ve just decided to try and learn).

Tomorrow I’ll outline one more of the features that really bring this editor above the rest. Enjoy the editor you never knew you had… and great work to the dev team for gedit. This is far more than I expected in a tiny, lightweight package.

Categories: GNOME Tags: , ,