Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
\section commandline commandline - set or get the current command line buffer
2005-09-20 13:31:55 +00:00
\subsection commandline-synopsis Synopsis
2014-08-01 12:25:41 +00:00
\fish{synopsis}
2014-08-01 02:37:32 +00:00
commandline [OPTIONS] [CMD]
\endfish
2005-09-20 13:31:55 +00:00
\subsection commandline-description Description
2014-08-19 12:41:23 +00:00
`commandline` can be used to set or get the current contents of the command line buffer.
2005-09-20 13:31:55 +00:00
2014-08-19 12:41:23 +00:00
With no parameters, `commandline` returns the current value of the command line.
2005-09-20 13:31:55 +00:00
2014-08-19 12:41:23 +00:00
With `CMD` specified, the command line buffer is erased and replaced with the contents of `CMD`.
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
The following options are available:
2006-10-04 21:39:48 +00:00
2014-08-19 12:41:23 +00:00
- `-C` or `--cursor` set or get the current cursor position, not the contents of the buffer. If no argument is given, the current cursor position is printed, otherwise the argument is interpreted as the new cursor position.
- `-f` or `--function` inject readline functions into the reader. This option cannot be combined with any other option. It will cause any additional arguments to be interpreted as readline functions, and these functions will be injected into the reader, so that they will be returned to the reader before any additional actual key presses are read.
The following options change the way `commandline` updates the command line buffer:
- `-a` or `--append` do not remove the current commandline, append the specified string at the end of it
- `-i` or `--insert` do not remove the current commandline, insert the specified string at the current cursor position
- `-r` or `--replace` remove the current commandline and replace it with the specified string (default)
The following options change what part of the commandline is printed or updated:
2005-09-20 13:31:55 +00:00
2018-06-29 13:28:46 +00:00
- `-b` or `--current-buffer` select the entire buffer, including any displayed autosuggestion (default)
2014-08-19 12:41:23 +00:00
2014-08-01 02:37:32 +00:00
- `-j` or `--current-job` select the current job
2014-08-19 12:41:23 +00:00
2014-08-01 02:37:32 +00:00
- `-p` or `--current-process` select the current process
2014-08-19 12:41:23 +00:00
2018-05-05 19:41:03 +00:00
- `-s` or `--current-selection` selects the current selection
- `-t` or `--current-token` select the current token
2005-09-20 13:31:55 +00:00
2014-08-19 12:41:23 +00:00
The following options change the way `commandline` prints the current commandline buffer:
2005-09-20 13:31:55 +00:00
2014-08-19 12:41:23 +00:00
- `-c` or `--cut-at-cursor` only print selection up until the current cursor position
2005-09-20 13:31:55 +00:00
2014-08-19 12:41:23 +00:00
- `-o` or `--tokenize` tokenize the selection and print one string-type token per line
2005-09-20 13:31:55 +00:00
2014-08-19 12:41:23 +00:00
If `commandline` is called during a call to complete a given string using `complete -C STRING`, `commandline` will consider the specified string to be the current contents of the command line.
2006-01-31 21:46:46 +00:00
2014-01-17 20:53:01 +00:00
The following options output metadata about the commandline state:
2014-08-19 12:41:23 +00:00
- `-L` or `--line` print the line that the cursor is on, with the topmost line starting at 1
- `-S` or `--search-mode` evaluates to true if the commandline is performing a history search
- `-P` or `--paging-mode` evaluates to true if the commandline is showing pager contents, such as tab completions
2014-01-17 20:53:01 +00:00
2005-09-20 13:31:55 +00:00
\subsection commandline-example Example
2014-08-19 12:41:23 +00:00
`commandline -j $history[3]` replaces the job under the cursor with the third item from the command line history.
2015-09-11 19:05:55 +00:00
If the commandline contains
\fish
>_ echo $fl___ounder >&2 | less; and echo $catfish
\endfish
(with the cursor on the "o" of "flounder")
Then the following invocations behave like this:
\fish
>_ commandline -t
$flounder
>_ commandline -ct
$fl
>_ commandline -b # or just commandline
echo $flounder >&2 | less; and echo $catfish
>_ commandline -p
echo $flounder >&2
>_ commandline -j
echo $flounder >&2 | less
\endfish