1DEX(1)                      General Commands Manual                     DEX(1)
2
3
4

NAME

6       dex
7

SYNOPSIS

9       dex [-c command] [-t tag] [-r rcfile] [-V] [file]...
10

DESCRIPTION

12       A small and flexible text editor.
13

COMMAND LINE OPTIONS

15       -c command
16              Run this command after reading the rc file and opening any files
17              specified on command line.
18
19       -r rcfile
20              Read this rc file instead of ~/.dex/rc or /usr/share/dex/rc.
21
22       -t tag
23              Go to tag.  Requires tags file generated by Exuberant Ctags.
24
25       -R
26              Don't read the rc file.
27
28       -V
29              Display the version number and exit.
30

BASIC USAGE

32       Here's some of the default key bindings. M-x means meta-x or alt-x and
33       ^V is ctrl-v. See /usr/share/dex/bindings/default for more keys.
34
35              M-s    select
36
37              ^V     select lines
38
39              ^Y     copy current line or selection
40
41              ^D     cut current line or selection
42
43              ^P     paste
44
45              ^E     undo
46
47              ^R     redo
48
49              ^C     enter command line
50
51              M-/    search
52
53              M-n    search next
54
55              M-p    search previous
56
57              M-N    activate Nth tab
58
59       On the command line you can use tab to complete commands and most of
60       their parameters. Run next or prev to switch to next or previous file.
61       The commands open, save and quit should be obvious.
62

COMMANDS

