From 70a488878f97eeec09356054fc161b9f8e914257 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 24 Jul 2011 00:25:29 +0300 Subject: Change EDITOR_LINENUMBER_SWITCH to an environment variable Also change "switch" to "arg" because "switch" is a bit of a sloppy term. So the environment variable is called PSQL_EDITOR_LINENUMBER_ARG. Set "+" as hardcoded default value on Unix (since "vi" is the hardcoded default editor), so many users won't have to configure this at all. Move the documentation around a bit to centralize the editor configuration under environment variables, rather than repeating bits of it under every backslash command that invokes an editor. --- doc/src/sgml/ref/psql-ref.sgml | 103 +++++++++++++++++++++++------------------ doc/src/sgml/release-9.1.sgml | 2 +- 2 files changed, 59 insertions(+), 46 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 132a7b354b6..0b044a5db35 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1440,25 +1440,21 @@ testdb=> \r to cancel. - - psql checks the environment - variables PSQL_EDITOR, EDITOR, and - VISUAL (in that order) for an editor to use. If - all of them are unset, vi is used on Unix - systems, notepad.exe on Windows systems. + If a line number is specified, psql will + position the cursor on the specified line of the file or query buffer. + Note that if a single all-digits argument is given, + psql assumes it is a line number, + not a file name. - + - If a line number is specified, psql will - position the cursor on the specified line of the file or query buffer. - This feature requires the EDITOR_LINENUMBER_SWITCH - variable to be set, so that psql knows how - to specify the line number to the editor. Note that if a single - all-digits argument is given, psql assumes - it is a line number not a file name. + See under for how to configure and + customize your editor. + @@ -1514,13 +1510,18 @@ Tue Oct 26 21:40:57 CEST 1999 If a line number is specified, psql will - position the cursor on the specified line of the function body - (note that the function body typically does not begin on the - first line of the file). - This feature requires the EDITOR_LINENUMBER_SWITCH - variable to be set, so that psql knows how - to specify the line number to the editor. + position the cursor on the specified line of the function body. + (Note that the function body typically does not begin on the first + line of the file.) + + + + + See under for how to configure and + customize your editor. + @@ -2583,27 +2584,6 @@ bar - - EDITOR_LINENUMBER_SWITCH - - - When \edit or \ef is used with a - line number argument, this variable specifies the command-line switch - used to pass the line number to the user's editor. For editors such - as emacs or vi, you can simply set - this variable to a plus sign. Include a trailing space in the value - of the variable if there needs to be space between the switch name and - the line number. - Examples: - - -\set EDITOR_LINENUMBER_SWITCH + -\set EDITOR_LINENUMBER_SWITCH '--line ' - - - - - ENCODING @@ -3152,8 +3132,8 @@ $endif - - Environment + + Environment @@ -3203,8 +3183,41 @@ $endif - Editor used by the \e command. The variables - are examined in the order listed; the first that is set is used. + Editor used by the \e and + \ef commands. The variables are examined in + the order listed; the first that is set is used. + + + + The built-in default editors are vi on Unix + systems and notepad.exe on Windows systems. + + + + + + PSQL_EDITOR_LINENUMBER_ARG + + + + When \e or \ef is used + with a line number argument, this variable specifies the + command-line argument used to pass the starting line number to + the user's editor. For editors such as Emacs or + vi, this is a plus sign. Include a trailing + space in the value of the variable if there needs to be space + between the option name and the line number. Examples: + +PSQL_EDITOR_LINENUMBER_ARG='+' +PSQL_EDITOR_LINENUMBER_ARG='--line ' + + + + + The default is + on Unix systems + (corresponding to the default editor vi, + and useful for many other common editors); but there is no + default on Windows systems. diff --git a/doc/src/sgml/release-9.1.sgml b/doc/src/sgml/release-9.1.sgml index a4f8e2459fc..6c812cb6c47 100644 --- a/doc/src/sgml/release-9.1.sgml +++ b/doc/src/sgml/release-9.1.sgml @@ -1994,7 +1994,7 @@ This is passed to the editor according to the - EDITOR_LINENUMBER_SWITCH psql variable. + PSQL_EDITOR_LINENUMBER_ARG environment variable. -- cgit v1.2.3