Friday, November 26, 2010

Using markers in vi/vim

This feature is useful if for example we want to delete a few lines or characters but we are too lazy to count the lines or characters to use dd or dw command. We can set up to 26 marker using lowercase a-z as the marker's name. The main usage of marker is to mark any location in file.

How to use (we put 'a' as the marker's name):

ma - mark current cursor position as marker named 'a'
`a (backquote a) - move to character marked as 'a'
'a (quote a) - move to first non blank character (line) containing marker 'a'
`` (backquote backquote) - move to last operated marker or toggles with last cursor position, if no marker is set, cursor moves to beginning of file (BOF)
'' (quote quote) - move to beginning og line (BOL) operated marker or toggles with BOL of last cursor position, if no marker is set, cursor moves to BOF

Example on using marker:

If you want to indent 5 lines starting from current line: majjjjj>'a
If you want to delete five words using marker: mawwwwwmb`ad`b

That's all friends :)

Saturday, November 13, 2010

Edit main menu in fedora

Starting from fedora 12, I found out that I cannot edit my main menu anymore. This is kind of frustrating since I installed many custom applications, and I would like it to be easily accessible from the main menu. After searching around, i found out that one package is not included in fedora 12 livecd. The package is called alacarte.

$ rpm -qi alacarte
Name : alacarte Relocations: (not relocatable)
Version : 0.12.4 Vendor: Fedora Project
Release : 1.fc12 Build Date: Tue 22 Sep 2009 08:41:26 AM MYT
Install Date: Sat 13 Nov 2010 07:17:32 AM MYT Build Host: xenbuilder4.fedora.phx.redhat.com
Group : Applications/System Source RPM: alacarte-0.12.4-1.fc12.src.rpm
Size : 367423 License: LGPLv2+
Signature : RSA/8, Thu 01 Oct 2009 03:42:28 AM MYT, Key ID 9d1cc34857bbccba
Packager : Fedora Project
URL : http://www.gnome.org
Summary : Menu editor for the GNOME desktop
Description :
Alacarte is a graphical menu editor that lets you edit, add, and delete
menu entries. It follows the freedesktop.org menu specification and
should work with any desktop environment that uses this specification.

So, just install the alacarte package using yum, and select "System -> Preferences -> Main Menu", and you can now edit your main menu.
# yum install alacarte -y
That's all folks