64       alias <name> <command>
65              Create an alias to command.
66
67              Example:
68                     alias read "pass-through cat"
69
70              Now you can run "read file.txt" to insert file.txt to current
71              file.
72
73       bind <key> [command]
74              Bind a key to command. If command is not given then binding for
75              the key is removed.
76
77              Keys:
78                     insert delete home end pgup pgdown left right up down F1
79                     F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 enter tab space (or
80                     sp)
81
82              Modifiers:
83                     ctrl: C-X or ^X
84
85                     meta/alt: M-X
86
87                     shift: S-left
88
89              Key chains are supported. For example "^X c" (press ^X and then
90              c). Keys are separated by spaces.
91
92       bof
93              Move to beginning of file.
94
95       bol
96              Move to beginning of line.
97
98       case [-lu]
99              Change text case. Default is to change lower case to upper and
100              vice versa.
101
102              -l lower case
103
104              -u upper case
105
106       cd <directory>
107              Change directory. Updates $PWD and $OLDPWD. "cd -" changes to
108              previous directory ($OLDPWD).
109
110       center-view
111              Center view to cursor.
112
113       clear
114              Clear current line.
115
116       close [-fqw]
117              Close file.
118
119              -f close file even if it hasn't been saved after last
120              modification
121
122              -q quit if closing the last open file
123
124              -w close parent window if closing its last contained file
125
126       command [text]
127              Enter command line. If text is given then it is written to the
128              command line (see the default binding ^L why this is useful).
129
130       compile [-1ps] <errorfmt> <command> [parameters]...
131              Run external command and collect error messages. This can be
132              used to run make and grep.
133
134              -1 read error messages from stdout instead of stderr
135
136              -p display "Press any key to continue" prompt
137
138              -s silent. both stderr and stdout are redirected to /dev/null
139
140              See also errorfmt and msg commands.
141
142       copy
143              Copy current line or selection.
144
145       cut
146              Cut current line or selection.
147
148       delete
149              Delete character or selection.
150
151       delete-eol
152              Delete to end of line.
153
154       delete-word [-s]
155              Delete word after cursor.
156
157              -s be more "aggressive"
158
159       down
160              Move cursor down.
161
162       eof
163              Move cursor to end of file.
164
165       eol
166              Move cursor to end of line.
167
168       erase
169              Erase character before cursor.
170
171       erase-bol
172              Erase to beginning of line.
173
174       erase-word [-s]
175              Erase word before cursor.
176
177              -s be more "aggressive"
178
179       errorfmt [-i] <compiler> <regexp> [file|line|column|message]...
180
181              -i ignore this error
182
183              See compile and msg commands for more information.
184
185       filter <command> [parameter]...
186              Filter selected text or whole file through external command.
187
188              Example: filter sort -r
189
190       format-paragraph [width]
191              Format the paragraph cursor is located on or selection. If
192              paragraph width is not given then the text-width option is used.
193
194              This command merges selection into one paragraph. To format
195              multiple paragraphs use the external command fmt with filter
196              command. E.g. filter fmt -w 60.
197
198       ft <filetype> <extension>...
199              Add extensions for filetype.
200
201       ft -c <filetype> <regexp>...
202              Detect filetype by matching the regexp against first line of
203              file.
204
205       ft -f <filetype> <regexp>...
206              Detect filetype by matching the regexp against filename.
207
208       ft -i <filetype> <interpreter>...
209              Connect interpreters to file type.  Interpreter is parsed from
210              the #! line in many scripts.
211
212       git-open
213              Interactive file opener. Lists all files in GIT repository.
214
215              Same keys work as in command mode, but with these changes:
216
217              up     Move up in file list.
218
219              down   Move down in file list.
220
221              enter  Open file.
222
223              ^O     Open file but don't close git-open.
224
225              M-e    Go to end of file list.
226
227              M-t    Go to top of file list.
228
229       hi <name> [fg-color [bg-color]]  [attribute]...
230              Set highlight color.
231
232              Colors:
233                     keep (-2) default (-1) black (0) red green yellow blue
234                     magenta cyan gray darkgray lightred lightgreen
235                     lightyellow lightblue lightmagenta lightcyan white
236
237              Color can be given as a numeric value too (-2..255).
238
239              Colors 16-255 are supported by modern xterm compatible terminal
240              emulators. There's a 6x6x6 color cube at indexes 16..231. For
241              these colors it is easiest to use the R/G/B syntax where R, G
242              and B are values between 0 and 5.
243
244              Indexes 232..255 contain 24 grayscale values which can be used
245              to specify grayscale value more accurately than using the R/G/B
246              syntax.
247
248              Attributes:
249                     bold lowintensity italic underline blink reverse
250                     invisible keep
251
252              The color and attribute value "keep" is useful in selected text
253              to keep fg-color and attributes and change only bg-color.
254
255              NOTE: Because "keep" is both color and attribute you need to
256              specify both fg-color and bg-color if you want to set the "keep"
257              attribute.
258
259              If you omit any color it is set to default (-1).
260
261              Unset fg/bg colors are inherited from highlight color "default".
262              If you don't set fg/bg for the highlight color "default" then
263              terminal's default fg/bg is used.
264
265       include <filename>
266              Read commands from file.
267
268       insert [-km] <text>
269              Insert text.
270
271              -k insert one character at a time as if it has been typed
272
273              -m move after inserted text
274
275       insert-special
276              Insert special character.
277
278              Insert control character, type decimal value of byte to insert
279              or press o to insert octal byte value, x to insert hexadecimal
280              byte value or u to insert hexadecimal unicode value.
281
282       join
283              Join selection or next line to current.
284
285       left
286              Move left.
287
288       line <number>
289              Go to line.
290
291       load-syntax <filename|filetype>
292              If argument contains / it is considered a filename.
293
294       move-tab <position|left|right>
295              Move current tab to numeric position, left or right.
296
297       msg [-np]
298              Show latest, next (-n) or previous (-p) message. If its location
299              is known (compile error or tag message) then the file will be
300              opened and cursor moved to the location.
301
302              -n next message
303
304              -p previous message
305
306              See also compile and tag commands.
307
308       new-line
309              Insert empty line under current line.
310
311       next
312              Display next file.
313
314       open [-e encoding] [file]...
315              Open files. If filename is omitted a new file is opened.
316
317              -e encoding
318                     Set file encoding. See "iconv -l" for list of supported
319                     encodings.
320
321       option <filetype> <option> <value>...
322              Add automatic options for a filetype. Options are automatically
323              set when file is opened.
324
325       option [-r] <regexp> <option> <value>...
326              Add automatic options for filenames matching regexp.
327
328       pass-through [-ms] <command> [parameter]...
329              Run command and insert its output.
330
331              -m move after the inserted text
332
333              -s strip newline from end of the command output
334
335       paste
336              Paste.
337
338       pgdown
339              Move cursor page down. See also scroll-pgdown.
340
341       pgup
342              Move cursor page up. See also scroll-pgup.
343
344       prev
345              Display previous file.
346
347       quit [-f]
348              Quit.
349
350              -f force quitting even if there are unsaved files
351
352       redo [choice]
353              Redo given or latest undid change. If there are multiple
354              possibilities an informative message is displayed:
355
356                     Redoing newest (2) of 2 possible changes.
357
358              If the change was not the one you wanted, just run undo and
359              then, for example, redo 1.
360
361       repeat <count> <command> [parameters]...
362              Run command multiple times.
363
364       replace [-bcgi] <pattern> <replacement>
365
366              -b use basic instead of extended regular expression syntax
367
368              -c display confirmation before each replace
369
370              -g replace all matching text from a line
371
372              -i ignore case
373
374       right
375              Move right.
376
377       run [-ps] <command> [parameters]...
378              Run external command.
379
380              -p display "Press any key to continue" prompt
381
382              -s silent. both stderr and stdout are redirected to /dev/null
383
384       save [-dfu] [-e encoding] [filename]
385              Save file.  By default line-endings (LF vs CRLF) are preserved.
386
387              -d save with DOS/CRLF line-endings
388
389              -f force saving read-only file
390
391              -u save with Unix/LF line-endings
392
393              -e encoding
394                     Set file encoding. See "iconv -l" for list of supported
395                     encodings.
396
397       scroll-down
398              Scroll view down one line. Keeps cursor position unchanged if
399              possible.
400
401       scroll-pgdown
402              Scroll page down. Cursor's position relative to top of screen is
403              maintained. See also pgdown.
404
405       scroll-pgup
406              Scroll page up. Cursor's position relative to top of screen is
407              maintained. See also pgup.
408
409       scroll-up
410              Scroll view up one line. Keeps cursor position unchanged if
411              possible.
412
413       search [-Hnprw] [pattern]
414              If no flags or just -r and no pattern given then dex changes to
415              search mode where you can type a regular expression to search.
416
417              -H don't add search pattern to history (meaningful only with the
418              search pattern given as argument)
419
420              -n search next
421
422              -p search previous
423
424              -r start searching backwards
425
426              -w search word under cursor
427
428       select [-bl]
429              Start selecting.
430
431              -b select code block starting from { and ending to }
432
433              -l select whole lines
434
435       set [-gl] <option1> [value1] ...
436              Set option value. Value can be omitted for boolean option to set
437              it true. Multiple options can be set at once but then value must
438              be given for every option.
439
440              There are three kinds of options.
441
442              1. Global options
443
444              2. Local options
445                     These are file specific options. Each open file has its
446                     own copies of the option values.
447
448              3. Options that have both global and local values
449                     Global value is just a default local value for opened
450                     files and never used for anything else. Changing global
451                     value does not affect any already opened files.
452
453                     By default set changes both global and local values.
454
455                     -g change only global option value
456
457                     -l change only local option value of current file
458
459              In configuration files only global options can be set (no need
460              to specify the -g flag).
461
462              To change option for specific filetypes and filenames use the
463              option command.
464
465       setenv <name> <value>
466              Set environment variable.
467
468       shift <count>
469              Shift current or selected lines <count> indentation levels.
470              Count is usually -1 (decrease indent) or 1 (increase indent).
471
472       suspend
473              Suspend program. Usually bound to ^Z.
474
475       tag [-r] [tag]
476              Save current location to stack and go to the location of tag.
477              Requires tags file generated by Exuberant Ctags. If no tag is
478              given then word under cursor is used as a tag instead.
479
480              -r return back
481
482              Tag files are searched from current working directory and its
483              parent directories.
484
485              See also msg command.
486
487       toggle [-gv] <option> [value...]
488              Toggle option. If list of values is not given then the option
489              must be either boolean or enum.
490
491              -g toggle global option instead of local
492
493              -v display new value
494
495              If option has both local and global value then local is toggled
496              unless -g is given.
497
498       undo
499              Undo latest change.
500
501       unselect
502              Unselect.
503
504       up
505              Move cursor up.
506
507       view <N|last>
508              Display Nth or last open file.
509
510       wclose [-f]
511              Close window.
512
513              -f close even if there are unsaved files in the window
514
515       wflip
516              Change from vertical layout to horizontal and vice versa.
517
518       wnext
519              Next window.
520
521       word-bwd [-s]
522              Move cursor backward one word.
523
524              -s skip special characters
525
526       word-fwd [-s]
527              Move cursor forward one word.
528
529              -s skip special characters
530
531       wprev
532              Previous window.
533
534       wresize [-hv] [[+-]N]
535              If no parameter given, equalize window sizes in current frame.
536
537              -h resize horizontally
538
539              -v resize vertically
540
541              N  Set size of current window to N characters.
542
543              +N Increase size of current window by N characters.
544
545              -N Decrease size of current window by N characters.
546
547       wsplit [-bhr] [file...]
548              Like open but at first splits current window vertically.
549
550              -b Add new window before current instead of after.
551
552              -h Split horizontally instead of vertically.
553
554              -r Split root instead of current window.
555
556       wswap
557              Swap positions of this and next frame.
558

