Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Help:Text editor support
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==How to open articles in your text editor== ===Manual method=== A "manual" way of editing in an external [[GUI]] text editor is to use [[Cut,_copy_and_paste#Copy_and_paste|copy and paste]]. Some text editors do not support, or may not be set up to support, various [[#Dealing_with_special_characters|special characters]]—Chinese characters, non-Latin letters, mathematical symbols, and so on—they are typically replaced with a character that renders as a square. Check in a preview that your editor has not mangled any special characters before saving the edited page. A word processor may also be used, and may be less likely to mishandle special characters.<!--my personal experience: Notepad++ for Windows has mangled characters, LibreOffice Writer hasn't, for the same page. There is no problem with file format as we are not saving the word processor file. pol098--> # Open the Wikipedia edit window for the article or section as normally in browser (click the Edit tab of a page or section, or use the [[Keyboard_shortcuts|keyboard shortcut]] {{key press|Shift|Alt|E}}) # Select the entire content of the browser text area (as with {{key press|Ctrl|A}} or {{key press|Cmd|A}}), copy it (to the clipboard; {{key press|Ctrl|C}}), then paste ({{key press|Ctrl|V}}) it into an external editor window # Perform the editing and copy the text editor contents # Select the browser text area contents so that they are overwritten, then paste the edited text back # Preview and check the edited page before saving it. For some browser/editor software combinations, there are more efficient methods: === GhostText === [https://ghosttext.fregante.com/ GhostText] opens the text box from your browser in a supported external editor, and keeps the browser and external text in sync during editing. Currently supported browsers * Chrome * Firefox * Safari * Edge * Opera Currently supported editors * Sublime Text * VS Code * Atom * Vim * Neovim Note if you also use the VisualEditor, it is recommended to change GhostText's default keyboard shortcut (Ctrl/Cmd+Shift+K) since this clashes with the VisualEditor shortcut to add a citation. === Firefox === {{Update|section|reason=several of these add-ons are incompatible with recent (post-[[Quantum (Mozilla)|Quantum]]) versions of Firefox|date=February 2019}} If you are using the [[Mozilla]] web browser, it is possible to configure an external editor for editing text areas, including the Wikipedia edit area. This then avoids the need to copy and paste the article text between browser and editor. Several solutions exist: * '''[https://addons.mozilla.org/en-US/firefox/addon/its-all-text/?src=ss It's All Text!]''', supports nonblocking editing and UTF-8 encoding. '''Note:''' If you ''also'' want ''syntax highlighting'' in your edit box, this addon may be incompatible with the highlighting in {{myprefs|Beta features}}, but works with the highlighting in {{myprefs|Gadgets}}. (See below for highlighting ''within Vim''.) '''Note: Stopped working in Firefox 57+.''' * '''[http://www.vimperator.org/vimperator Vimperator]''' and '''[http://dactyl.sourceforge.net/pentadactyl/ Pentadactyl]''' have a shortcut in Insert mode that allows external text editing (the default is '''[[Control key|Ctrl]]+i'''). '''Note: Stopped working in Firefox 57+.''' * '''GhostText''', [[Help:Text editor support#GhostText|see above]] * '''[https://github.com/jlebon/textern textern]''' Another Firefox-Quantum-compatible replacement for ''It's all Text''. In addition to the [https://addons.mozilla.org/de/firefox/addon/textern/ addon], it requires installing a server separately. Only supports [[Linux]]. *'''MozEx.''' The [http://mozex.mozdev.org/ official package]{{dead}} does not support editing [[UTF-8]]-encoded documents and does not install properly in [[Mozilla Firefox]]. However, the [http://mozex.mozdev.org/development.html development version]{{dead}} does not have these problems. A quick [[Wikipedia:MozEx tutorial|MozEx tutorial]] is available. *'''[http://dafizilla.sourceforge.net/viewsourcewith/ ViewSourceWith]''' provides similar functionality vis-à-vis the text editing. * '''[http://lib.custis.ru/index.php/TextArea_Sputnik/en TextArea Sputnik]''', supports nonblocking editing and different encodings in an external editor. (You may see question marks in an edit textbox unrelated to the content you are editing (for example, the [[Unicode]] [[grapheme]] and other [[glyphs]] at the bottom), but your edits won't destroy the characters.) * '''[https://addons.mozilla.org/en-US/firefox/addon/withexeditor/ withExEditor]''' supports nonblocking editing in an external editor. As of this writing, it is common for other external editor plugins (It's All Text, ViewSourceWith) to not support multi-process (aka e10s) Firefox, whereas withExEditor does. With all these solutions, once you are done editing, you need to save in your editor, then click into the browser's text area and it is updated. You can then hit Preview. If you want to continue editing after the preview, hit Back in your browser, then work in your editor. Alternatively, you can hit Preview before you start editing for the first time, then work in your editor, save, preview, edit some more, save, preview etc., without the need for hitting Back in between. Certain Firefox forks such as [[Pale Moon (web browser)|Pale Moon]] and [[Waterfox]] support legacy add-ons. Starting with Firefox 57, all add-ons must be based on the WebExtensions API in order to run. ====Use It's All Text! to invoke an external editor==== {{outdated}} When the '''It's All Text!''' Firefox extension has been installed, a little blue edit button appears in the bottom right corner of the text area. Just click the button to open the contents of the text area in your editor. However, before you can use ''It's All Text!'', you need to specify the path to your editor in the Preferences dialog box. The Preferences dialog opens automatically when you use ''It's All Text!'' for the first time, but you can open it manually as follows: Right click in the text area to open context menu; select "It's All Text" → "Preferences". If your editor requires some other command line options in addition to the filename, use a shell script (.sh file in Linux and macOS, or .bat in Windows) to call your editor, and specify path to that script instead of calling your editor directly. In addition, you can add filename extension for wiki file type in Preferences dialog, in case your editor uses file type specific configuration. Once the above is done, you can edit any text area in your editor by clicking at the Edit button at the lower-right corner of the text area. Alternately, you can right-click on the text area. From the "It's All Text" menu, you can choose which filename extension to use for editing. Next time you use the blue edit button, the extension is the one you used last time. After editing, just save the file from your editor. The contents are automatically copied to the text area in Firefox. To indicate this, the text area turns yellow briefly. A temporary file is created for editing and is removed at the end. So if you want to preserve a text file for later editing, you can change the file name and/or save the file to another directory. =====Using Vim or another console editor===== Some macros may work in [[Vim_(text_editor)#Interface|Vim]], but not in [[Vim_(text_editor)#Interface|gVim]] for some reason (e.g., the macro to format text paragraphs). Or you just want to use Vim within an X terminal as you used to do, instead of using gVim. To invoke Vim within an X terminal window, you can write a shell script (see below) to invoke an X terminal and to run the <code>vim</code> command within that X terminal, or generally your preferred editor. Assume that the filename of this script is <code>wiki.edit.vim</code>, and that you put the script in the directory <code>/home_dir/bin/</code> so that the path of the script would be <code>/home_dir/bin/wiki.edit.vim</code> Put the above path in the Preferences box (instead of <code>/usr/bin/gvim</code>) of It's All Text. It should work. Note that <code>/home_dir/</code> is the complete path to your home directory from the root (<code>/</code>) directory; don't use <code>~/</code> (tilde) instead of <code>/home_dir/</code>; it won't work. The listing of the script <code>wiki.edit.vim</code> is given below: <syntaxhighlight lang="bash"> #!/bin/sh exec xterm -e ${VISUAL:=vim} "$@" </syntaxhighlight> Don't forget to make the file executable with <code>$ chmod +x wiki.edit.vim</code> =====Using Vim in macOS===== To get It's All Text to work nicely with Vim in the Mac, you need to install [http://code.google.com/p/macvim/ Macvim]. When MacVim is installed, a script called mvim is also added. You need to tell It's All Text to use this script and not the MacVim.app file. A good place to keep it is in the same folder your MacVim.app file is (Applications by default). === Lynx === [[Lynx (web browser)|Lynx]] allows editing text area content with an external editor. When the cursor is in the text area, one can type {{key press|Ctrl|X}} and {{key press|E}} — or {{key press|Ctrl|E}} and {{key press|E}} to invoke a text editor. In addition, Lynx accepts a user-definable key-binding (normally not bound) to invoke the external editor. Some packagers may assign a user-definable binding in Lynx's configuration file. ==== Do not wrap ==== After saving the file in an external editor, quitting it and returning to Lynx, answer "no" to the Lynx question "Wrap lines to fit displayed area? (n)" by pressing the {{key press|N}} key; answering "yes" will otherwise have Lynx wrap lines with normal carriage returns, which will break the document structure. Using article preview is strongly encouraged. ==== Line and paragraph breaking ==== Lynx built-in hard limits line length. In version 2.8.3, find this line in <code>LYGlobalDefs.h</code>: : #define MAX_LINE 1024 This can be modified to a longer length (e.g. 8192) and recompiled. If you are unable to recompile Lynx, the following are workaround suggestions. Lynx is prone to breaking lines longer than 1023 characters: When this happens, a large paragraph with lots of reference data may easily become broken, and articles saved like that may take at best a slightly inconsistent appearance; at worst, complex articles might lose their structure. The character length limit is dependent on maximum buffer length set for a line, the default size of which is 1023 characters; this behaviour can be observed when moving the cursor to a text area line exceeding the limit, whereby Lynx will issue an alert: "Form field value exceeds buffer length! Trim the tail." Even if a paragraph of article text on its face is not very long, it may still contain multiple references along with extensive amounts of related code and data for them, which makes an actual paragraph in article code much longer, and in some cases, well beyond the length of the 1023-character limit. When a line of text exceeds that limit and a text file is sent back to the Lynx textarea, Lynx will yield an error message: "Alert! Very long lines have been wrapped!". In such a case it's best not to save article content before such issues have been mitigated. Therefore, article editors should be careful to follow the character length of longer lines, and where (usually) possible, insert strategic linebreaks with carriage returns (not HTML <CODE><BR></CODE> tags): Advanced text editors, like vi or VIM, do typically show cursor position within a line in their status areas, and thus allow to gauge line length when the cursor is at the end of a line. In a longer paragraph of article code containing references, single linebreaks can be inserted within reference code, so long as parameter values themselves are not broken. *Some Wikipedia editors hold the practice of entering a linebreak before every reference parameter (as can be seen in examples of [[Wikipedia:Citation templates|Citation templates]]; Whether this is a good practice within text, is subject to debate); *Other editors choose not to interfere with a paragraph's visual consistency and enter a linebreak before a very long URL, one that is longer than the visual line in a terminal window, which is usually the length of 80 characters. If the situation in text necessitates, a linebreak can also be inserted before other parameters. Because URLs are typically long, placing these on a new line is handy for comparing article editions, as some textually non-breaking code prepended and/or appended to a URL may lie outside a comparison column's viewport, and this may hinder in discovery of changes made to an article. If a paragraph line is near the limit or exceeds it by just a few characters, then article editors can choose to optimize code or text: *By removing superfluous spaces: **the best practice with extensive template data (such as references) is to only separate the last character of a previous parameter value and the marker pipe of next parameter's name; **In plain text after a sentence-ending period, some article writers add two spaces instead of one, but browsers ignore this. *By refactoring template data into a shorter format: <CODE>date=26 February 2011</CODE> can be replaced with <CODE>date=2011-02-26</CODE> — Users with their own date preferences should then see dates in their favoured format when logged in; *By rewording a line without affecting the nature of the text within. *The above applies, even if a paragraph line does not contain breakable code. If a line paragraph still exceeds the 1023-character limit, but does not contain any reference code (or any other wikicode that would work with linebreaks), then users should consider logically breaking that paragraph into two for better legibility. ==== Encoding ==== If accented and international characters fail to show properly, use a terminal program that has support for Unicode (such as [[xterm|uxterm]]) and set the assumed and display character sets to UTF-8 or greater in Lynx options. Nevertheless, article content with any special characters — including non-standard Latin, Cyrillic, or other non-Latin languages — are seen in Lynx textareas in the UTF-8 <CODE>&#xXX;</CODE> format, which in that form are sent to text editors and then back. Beware that these UTF-8 glyph representations are not treated as one character, but as six (ö = <CODE>&#xF6;</CODE>), and these add to the 1023-character line limit. Such behaviour is a hindrance to editing non-Latin texts, and even Latin texts that are written in languages that may feature extensive amounts of accented characters.<BR> See [[#Dealing with special characters]] for more. ==== Lynx in Windows ==== In addition to above instructions, there are intricacies specific to Windows. If you want to use Wikimedia's secure servers, get a version of Lynx that supports SSL. To find out if yours already does, go to Options and see if the User-Agent header contains <CODE>OpenSSL</CODE>. The assumed character set should be <CODE>utf-8</CODE>, as this is also the default charset used by Wikipedia. The display character set can be different, such as <CODE>cp850</CODE>, but editable text will always be in <CODE>utf-8</CODE>. In Windows, the display font should be Lucida Console instead of 'Raster fonts', as Lucida Console supports a greater amount of characters. The display font can be changed in window properties: In Windows XP, click the Lynx window icon (to the left of the title), choose Properties, and switch to the Font tab, which typically lists only Raster fonts and Lucida Console. ===== Lynx configuration files ===== Configuration files for Lynx are simple text files and can be edited from any text editor that supports Unix linebreaks. In Windows 9x, the built-in text editor for this is [[WordPad]], because [[Windows Notepad|Notepad]] in these old Windows versions does not support the Unix Line Feed. '''<CODE>lynx.cfg</CODE>''' is the config file for Lynx; the global config file in Windows is always located in the same folder as the Lynx executable, wherever it has been installed to. A typical location is <CODE>C:\Program Files\Lynx</CODE>. If Lynx is installed in that folder, then Windows Vista and newer usually require administrator access to edit the file (via User Account Control). '''<CODE>lynx.rc</CODE>''' is a per-user Lynx User Defaults File saved from the Options page. Settings in it take priority over the global config file. In Windows Vista, the per-user User Defaults file can be in <CODE>C:\Users\''Username''\AppData\Local\temp\lynx.rc</CODE>. If the file is in the <CODE>temp</CODE> directory, care is advised when using automated cleanup tools like Disk Cleanup. Lynx Option file syntax is different between global (lynx.cfg) and per-user (lynx.rc) configuration files. <CODE>lynx.cfg</CODE> is extensive; very often, almost all options are placed into it, along with explanatory comments for each option. If it's not so, there's an official online version at [http://lynx.isc.org/lynx2.8.7/lynx2-8-7/lynx.cfg lynx.isc.org/lynx2.8.7/lynx2-8-7/lynx.cfg] — Keep in mind that if your Lynx version is different, change the numbers in the URL accordingly, as some options may be version-specific. The best way to find an option is by using the text editor's find feature. When not in active use, an option is commented out with a hash <CODE>#</CODE> and its default setting is on; To use an option, delete the hash character before it. The config file may occasionally not contain a specific option, but it can be added by the user. ===== Defaults to reconsider ===== The following options are often found as defaults in Lynx binaries compiled for Windows and might not meet formatting conventions used in Wikipedia. These options can be edited from <CODE>lynx.cfg</CODE> and are usually not specified in the Options page. Before editing, back up the file and rename it to <CODE>lynx.cfg.old</CODE>, for example. ====== Collapsed <NOWIKI><BR></NOWIKI> tags ====== The <CODE>COLLAPSE_BR_TAGS:</CODE> option should be set to <CODE>FALSE</CODE>, as in the example below: COLLAPSE_BR_TAGS:FALSE The reason is that some editors intentionally use more than one <CODE><NOWIKI><BR></NOWIKI></CODE> tag, especially in locations where conventional paragraph breaks are not allowed. ====== Justified text ====== Graphical browsers do not show this, since justification is not used. For this, set JUSTIFY:FALSE ====== Numbered links ====== As Wikipedia articles very often feature linked content in tables, the numbers in brackets before or next to links may be distracting. Set these following options: DEFAULT_KEYPAD_MODE:LINKS_ARE_NOT_NUMBERED NUMBER_LINKS_ON_LEFT:FALSE ====== Editing ====== The typical key combination to invoke an out-of-Lynx editor in Windows is Ctrl+x+e and not Ctrl+E+e like in Unices and elsewhere; this can be changed in the config file. Both an internal and external editor can be used, according to taste and preferences. Avoid Windows Notepad for reasons stated above. And only since Windows XP does WordPad have full Unicode support (with some reservations).<br> An example with Vim, configured to use the mediawiki syntax: SYSTEM_EDITOR:C:\Progra~1\Vim\vim73\vim.exe -c "setf mediawiki" Note the double quotes ^ ====== Colour issues ====== When using an in-window editor like Vim and after exiting back into Lynx, any colour theme Lynx uses is rendered inoperable (links and buttons not highlighted anymore), so the best practice is to never show colors in Options (in section Appearance), and save the settings. ===Other browsers=== ==== Conkeror ==== [[Conkeror]] can edit text boxes using an external editor by pressing {{key press|Ctrl|i}} on a focused text box. Details on setting up this feature can be found on the [http://conkeror.org/ExternalEditing External Editing] page from the Conkeror website. ==== dwb ==== [https://bitbucket.org/portix/dwb dwb] allows editing a text area with an external editor by typing {{key press|Ctrl|e}} when the cursor is in the text area. This key-binding can be changed on the <code>dwb:keys</code> page under the <code>open_editor</code> option, and the editor is defined on the <code>dwb:settings</code> page. ==== elinks ==== The text-only browser [[elinks]] also provides a function to edit text areas. The key combination {{key press|Ctrl|T}} calls an external editor, e.g. [[Vim (text editor)|Vim]]. This allows also to use syntax highlighting, edit functions, spelling corrections and saving local copies. ==== Luakit ==== [https://luakit.github.io/ Luakit] is able to edit text boxes using an external editor by pressing {{key press|Ctrl|e}} on the focused text box. <code>editor</code> and <code>open_editor</code> Lua modules powers the external editor functionality. User configuration is done by editing a <code>userconf.lua</code> file and key bindings are changed with the <code>add_binds</code> and <code>remove_binds</code> functions. ==== Nyxt ==== [https://nyxt.atlas.engineer/ Nyxt] is able to open an external editor on a current input field. The default keymap is <code>C-c '</code> when using CUA keybindings. The editor path can be changed by configuring the <code>external-editor-program</code> browser slot. The <code>edit-with-external-editor</code> command is used to open an editor. ==== qutebrowser ==== [[qutebrowser]] can open an external editor on a selected text area by typing {{key press|Ctrl|e}} or by using the <code>:open-editor</code> command. Settings can be changed using the <code>:set</code> command, with the editor defined in the <code>editor.command</code> section. The key-binding can be changed by using <code>config.bind()</code> in <code>config.py</code> or with the <code>:bind</code> command. ==== Vieb ==== [https://vieb.dev/ Vieb] can open an external editor on a focused input field by typing {{key press|Ctrl|i}} while in Insert mode. To change the mapping for the action, use the <code>imap</code> command on the <code>action.editWithVim</code> action. To change the editor, use the <code>set vimcommand=</code> command. ==== vimb ==== [https://fanglingsu.github.io/vimb/ vimb] is able to open an external editor on a hinted form area by typing <code>;e</code> or by pressing {{key press|Ctrl|t}} on a form field while in Input Mode. The editor is defined by changing the <code>:set editor-command</code> setting and changing the key mapping is done by using <code>:map</code> to change mappings. Note that there are various key mapping modes for mapping commands. ==== vimprobable ==== [https://sourceforge.net/p/vimprobable/wiki/Home/ vimprobable] can open text boxes in an external editor by typing {{key press|Ctrl|t}} while in Insert Mode. User configuration is done by editing a <code>vimprobablerc</code> file. To change the key binding, use the <code>map</code> command on the <code>openeditor</code> function. To define a different editor, use the <code>handler</code> command to change the <code>vimprobableedit</code> URI schema. ==== w3m ==== [[w3m]] opens an external editor for text areas by default. To change the external editor, press <code>o</code> to open the Options screen and change the Editor field. If the Editor field is left blank, w3m will use the <code>$EDITOR</code> environment variable. ==== webmacs ==== [https://github.com/parkouss/webmacs/ webmacs] can edit text fields using an external editor by pressing {{key press|Ctrl|x}} {{key press|e}} on a selected text field. Configuring the external editor is done by editing <code>__init__.py</code> found in the <code>~/.webmacs/init</code> directory and changing the <code>external-editor-command</code> variable. The <code>define_key()</code> and <code>undefine_key()</code> functions define and undefine a command to a keymap respectively. ==== xombrero ==== [[xombrero]] is able to edit a selected text element in an external editor by pressing {{key press|Ctrl|i}} while in Insert Mode or by entering the <code>:editelement</code> command. Settings can be changed by editing a <code>xombrero.conf</code> file. To change the key binding, create a <code>keybinding</code> entry for the <code>editelement</code> command. The editor is defined by creating an entry for the <code>external_editor</code> setting. ===Command-line tools=== Some [[command line interface|command line]] tools allow you to download articles, edit them using your favorite text editor, and upload the edited articles back into Wikipedia (or into any MediaWiki server). This bypasses the need for a web browser. These are (at least): * [http://search.cpan.org/~markj/WWW-Mediawiki-Client/bin/mvs mvs], a [[Perl]] program available from [[CPAN]]. [[Meta:WWW::Mediawiki::Client]] has more information. Unfortunately, mvs uses the name of the local file as the title of the page for the wiki remote server. If you need title pages in UTF-8 for Russian, Japanese or Arabic for example, you won't be able to upload such files. It seems that Mediawiki::Client as well as Perl libraries are not enough advanced in managing UTF-8 characters to be fully operational, even if your terminal and shell are correctly set for UTF-8. But see [http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=libwww-mediawiki-client-perl Debian bug reports]. * [[mw:Manual:Pywikibot]] is an extensive library and set of utilities for doing innumerable things with Wikipedia. It can also do something as simple as editing Wikipedia pages. It has some ways to avoid transmitting titles in UTF-8 wrongly, for example it allows to incorporate the name of the title ''within'' the file itself and to use another command line tool. The local filename could then be written in simple ASCII. Here is an example of a file, named locally 'foo.wiki', using pagefromfile.py (from [[mw:Manual:Pywikibot]]): <div style="height:auto; overflow:auto;"><pre> {{-start-}}'''Демография''', или наука о народонаселении, изучает численность, состав, размещение и движение населения. {{-stop-}} {{-start-}}'''人口学'''はヒトの人口の科学的研究をいい、主としてその大きさ、構造、そしてその成長発展を研究対象とする。 {{-stop-}} {{-start-}}'''Demography''' is the scientific study of human populations primarily with respect to their size, their structure and their development. {{-stop-}} {{-start-}}'''الديمغرافية''': علم يتناول دراسة المجتمعات البشرية من حيث حجومها و بناها و تطورها و خصائصها العامة و لا سيما من النواحي الكمية. {{-stop-}} </pre></div> In the above example, the command line to upload the four pages in one submission (the 'start' and 'stop' markups drive successively the four different pages Демография, 人口学, Demography and الديمغرافية) is: <pre> python pagefromfile.py -file:foo.wiki </pre> ===Former MediaWiki feature === For MediaWiki Version 1.5 through 1.21, the software allowed you to edit any resource using any external tool. See [[mw:Manual:External editors]] for details. This was removed in version 1.22.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)