Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://jet.sao.ru/hq/sts/linux/doc/nedit/faq/sect_customization.shtml
Дата изменения: Unknown Дата индексирования: Tue Oct 2 10:21:06 2012 Кодировка: Поисковые слова: п п р п п р п п р п п р п п р п п р п п р п п р п р п п р п р п п р п р п п р п р п п р п р п п р п р п п р п р п п р п р п п р п |
ispell
with NEdit instead of the less
capable Unix spell
command?
1. I can't get the delete key to remap to a forward delete. I have re-bound it in my .Xdefaults file, and that doesn't help.
In your .Xdefaults file, add:
nedit.remapDeleteKey: False
This is now the default, so you likely have an old resource file sitting around somewhere with this setting. When remapDeleteKey is True), NEdit forcibly maps the delete to backspace. This can be used when the X server and the client machine have different expectations about whether the key in the backspace position on the keyboard is a backspace key or a delete key. It also saves users in very heterogeneous environments from having to re-map keys on nearly every system they use just to be able to backspace.
It's harder to explain how to specify X resources than you might expect, since how they are set is often configured by your local system manager. They are either automatically attached to the server (your screen) by an X startup or login script, or they are left unspecified, and read from the .Xdefaults file whenever you run an X application. If they are attached to the server, you should find out the "normal" method for setting them on your system. If it's not the .Xdefaults file, then it is usually a file called .Xresources (also in your home directory). To make a change, you have to either run xrdb, or re-invoke the startup script that originally attached them, usually by exiting and re-starting X, or logging out and back in to your X session.
Since setting resources is tricky, it's usually better to start with something simple, like:
nedit*foreground:green
Then, once you have that working, try the more subtle or difficult ones.
You can also use the appres command to find out what resources nedit
actually sees (appres NEdit nedit
).
The .nedit file holds the NEdit Preferences menu options and is automatically overwritten whenever you select "Save Defaults". You really shouldn't put X resource settings there. Also, as you may have discovered, resources other than Preferences resources don't always work from there.
How you set X resources depends on local system conventions. You usually put them in the .Xdefaults or .Xresources file in your home directory. You may also need to run xrdb to install them in the server. It depends on how your local system has been configured, so it's best to talk to the person who configured your system. If you're not sure whether your resources are set up correctly, the command:
appres NEdit nedit
will tell you what settings NEdit will see when it runs.
4. If I install an "app-defaults" file for NEdit (empty too), all default shortcuts are reset (only "Alt+B" and "Alt+Z" works). Without that file all works fine. Now, how can I customize nedit with this problem ? Or, how can I get a copy of all default shortcuts to add on my NEdit "app-defaults" file ?
NEdit uses the X fallback resources mechanism to provide default values for user-settable resources. When you provide a system-wide app- defaults file, it overrides the entire contents of the fallback resources, meaning all of the program defaults are lost, except for those which are also represented in the app-defaults file. To use an app-defaults file, therefore, you need to start from a complete one which provides all of the necessary default values. There is a complete app-defaults file in:
We strongly discourage users from using system-wide app-defaults because once you install the file, you have to keep it up to date with every new release of the software. If you don't update it, users might not even notice the difference, but things will be increasingly wrong with each new release.
The way X is designed, there are a LOT of user settable resources in NEdit, most of them quite useless. You can see them all using the editres tool, which is available on most Unix systems. A more useful subset are the application default resources, which you can look at either in the source code (near the beginning of nedit.c, in the variable called fallbackResources) or in the app-defaults file in:
ispell
with NEdit instead of the less
capable Unix spell
command?
ispell
is actually the default spell checker for NEdit on Linux systems where
spell
is not available. On other systems, enter the following in the Shell
Commands dialog:
Command Input: Either Command Output: Same Window Output Replaces Input: ON Shell Command: cat>spellTmp; xterm -e ispell -x spellTmp; cat spellTmp; rm spellTmp
If you want to get fancy, the following puts the temporary file in the /tmp directory, and uses $$ (the process ID of the shell) in the file name so you don't have to worry about clashes between simultaneous ispell sessions:
cat > /tmp/ispell.$$; xterm -title "Spell Check" -e ispell -S /tmp/ispell.$$; cat /tmp/ispell.$$; rm /tmp/ispell.$$
7. How can the display of hidden (eg .login) files in dialog boxes be suppressed? We use nedit with for teaching programming with very naive and inexperienced students. The display of these in dialogs such as the "Save as..." one encourages them to screw up important login stuff, state files etc.
It depends on the system you are running how easy this is to do. Under Motif 2.0, which I think is still only found on Linux and Free-BSD systems, it's a simple resource setting:
nedit*XmFileSelectionBox.fileFilterStyle: FILTER_HIDDEN_FILES
On other systems, unfortunately, it's a rather difficult source code change, involving creating a replacement file searching procedure to be spliced in to the file selection box widget.
8. Most Motif applications allow you to type in the file name in a separate text field (as in the 'open file' dialog). Why doesn't NEdit? Can I make it do that?
Set the X resource nedit.stdOpenDialog to True. The field is disabled by default to get new users accustomed to typing the file name directly in to the list widget, which is not standard Motif behavior.
9. I would like to change NEdit's cursor from a bar to a block. I seem to lose it sometimes in my text.
The block cursor in NEdit is used to indicate overstrike mode, but you can turn on a resource to make the cursor thicker:
nedit*text.heavyCursor: true
The only way to get a permanent block cursor, though is to hack the source code. This shouldn't be too difficult, since the code for drawing a block cursor is already there.
10. I'd like to see more than 8 files in the file selection dialogs (Open, Save As, Include, etc.). I've tried to set the X-resources like nedit*XmList.visibleItemCount: 20, but this did not work.
The only effective way I've found to control the number of items in the highly temperamental Motif FileSelectionBox widget is through the height resource:
nedit*FileSelect.height: 900
The X resource line above will make the file selection box 900 pixels tall.
11. I am trying to do key bindings such that, for example, Find is Alt+F rather than Ctrl+F. However, this clashes with the find menu mnemonic. I realize that the menu mnemonics can be changed to any letter, but they are always bound to Alt-letter. I would like to just remove all menu mneumonics. Is there any way to do this in an .Xdefaults file?
You can turn mnemonics off by setting them to the ascii null character, for example:
nedit*fileMenu.mnemonic: \0
12. I have a PC-style 2-button mouse. Can I switch the 2nd and 3rd mouse buttons so the more important functions like secondary selection are on the right button instead of the middle (which is emulated by pressing 1+3 buttons simultaneously under Linux), like they were in version 4?
It's somewhat involved and hard to figure out from the documentation, but yes you can. You have to reverse the translation table bindings for mouse buttons 2 and 3, AND reset the bgMenuButton resource. The translation table bindings can either be found in the source file source/text.c, or by adding and activating a temporary translation to the text widget for dumping the translation table itself (XtDisplayTranslations()).
What it boils down to, though, is just add the following lines to your X resource file (.Xdefaults or .Xresources depending on your system):
NEdit*text.Translations: #override \n\ <Btn3Down>: secondary_or_drag_start()\n\ Shift Ctrl Button3<MotionNotify>: \ secondary_or_drag_adjust("rect", "copy", "overlay")\n\ Shift Button3<MotionNotify>: secondary_or_drag_adjust("copy")\n\ Ctrl Button3<MotionNotify>: secondary_or_drag_adjust("rect", "overlay")\n\ Button3<MotionNotify>: secondary_or_drag_adjust()\n\ Shift Ctrl<Btn3Up>: move_to_or_end_drag("copy", "overlay")\n\ Shift <Btn3Up>: move_to_or_end_drag("copy")\n\ Alt<Btn3Up>: exchange()\n\ Meta<Btn3Up>: exchange()\n\ Ctrl<Btn3Up>: copy_to_or_end_drag("overlay")\n\ <Btn3Up>: copy_to_or_end_drag()\n\ Ctrl~Meta~Alt<Btn2Down>: mouse_pan()\n\ Ctrl~Meta~Alt Button2<MotionNotify>: mouse_pan()\n\ <Btn2Up>: end_drag() nedit.bgMenuButton: ~Shift~Ctrl~Meta~Alt<Btn2Down>
13. I'd like to send mail directly from my nedit window, but there's no good way to make a shell command prompt me for input (for entering the recipient and subject).
Use a macro command instead to do the prompting:
to = string_dialog("Send mail to: (enter name below, along with any\n" \ "additional Unix Mail command parameters, -s for subject)", \ "Send", "Cancel") if ($string_dialog_button == 2 || $string_dialog_button == 0) return if ($selection_start == -1) body = get_range(0, $text_length) else body = get_selection() cmdOutput = shell_command("Mail " to, body) if ($shell_cmd_status != 0) dialog("mail command returned failed exit status\n" cmdOutput) else if (cmdOutput != "") dialog(cmdOutput)
14. How I can set the foreground color for selected text to be always say grey1 even when syntax highlighting is applied?
There's no equivalent to the nedit*text.selectForeground resource when you turn on syntax highlighting. You just have to choose a selection color that is compatible with all of your highlighting colors.