OPTIONS

560       Options can be changed using the set command. Enumerated option values
561       can also be toggled. To see which options are enumerated type "toggle "
562       on command line and press tab. You can also use the option command to
563       set filetype/filename specific options.
564
565   Local and global options
566       Global values of these options serve as default values for local
567       (per-file) options.
568
569       auto-indent [true]
570              Automatically insert indentation when pressing enter.
571              Indentation is copied from previous non-empty line. If also the
572              indent-regex local option is set then indentation is
573              automatically increased if the regular expression matches
574              current line.
575
576       detect-indent [""]
577              Comma separated list of indent widths (1-8) to detect
578              automatically when file is opened. Set to "" to disable. Tab
579              indentation is detected if the value is not "". Adjusts
580              following options if indentation style is detected: emulate-tab,
581              expand-tab, indent-width.
582
583              Example:
584                     set detect-indent 2,3,4,8
585
586       emulate-tab [false]
587              Make delete, erase and moving left and right inside indentation
588              feel as if there were tabs instead of spaces.
589
590       expand-tab [false]
591              Convert tab to spaces on insert.
592
593       file-history [true]
594              Save line and column for each file to ~/.dex/file-history.
595
596       indent-width [8]
597              Size of indentation in spaces.
598
599       syntax [true]
600              Use syntax highlighting.
601
602       tab-width [8]
603              Width of tab. Recommended value is 8. If you use other
604              indentation size than 8 you should use spaces to indent.
605
606       text-width [72]
607              Preferred with of text. Used as default value for
608              format-paragraph.
609
610       ws-error [special]
611              Comma separated list of flags that describe what whitespace
612              errors should be highlighted. Set to "" to disable.
613
614              auto-indent
615                     If expand-tab is true then same as
616                     tab-after-indent,tab-indent otherwise same as
617                     space-indent.
618
619              space-align
620                     Display spaces used as alignment after tabs in
621                     indentation as error.
622
623              space-indent
624                     Display spaces in indentation as error. Note that this
625                     still allows using less than tab-width spaces at end of
626                     indentation for alignment.
627
628              tab-after-indent
629                     Display tabs used anywhere else but indentation as
630                     errors.
631
632              tab-indent
633                     Display tabs in indentation as errors. If you set this
634                     you most likely want to set tab-after-indent too.
635
636              special
637                     Display all characters that look like regular space as
638                     errors. One of these characters is no-break space
639                     (U+00A0) which is often accidentally typed (AltGr+space
640                     in some keyboard layouts).
641
642              trailing
643                     Display trailing whitespace as error.
644
645   Local only options
646       brace-indent [false]
647              Scan for { and } when calculating indentation size. Depends on
648              the auto-indent option.
649
650       filetype [none]
651              Type of file. Value must be previously registered using the ft
652              command.
653
654       indent-regex [""]
655              If this regular expression matches current line when enter is
656              pressed and auto-indent is true then indentation is increased.
657              Set to "" to disable.
658
659   Global only options
660       case-sensitive-search [true]
661              false
662                     Search is case-insensitive.
663              true
664                     Search is case-sensitive.
665              auto
666                     If search string contains a uppercase letter search is
667                     case-sensitive, otherwise it is case-insensitive.
668
669       display-special [false]
670              Display special characters.
671
672       esc-timeout [100] 0...2000
673              When single escape is read from the terminal dex waits some time
674              before treating the escape as a single keypress. The timeout
675              value is in milliseconds.
676
677              Too long timeout makes escape key feel slow and too small
678              timeout can cause escape sequences of for example arrow keys to
679              be split and treated as multiple key presses.
680
681       lock-files [true]
682              Lock files using ~/.dex/file-locks. Only protects from your own
683              mistakes (two processes editing same file).
684
685       newline [unix]
686              Whether to use LF (unix) or CRLF (dos) line-endings. This is
687              just a default value for new files.
688
689       scroll-margin [0]
690              Minimum number of lines to keep visible before and after cursor.
691
692       show-line-numbers [false]
693              Show line numbers.
694
695       statusline-left [" %f%s%m%r%s%M"]
696              Format string for the left aligned part of status line.
697
698              %f     Filename.
699
700              %m     "*" if file is has been modified since last save.
701
702              %r     "RO" if file is read-only.
703
704              %y     Cursor row.
705
706              %Y     Total rows in file.
707
708              %x     Cursor display column.
709
710              %X     Cursor column as characters. If it differs from cursor
711                     display column it is show too (e.g. "2-9").
712
713              %p     Position in percentage.
714
715              %E     File encoding.
716
717              %M     Miscellaneous status information.
718
719              %n     Line-ending (LF or CRLF).
720
721              %s     Add separator.
722
723              %t     File type.
724
725              %u     Hexadecimal unicode value value of character under
726                     cursor.
727
728              %%     Literal %.
729
730       statusline-right [" %y,%X   %u   %E %n %t   %p "]
731              Format string for the right aligned part of status line.
732
733       tab-bar [horizontal]
734              hidden
735                     Hide tab bar.
736              horizontal
737                     Show tab bar on top.
738              vertical
739                     Show tab bar on left if there's enough space, hide
740                     otherwise.
741              auto
742                     Show tab bar on left if there's enough space, on top
743                     otherwise.
744
745       tab-bar-max-components [0]
746              Maximum number of path components displayed in vertical tab bar.
747              Set to 0 to disable.
748
749       tab-bar-width [25]
750              Width of vertical tab bar. Note that width of tab bar is
751              automatically reduced to keep editing area at least 80
752              characters wide. Vertical tab bar is shown only if there's
753              enough space.
754

