Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Recently I was able to increase the left margin between code and line numbers in Gedit (Gnome-text-editor) in Ubuntu 12.10. I don't recall how I achieved this, neither do I recall how Gedit reverted to the classical margin which is very tight for me. See screenshot:

Gedit Does anyone know how I can increase left margin in Gedit 3.6.1? Thanks

share|improve this question
    
If you don't know how you increased the margin before, maybe it was because you had enough lines to make the longer line numbers require more space. Then the smaller line numbers will use the extra space as a margin. I do not know of any other way. –  Zilvador Dec 11 '12 at 22:11
    
No. I remember that it was an option somewhere to increase and decrease the margin between line_numbers and code. –  Hanynowsky Dec 11 '12 at 22:25
add comment

1 Answer

up vote 2 down vote accepted

The request for more space between line numbers and content has sometimes been voiced on the mailing-lists before, and here is a summary of my investigation of the current situation.


We can find any additional gedit settings by entering in terminal

gsettings list-recursively | grep -i gedit

and then we can narrow it down a bit further by entering

gsettings list-recursively | grep -i gedit | grep -i margin

which returns the margin entries and your current settings:

org.gnome.gedit.preferences.editor display-right-margin true
org.gnome.gedit.preferences.editor right-margin-position uint32 2

But these are right margin settings, and are just the same as the gui settings menu; there also doesn't seem to be any appropriate possibilities in the rest of the settings or any plugins that would be useful for you.

It is important to note that gedit uses gtksourceview, and, when examined, the feature set from that library will be familiar to gedit users. There is, however, no mention in the specifications of the left margin or a way to specify a separation between line numbers and the entries in your gedit document.

However, I think you could do what you want by patching the gtksourceview library, and patching gedit. After looking at the gtksourceview specifications I think you would need to patch the gtksourcegutter settings; in the documentation it is noted that

The GtkSourceGutter object represents the left and right gutters of the text view. It is used by GtkSourceView to draw the line numbers and category marks that might be present on a line. By packing additional GtkSourceGutterRenderer objects in the gutter, you can extend the gutter with your own custom drawings.

There is a discussion on the gutter in the mailing-lists, although not with specific reference to your question, but with regard to possible customisations.


You may have thought you had enabled space between line numbers and entries in your document by carrying out the process shown in the screenshot below.

You create a new file with gedit, go to edit > preferences > view and enable the right margin and set it to 2, for example. Then you place the cursor on the margin, type something, press return, and then save the file. Then when the file is reloaded the space between the numbers and the content stays until you go beyond the margin.

This has happened to me a few times, and is confusing, but is not a reliable way of doing what you want. As there are no official settings available the only way to do what you want would be to patch gtksourceview and gedit.

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.