oded - On-disk editor - edit text files by commands directly from shell



NAME

oded - On-disk editor - edit text files by commands directly from shell


SYNOPSIS

 oded [<OPTIONS>] <INSTRUCTIONS>


DESCRIPTION

Edit files by issuing editor commands like shell commands, but with the paradigm of well-known visual text processors: open file, move cursor, type in text, search and replace, select, copy, paste, ...

May open multiple files. Always one file is in the foreground. All opened files has a cursor position at which most commands are applied.

Files also have several marks which you can set or refer to in select or goto commands. A special pair of marks is SELECTION-START and SELECTION-END which pins the currently selected text for you.

You have one clipboard.

Oded first executes INSTRUCTIONS given in parameters, then all the instructions given at --script option(s), if any.


OPTIONS

-f, --script FILE

Take instructions from FILE when done processing instructions given in parameters. May specify multiple times. Exit immediately on unknown command or parse error or if a command fails.

--stdin

Take instructions from STDIN line-by-line. Contrary to --script scripts, it does not exit on errors, just shows what was the exception, and continues reading instructions. Suitable for interactive mode. Same as --script -, except in error handling.

-v, --verbose
-b, --successful-prompt-command INSTRUCTIONS

Set what INSTRUCTIONS to run after each successful command in interactive mode (ie. --stdin).


INSTRUCTIONS

open [file] PATH [as NAME]
open or create [file] PATH [as NAME]
open new [file] PATH [as NAME]

Open PATH file to edit. open file PATH only opens already existing files, open or create ... creates the file if it is not yet there. open new file ... opens a file only if it does not exist yet.

You can switch between multiple opened files by invoking open PATH or open file PATH again, or open NAME if you opened the file under a certain NAME by as NAME.

Don't worry, it won't open the same PATH multiple time with conflicting editor states. However your system may allow accessing the same file (by soft and hard links) on different paths. Oded considers only the PATH string when discerning files, so x.txt and ./x.txt and .//x.txt are handled separatedly. You have to open a file before any operation.

open [NAME | PATH]

Switch to an already opened file with the given NAME alias or PATH path, if NAME alias is not found. You can not open a file on path PATH once you set NAME as an alias for a file on an other PATH. But you can always refer to the same path by prepending ./ (or / in case of absolute paths) to it.

goto end of [last] search result
goto [start | end] [of file]
goto [start | end] of line
goto [sof | eof | sol | eol]
goto [previous | next] line
goto [line | offset] NUMBER

Lines and byte offsets are indexed by 0.

goto mark NAME

Set cursor position in file.

go [back | forward] COUNT line[s]
[go] [up | down | left | right] [COUNT times]
type STRING
enter [STRING]

Insert given STRING into the current cursor position. It does not overwrite current selection. Add newline to the end only if called as c<enter>.

overwrite with STRING
overtype with STRING

Type given STRING into the current cursor position in overwrite mode. It does not overwrite current selection, but the text itself let it be currently selected or not.

replace all [[occurrences of] PATTERN] to STRING
replace all [occurrences | PATTERN] to STRING
replace [next [COUNT]] [[occurrence[s] of] PATTERN] to STRING
replace [next [COUNT]] [occurrence[s] | PATTERN] to STRING

Replace given PATTERN to STRING. If PATTERN is not given, then the last search pattern will be used. "Replace next" changes only the next COUNT number of occurrences starting from the cursor position. Default is 1 occurrence, if COUNT is not given. "Replace all" changes all the occurrences from the cursor position down to the end of file. If you want to replace all the occurrences in the whole file, "goto start" first.

delete [COUNT char[s]]
backspace [COUNT char[s]]
search [next] PATTERN [backward]

Find next occurrence (or previous one if "backward" is specified) of PATTERN and set the cursor to it. PATTERN is either a bare word, a string enclosed in quotes, or a regexp enclosed in slashes (/regexp/). PATTERN is not supported to overhang from one line to the next. Remove newlines from the text if you must. If the cursor is at a matching text, search PATTERN will find the very place where we are, while search next ... skips 1 char and continues from there.

search next [//]

Continue searching the next occurrence of the last search query. You may close this instruction with an empty pattern (//) to separate it from the next instruction, since the empty search PATTERN (both fixed text and regexp) is invalid, thus not searching an other pattern but the last one. In interactive mode search next is enough.

mark as NAME

Put a named mark to the current cursor position. NAME must not be a reserved mark name: START, END, SOL, EOL, HERE.

clear mark NAME
select from START-MARK to END-MARK

Select text from the previously named mark START-MARK to END-MARK. Put marks with mark as command. You have some special predefined marks:

START beginning of the file
END end of the file
HERE current cursor position
SOL start of line
EOL end of line, excluding the line ending (Newline) char
select [from | to] MARK

If either from or to is missing, HERE is implied.

select [last] search result
select none
select [COUNT] [char[s] | word[s] | line[s]]
copy [[selection] | [last] search result | to [start | end] of line]
cut [[selection] | [last] search result | to [start | end] of line]
delete [selection | [last] search result | to [start | end] of line]
[copy | cut] [selection]
delete selection
[copy | cut | delete] [last] search result
[copy | cut | delete] to [the] [start | end] of line
paste [selection]
undo
redo
insert file FILE
insert output of COMMAND

Insert FILE's contents or the output (stdout) of COMMAND to the current cursor position.

filter selection through COMMAND
send selection to COMMAND

Send selected text to COMMAND as stdin, and in case of filter, replace selection with its stdout.

uppercase
lowercase
capitalize
show open[ed] file[s]

Display a list of file paths which were opened. The one in foreground prefixed with an * asterisk. If any of them opened by an alias name, it shown after the path in [] brackets.

show contents [with cursor] [with selection] [with marks]

Show the contents of the file in foreground.

show cursor
show marks
set OPTION [on | off | VALUE]
unset OPTION
show options
[show] help