GithubHelp home page GithubHelp logo

med's Introduction

med, Micro Emacs in D

This is my version of MicroEmacs, based on the public domain version by Dave Conroy. I like it because it is small, fast, easilly customizable, and it ports readilly to whatever machine I need to use it on. It's written in the D programming language.

It currently works on Windows and Linux.

To edit myfile.d:

med myfile.d

Cheat Sheet

Command Name         Description                        Keybinding

Movement

basic_nextline       Move to next line			F5
gotobol              Move to start of line		^A
forwchar             Move forward by characters		^F, rightarrow
gotoeol              Move to end of line		^E
backchar             Move backward by characters	^B, leftarrow
forwline             Move forward by lines		^N, downarrow
backline             Move backward by lines		^P, uparrow
forwpage             Move forward by pages		^V, PgDn
backpage             Move backward by pages		Esc B, PgUp
gotobob              Move to start of buffer		Esc <, ^Home
gotoeob              Move to end of buffer		Esc >, ^End
gotoline             Move to line number		^X L
word_back            Backup by words			Esc B, ^leftarrow
word_forw            Advance by words			Esc F, ^rightarrow

Windows

window_next          Move to the next window		^X N, F6
window_prev          Move to the previous window	^X P
window_only          Make current window only one	^X 1
window_split         Split current window		^X 2
window_mvdn          Move window down			Esc N, End
window_mvup          Move window up			Esc P, Home
window_enlarge       Enlarge display window		^X Z
window_shrink        Shrink window			Esc Z
window_reposition    Reposition window			^X T
window_refresh       Refresh the screen			^L
delwind              Delete a window			^X D

Deleting

random_deblank       Delete blank lines			^X O
random_forwdel       Forward delete			^D, Del
random_backdel       Backward delete			^H, 0x7F
random_undelchar     Undelete a character		AltF Del
Ddelline             Delete a line			^J
Dundelline           Undelete a line			Esc J, AltF F2
Ddelword             Delete a word
Ddelbword            Delete a word (backwards)
Dundelword           Undelete a word			AltF ^rightarrow, AltF ^leftarrow
delfword             Delete forward word		Esc D
delbword             Delete backward word		Esc H

Cutting/Pasting

random_kill          Kill forward			^K
random_yank          Paste from kill buffer		^Y, ^X K, F10
region_kill          Cut region to kill buffer		Esc 9, F9
region_copy          Copy region to kill buffer		Esc 8, F8
basic_setmark        Set mark				F7, Esc .
removemark           Remove mark			^X .
swapmark             Swap dot and mark			Esc X
word_select          Select word			Esc W

Files

filenext             Edit next file			AltF N
fileread             Get a file, read only		AltF R
filevisit            Get a file, read write		AltF V
filewrite            Write a file			AltF W
fileunmodify         Turn off buffer changed bits	AltF U
filesave             Save current file			AltF S
filename             Adjust file name			AltF F
filemodify           Write modified files		AltF M
Dinsertfile          Insert a file at dot		AltF I

Exit

ctrlg                Abort out of things		^@, ^G
quit                 Quit				^C, AltF Q
quickexit            low keystroke style exit
normexit             Write modified files and exit	AltF X, AltX

Macros

ctlxlp               Begin macro			^X (
ctlxrp               End macro				^X )
macrotoggle          Start/End macro			F12
ctlxe                Execute macro			^X E, F11

Search

forwsearch           Search forward			^S
                     Search forward regexp              ^S^T
                     Search forward word                ^S^W
backsearch           Search backwards			^R
replacestring        Search and replace			Esc R
queryreplacestring   Query search and replace		Esc Q
Dsearch              Search				F4, AltF F4
Dsearchagain         Search for the same string		F2

D, C and C++

