Help - Search - Members - Calendar
Full Version: Help With Nedit [solved]
OESF Forums > Distros, Development, and Model Specific Forums > Distro Support and Discussion > pdaXrom
zi99y
Hi all,

I've been trying for ages to get Nedit working, it runs so fast and looks perfect for what I want - but I can't use it because the arrow keys do not work correctly - left and right moves the cursor to the start or end of the line (like home and end), so I am unable to navigate properly.

I've searched and searched and can find no answers, any ideas on this would make me very grateful.

ta

zi99y
zi99y
Ok I searched a bit more (!) and found a way of mapping the keys with macros, if anyone has this problem, you can paste the following section into your ~/.nedit/nedit.rc file

CODE
    left:Left::: {\n\
 backward_character()\n\
    }\n\
    right:Right::: {\n\
 forward_character()\n\
    }\n\
    page down:Mod2+Down::: {\n\
 next_page()\n\
    }\n\
    page up:Mod2+Up::: {\n\
 previous_page()\n\
    }\n\
    select right:Shift+Right::: {\n\
 key_select("right")\n\
    }\n\
    select left:Shift+Left::: {\n\
 key_select("left")\n\
    }\n


Put this at the end of the nedit.macroCommands section.

Alternatively you can add the macros through the menu (Preferences > Default Settings > Customize Menus > Macro Menu) and use the actions from this page: http://webdocs.math.univ-rennes1.fr/NEdit/...on_Routines.htm
daniel3000
Well, I have just installed teh nedit 5.5 IPK from the other thread you probably also have read.
Same problem, cursor keys don't move just one character.

However, I don't have an .nedit/nedit.rc file, so I created a new one, with the contents

CODE
[nedit.macroCommands]

left:Left::: {\n\
backward_character()\n\
}\n\
right:Right::: {\n\
forward_character()\n\
}\n\
page down:Mod2+Down::: {\n\
next_page()\n\
}\n\
page up:Mod2+Up::: {\n\
previous_page()\n\
}\n\
select right:Shift+Right::: {\n\
key_select("right")\n\
}\n\
select left:Shift+Left::: {\n\
key_select("left")\n\
}\n


However, this does not work. Cursor keys behave as before.
What did I do wrong?
How does your nedit.rc look?

Thanks
daniel
zi99y
Ok delete the file you just created, go into nedit and click on preferences > save defaults, this will create the file for you, now go in and make the changes above.

I forgot to mention, this will also fix keys for selecting while holding shift, and page up & page down.

Let me know if you can't get it working, Nedit is really good and fast and I've imported a PHP syntax highlighting file so it now does everything I want smile.gif
daniel3000
Okay, now I got it. Thanks!
nedit needs some tweaking though.

Bigger font size - done.

Change color for marked text - done.

Is it possible to change the fonts for the menus?

In the nedit maillist archives, I could find a macro mentioned which inserts a time and date stamp: "execute_command(date -u +'%%Y%%m%%d:%%H:%%M:%%S: ')". However, if I try this, nedit tries to execute the command with csh, which I don't have installed. Is there a way to let nedit use bash or sh instead?


The Del key (Fn-Backspace) acts like backspace.
I found this FAQ:
http://www.nedit.org/faq/sect_customization.php#N277
But the solution doesn't help here. In fact, there is no ~/.Xdefaults file and I could not find one in another location. Creating it with the parameter given at above URL does not help.

daniel
danr
QUOTE(daniel3000 @ Sep 13 2006, 09:43 AM)
In the nedit maillist archives, I could find a macro mentioned which  inserts a time and date stamp: "execute_command(date -u +'%%Y%%m%%d:%%H:%%M:%%S: ')". However, if I try this, nedit tries to execute the command with csh, which I don't have installed. Is there a way to let nedit use bash or sh instead?

...
But the solution doesn't help here. In fact, there is no ~/.Xdefaults file and I could not find one in another location. Creating it with the parameter given at above URL does not help.