COMMAND SYNTAX

756       Command syntax is similar to shell but simpler.
757
758       Commands are separated either by newline or ";" character. To make a
759       command span multiple lines in a rc file escape the newline (put \ at
760       end of line).
761
762       Rc files can contain comments at beginning of line. Comment begins with
763       # character and can be indented, but you can't put comment on same line
764       with a command. This decision was made to make it possible to include #
765       in commands without escaping.
766
767       Commands can contain environment variables. Variable always expands
768       into a single argument even if it contains whitespace. Variables inside
769       single or double quotes are NOT expanded. This makes it possible to
770       bind a key to command which contains variable (inside single or double
771       quotes) and the variable is expanded just before the command is
772       executed.
773
774       Example:
775              alias x "run chmod 755 $FILE"
776
777       $FILE is expanded when the alias x is executed. The command works even
778       if $FILE contains whitespace.
779
780   Special variables
781       These are always defined and override environment variables of same
782       name.
783
784       $PKGDATADIR
785              Usually /usr/share/dex
786       $FILE
787              Current file. Empty string if there's no filename.
788       $WORD
789              Selected text or word under cursor. Empty string if there's no
790              selection and cursor is not on a word.
791
792   Single quoted strings
793       Can't contain single quote, no escaping possible.
794
795   Double quoted strings
796       \a     Bell
797
798       \b     Backspace
799
800       \t     Horizontal tab
801
802       \n     New line
803
804       \v     Vertical tab
805
806       \f     Form feed
807
808       \r     Carriage return
809
810       \\     Literal \
811
812       \x0a   Hexadecimal byte value 0x0a. Note that 0x00 is not supported
813              because strings are NUL-terminated.
814
815       \u20ac Four hex digit unicode code point U+20AC.
816
817       \U000020ac
818              Eight hex digit unicode code point U+20AC.
819