search_paren         Toggle over parentheses		^W, F3
random_indent        Insert CR-LF, then indent
random_incindent     increase indentation level		^X ], AltF10
random_decindent     decrease indentation level		^X [, AltF9
random_opttab        optimize tabbing in line		Esc I
Dcppcomment          convert /* */ to //		^X /

<b>Configuration</b>

display_norm_fg						AltF2
display_norm_bg						AltF1
display_mode_fg						AltF4
display_mode_bg						AltF3
display_mark_fg						AltF5
display_mark_bg						AltF6
display_eol_bg						AltF7
main_saveconfig      Save configuration			AltC

Process

spawncli             Run CLI in a subjob		^Z
spawn                Run a command in a subjob		^X !
spawn_filter         Filter buffer through program	^X #
spawn_pipe           Run program and gather output	^X @, AltZ
Dpause               Pause the program (UNIX only)

Buffers

listbuffers          Display list of buffers		AltF B
usebuffer            Switch a window to a buffer	^X B
buffer_next          Switch to next buffer		^X W, AltB
killbuffer           Make a buffer go away

Other

random_setfillcol    Set fill column			^X F
word_wrap_line       Word wrap line                     ^X A
random_showcpos      Show the cursor position		^X =
random_twiddle       Twiddle characters			^T
random_tab           Insert tab				^I, Tab
random_hardtab       Set hardware tabs			AltF T
random_newline       Insert CR-LF			^M
random_openline      Open up a blank line		^O, AltF Ins
random_quote         Insert literal			^Q, ^X Q
region_togglemode    Toggle column region mode		Esc T
toggleinsert         Toggle insert/overwrite mode	Ins
line_overwrite       Write char in overwrite mode
getcol               Get current column
misc_upper           Upper case word/region		Esc U
misc_lower           Lower case word/region		Esc L
capword              Initial capitalize word		Esc C
win32toggle43        Toggle hires mode			AltE
ibmpctoggle43        Toggle hires mode			AltE
Dignore              do nothing
Dadvance             Set into advance mode		Esc downarrow
Dbackup              Set into backup mode		Esc uparrow
Dinsertdate          File and date stamp		AltF D
scrollUnicode        Scroll through Unicode variations  ^X U

Glossary

  • dot current cursor position
  • mark start of a region
  • minibuffer text entry box used for entering file names and search strings
  • region text between "dot" and "mark"
  • Regular Expressions

Notes

  • ^[ also works as Esc.
  • Names without a keybinding can't be accessed, but they can be called if the keybindings in main.c are updated.
  • Prefixing a command with ^U enables a count to be entered, which executes the command count times.
  • Pressing ^X, AltF, or Esc and then pausing will bring up a menu.
  • The right mouse button will bring up a menu.
  • The left mouse button can be used for setting the dot, marking regions, and adjusting window sizes.
  • The minibuffer has a small history buffer, accessible with the uparrow key.
  • On Win32, by clicking on the title bar, then select [Edit], you can access the Windows clipboard. This is very handy for cutting/pasting text from another window or the web browser.

Bugs

  • Some of the keybindings make no sense.
  • The Alt function key sequences don't work on Win32.
  • The control numeric pad sequences don't work on Linux.
  • The colors can't be modified on any but the DOS version.
  • The process functionality is flaky.
  • For some reason, the mouse in the Win32 version doesn't work on Win2000, but does on WinNT.

med's People

Contributors

ibara avatar markus-oberhumer avatar walterbright avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

med's Issues

compile failure

make -f linux.mak
dmd -c -g -odobj -Isrc/med  src/med/ed.d
dmd -c -g -odobj -Isrc/med  src/med/basic.d
src/med/main.d(360): Error: undefined identifier 'help'
linux.mak:42: recipe for target 'obj/basic.o' failed
make: *** [obj/basic.o] Error 1

C-. causes SwitchError to be thrown.

Steps to reproduce

  1. run med.exe
  2. hit ctrl-.

What happens?

Explosion.

core.exception.SwitchError@console(314): No appropriate switch clause found
----------------
0x00436F34 in char[][] core.sys.windows.stacktrace.StackTrace.trace()
0x00436DBF in core.sys.windows.stacktrace.StackTrace core.sys.windows.stacktrace.StackTrace.__ctor()
0x00420418 in onSwitchError
0x004171B9 in int console.ttkeysininput() at C:\Users\Bernard\Coding\src\med\console.d(382)
0x004156FF in int main.getkey() at C:\Users\Bernard\Coding\src\med\main.d(649)
0x0041506D in _Dmain at C:\Users\Bernard\Coding\src\med\main.d(489)
0x0041C9FC in extern (C) int rt.dmain2.main(int, char**).void runMain()
0x0041CA36 in extern (C) int rt.dmain2.main(int, char**).void runAll()
0x0041C658 in main
0x00441971 in mainCRTStartup
0x75C3339A in BaseThreadInitThunk
0x77919EF2 in RtlInitializeExceptionChain
0x77919EC5 in RtlInitializeExceptionChain
----------------

What do you expect to happen?

No idea, but not that.

undefined identifier term

I'm using Mac OS.

Joels-MBP:med joelcnz$ dub build
Building med 1.0.0 configuration "application", build type debug.
Compiling using dmd...
src/med/display.d(166): Error: undefined identifier term
src/med/display.d(167): Error: undefined identifier term
src/med/display.d(168): Error: undefined identifier term
src/med/display.d(169): Error: undefined identifier term
src/med/display.d(176): Error: undefined identifier term
src/med/display.d(191): Error: undefined identifier term
src/med/display.d(207): Error: undefined identifier term
src/med/display.d(208): Error: undefined identifier term
src/med/display.d(209): Error: undefined identifier term
src/med/display.d(235): Error: undefined identifier term
src/med/display.d(237): Error: undefined identifier term
src/med/display.d(238): Error: undefined identifier term
src/med/display.d(341): Error: undefined identifier term
src/med/display.d(342): Error: undefined identifier term
src/med/display.d(366): Error: undefined identifier ttkeysininput
src/med/display.d(375): Error: undefined identifier term
src/med/display.d(457): Error: undefined identifier term
src/med/display.d(458): Error: undefined identifier term
src/med/display.d(604): Error: undefined identifier term
src/med/display.d(607): Error: undefined identifier term
src/med/display.d(624): Error: undefined identifier term
FAIL .dub/build/application-debug-posix.osx-x86_64-dmd_2066-35C0D2528E338048941413D2E9B5CC19/ med executable
Error executing command build: dmd failed with exit code 1.

Joels-MBP:med joelcnz$

size_t conflicts when building on 64-bit Linux

I get errors on the following lines when compiling on 64-bit Linux (Ubuntu or Fedora, but I assume this is not distro-specific). The problem in all cases is the use of size_t, causing a ulong to be passed as a parameter that should be int.

display.d: Lines 323, 324, 327
more.d: Lines 399, 402

Importing std.conv and adding to!int as needed fixed the problem in all cases. I'd have submitted a PR, but I don't know if this is how you want to fix it.

Error building with dub

Using dub registry url 'http://code.dlang.org/'
Refreshing local packages (refresh existing: true)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /home/swoorup/.dub/packages/local-packages.json
Try to load local package map at /home/swoorup/.dub/packages/local-packages.json
Determined package version using GIT: dash 0.12.0-beta1+commit.27.gb7d589a
Determined package version using GIT: med 1.0.0
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /home/swoorup/.dub/packages/local-packages.json
Try to load local package map at /home/swoorup/.dub/packages/local-packages.json
Checking for missing dependencies.
Refreshing local packages (refresh existing: false)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /home/swoorup/.dub/packages/local-packages.json
Try to load local package map at /home/swoorup/.dub/packages/local-packages.json
Checking for upgrades.
Using cached upgrade results...
Generating using build
Generate target med (executable /home/swoorup/git/dlang_projects/med/bin med)
Performing "debug" build using dmd for x86_64.
Target '/home/swoorup/git/dlang_projects/med/.dub/build/application-debug-linux.posix-x86_64-dmd_2070-EC714E7D07A609E23735D82D8B1F2761/med' doesn't exist, need rebuild.
med 1.0.0: building configuration "application"...
dmd -c -of.dub/build/application-debug-linux.posix-x86_64-dmd_2070-EC714E7D07A609E23735D82D8B1F2761/med.o -debug -g -w -version=Have_med -Isrc/med src/med/basic.d src/med/buffer.d src/med/console.d src/med/disp.d src/med/display.d src/med/disprev.d src/med/ed.d src/med/file.d src/med/fileio.d src/med/line.d src/med/main.d src/med/more.d src/med/mouse.d src/med/random.d src/med/region.d src/med/search.d src/med/spawn.d src/med/tcap.d src/med/terminal.d src/med/termio.d src/med/window.d src/med/word.d src/med/xterm.d -vcolumns
src/med/buffer.d(254,16): Warning: instead of C-style syntax, use D-style syntax 'dchar[6 + 1] b'
src/med/buffer.d(255,16): Warning: instead of C-style syntax, use D-style syntax 'dchar[128] line'
src/med/console.d(188,15): Warning: instead of C-style syntax, use D-style syntax 'CHAR_INFO[256] sbbuf'
src/med/disp.d(34,11): Warning: instead of C-style syntax, use D-style syntax 'ubyte[3] reserved'
src/med/display.d(948,9): Warning: instead of C-style syntax, use D-style syntax 'dstring[HISTORY_MAX] history'
src/med/main.d(71,9): Warning: instead of C-style syntax, use D-style syntax 'dchar[256] kbdm'
src/med/main.d(453,8): Warning: instead of C-style syntax, use D-style syntax 'CMDTAB[] cmdtab'
src/med/tcap.d(54,6): Warning: instead of C-style syntax, use D-style syntax 'char[2048] tcapbuf'
src/med/tcap.d(209,14): Warning: instead of C-style syntax, use D-style syntax 'char[16] backc'
src/med/display.d(1167,13): Warning: switch case fallthrough - use 'goto default;' if intended
src/med/main.d(515,5): Warning: statement is not reachable
src/med/search.d(208,5): Warning: statement is not reachable
src/med/search.d(211,5): Warning: statement is not reachable
src/med/search.d(214,5): Warning: statement is not reachable
src/med/search.d(328,7): Warning: switch case fallthrough - use 'goto case;' if intended
FAIL .dub/build/application-debug-linux.posix-x86_64-dmd_2070-EC714E7D07A609E23735D82D8B1F2761/ med executable
dmd failed with exit code 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.