Instead of .Xdefaults, edit .Xresources (which is very similar), and add the following:

CODE
nedit*shell: /bin/bash


I have the following in my nedit.rc file to enter a date in my diary file as "-- <dayname> <day>/<month>/<year>":

CODE
       Date:Alt+D::: {\n\_main()\n\                                            
               d="-- " shell_command("date +\\"%a %d/%m/%y\\"", "") "\\n"\n\  
               insert_string(substring(d, 0, length(d)-1))\n\
       }\n  


Not sure how to change the menu font size. Any ideas anyone?

Dan
daniel3000
QUOTE(danr @ Sep 13 2006, 12:19 PM)
Instead of .Xdefaults, edit .Xresources (which is very similar), and add the following:

CODE
nedit*shell: /bin/bash


There must be something I don't understand yet...
so I created a ~/.Xresources file (it didn't exist yet) and added the line you gave.
After restarting X,when I try to issue a shell command, it still says "Error starting shell: /bin/csh".
I found an existing filr /etc/X11/xdm/Xresources and appended your line to the end if that one. Same result.

What am I doing wrong?

I could work around this problem with an ln -s /bin/bash /bin/csh but that is certainly not such an elegant solution...

QUOTE
I have the following in my nedit.rc file to enter a date in my diary file as "-- <dayname> <day>/<month>/<year>":

CODE

       Date:Alt+D::: {\n\_main()\n\                                            
               d="-- " shell_command("date +\\"%a %d/%m/%y\\"", "") "\\n"\n\  
               insert_string(substring(d, 0, length(d)-1))\n\
       }\n  


strange... here nedit says on startup:

CODE
Nedit: syntax error in macro menu item:
{
_m<==


Any ideas?
And why not strip that macro down to just something like
CODE

      Date:Alt+D::: {\n\                                            
               shell_command("date +\\"%a %d/%m/%y\\"", ")\n\  
       }\n


Thanks a lot
daniel
zi99y
I found a similar page referring to .Xdefaults or .Xresources (which I don't have either), and could not get it working. I get the same error looking for /bin/csh.

Can you tell me how you changed color for marked text - I can't find that option and the light grey is very hard to see.

Ta
daniel3000
QUOTE(zi99y @ Sep 13 2006, 08:06 PM)
I found a similar page referring to .Xdefaults or .Xresources (which I don't have either), and could not get it working. I get the same error looking for /bin/csh.

Can you tell me how you changed color for marked text - I can't find that option and the light grey is very hard to see.

Ta
*


Sure:
Preferences -> Default Settings -> Colors:
I changed "Selection background" from cc/cc/cc (I believe) to 88/88/88.
Much darker grey :-)

daniel
danr
QUOTE(daniel3000 @ Sep 13 2006, 12:59 PM)
After restarting X,when I try to issue a shell command, it still says "Error starting shell: /bin/csh".
I found an existing filr /etc/X11/xdm/Xresources and appended your line to the end if that one. Same result.

What am I doing wrong?


I don't know - perhaps look on the nedit wiki for suggestions?

QUOTE
strange... here nedit says on startup:

CODE
Nedit: syntax error in macro menu item:
{
_m<==


Any ideas?
And why not strip that macro down to just something like
CODE

      Date:Alt+D::: {\n\                                            
               shell_command("date +\\"%a %d/%m/%y\\"", ")\n\  
       }\n


In my previous message I took the code from my nedit.rc file, so maybe it didn't paste correctly in the web browser. However, I like to have '-- ' prepended to the date so as to show up as a comment, so you won't need that bit. Anyway, I found this date macro on this nedit macro page, so have a play around with the date macro to get it to do what you want it to do.

Dan
daniel3000
Hi Dan,

well, the macros page doesn't mention that _main() function for "insert date" macro. However, if I omit it, it works!

Thanks for the info.

What I have added to my nedit.rc loos that way:

CODE
      Date:Alt+D::: {\n\                                            
              d="-- " shell_command("date +\\"%d.%m.%Y (%a)\\"", "") "\\n"\n\  
              insert_string(substring(d, 0, length(d)-1))\n\
      }\n  


which makes nedit write a time stamp at the current cursor position if I hit Alt-D of the format

CODE
-- 14.09.2006 (Thu)



nice!

The issue with the shell is "solved" by an ln -s /bin/bash /bin/csh. No problems so far. If anyone knows how to do it on pdaXrom on a nicer way, please let me know!

daniel
daniel3000
Nedit is now my main editor.
However, two problems remain:

1. How can I start nedit in maximized-window mode? On startup, the window is larger than the screen, making it difficult to work. Ctrl-Alt-M helps, but I'd like to avoid having to press this key combo each time I start up nedit.

2. the font selection does not show the fonts I need (Bitstream Vera fonts would be nice for example - they are installed on my system).
I have set it to the "fixed" font set with size 20, but these fonts do not have the German Umlauts.
I am not so familiar with all that font stuff, so please could someone give advice why I cannot select ehe Vera fonts and maybe how I can make these available to nedit?

Thanks a lot!
daniel
Drake01
QUOTE(daniel3000 @ Oct 4 2006, 03:34 PM)
1. How can I start nedit in maximized-window mode? On startup, the window is larger than the screen, making it difficult to work. Ctrl-Alt-M helps, but I'd like to avoid having to press this key combo each time I start up nedit.
*


I'm using nedit as my primary editor on my desktop. There's a command-line option for setting initial window geometry. I'm assuming that this will work for the Zaurus version, as well.

-geometry geometry (or -g geometry)
The initial size and/or location of editor windows. The argument geometry has the form:

[<width>x<height>][+|-][<xoffset>[+|-]<yoffset>]

where <width> and <height> are the desired width and height of the window, and <xoffset> and <yoffset> are the distance from the edge of the screen to the window, + for top or left, - for bottom or right. -geometry can be specified for individual files on the command line.


BTW, how long does nedit take to load on the Z? If it's fairly snappy, I may switch from Leafpad. For most tasks, however, I would be frustrated if there's a significant lag in opening.
daniel3000
QUOTE(Drake01 @ Oct 5 2006, 03:46 AM)
I'm using nedit as my primary editor on my desktop.  There's a command-line option for setting initial window geometry.  I'm assuming that this will work for the Zaurus version, as well.

[font=Courier]-geometry geometry (or -g geometry)
The initial size and/or location of editor windows.  The argument geometry has the form:

  [<width>x<height>][+|-][<xoffset>[+|-]<yoffset>]


thanks, I could now make nedit start up in an almost full-screen window using
CODE
alias n="nedit -g 61x17+0+0"

(the values for x and y are not pixels but characters!)

QUOTE
BTW, how long does nedit take to load on the Z?  If it's fairly snappy, I may switch from Leafpad.  For most tasks, however, I would be frustrated if there's a significant lag in opening.
*


Here it takes about 10 seconds to load, so it is not as snappy as leafpad. But once it is loaded it is reasonably fast and well usable (after creating some macros to maike the cursor keys work as expected, see above).


Regarding the Umlauts:
I was wrong. The used font HAS the umlauts They are shown corectly when I load ISO-8859-1 coded files with nedit. But when pressing the key codes for Umlauts (Fn-a, Fn-o etc. on my system, works in Console and most other apps), no Umlauts are generated in nedit but rather two-byte character combinations. Looks a bit like a unicode problem, such as the keys generating unicode (two-byte) characters which nedit cannot display.
The Umlauts which are shown correctly are indeed no unicode Umlauts but ISO-8859-1 coding.

Any idea how I can make the keys work correctly in nedit? Possibly also using macros...

daniel
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.