COMMAND LINE

821       In command line you can use up and down arrows to browse command
822       history and tab to complete commands and most of their arguments.
823
824       Here's list of key bindings (totally obvious keys left out):
825
826       ^A     Go to beginning of command line.
827
828       ^B     Move left.
829
830       ^C     Leave command line.
831
832       ^D     Delete.
833
834       ^E     Go to end of command line.
835
836       ^F     Move right.
837
838       ^K     Delete to end of command line.
839
840       ^U     Delete to beginning of command line.
841
842       ^V     Insert special character.
843
844       ^W     Erase word.
845
846       ^Z     Suspend.
847

SEARCH MODE

849       Search pattern is an extended regular expression.
850
851       Same keys work as in command mode, plus these additional keys:
852
853       M-c    Toggle case-sensitive-search option.
854
855       M-r    Reverse search direction.
856

FILES

858       ~/.dex/rc
859              You personal configuration.
860
861       ~/.dex/syntax/*
862              Your personal syntax files.  These override the syntax files
863              which come with the program.
864
865       ~/.dex/file-locks
866              Records open files to protect you from accidentally editing file
867              opened in another process. Used only if lock-files is true.
868
869       ~/.dex/command-history and ~/.dex/search-history
870              Command and search history.
871
872       ~/.dex/file-history
873              Last edited files and cursor positions.
874
875       /usr/share/dex/rc
876              Copy to ~/.dex/rc and customize.
877

AUTHORS

879       Timo Hirvonen <tihirvon@gmail.com>
880

SEE ALSO

882       dex-syntax(7)
883
884
885
886                                     2012                               DEX(1)
Impressum