Giter Site home page Giter Site logo

glycerine / gemacs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nsf/godit

163.0 8.0 5.0 5.76 MB

A lightweight emacs written in pure Go. Uses https://github.com/gdamore/tcell for portability. Derived from go editor `godit`. Your next terminal based editor. Windows/OSX/Linux binaries: https://github.com/glycerine/gemacs/releases

License: MIT License

Go 99.85% Makefile 0.15%

gemacs's Introduction

gemacs: an emacs written in Go

gemacs is derived from godit, https://github.com/nsf/godit, and adapted to use https://github.com/gdamore/tcell for portability. Terminal based, it works anywhere.

In addition to using tcell, release v1.0 improves upon godit by: (a) improving file auto-completion with tab and enter; (b) Ctrl-x Ctr-w does write file, as in traditional emacs -- now view operations is rebound to Ctrl-x Ctrl-v; (c) Ctrl-x o cycles through all visible views.

Extensibility being the hallmark of emacsen, gemacs gets its extensibility by being both small and written in Go.

The fast compilation, superior typechecking, and sparse design of Go mean that extensibility is actually improved compared to the awkward two language approach. Two languages were needed in the time of C with its slow compilation, but that time has passed. Keeping with the Go philosophy of minimalism and simplicity, there are no plans to add an embedded scripting language to gemacs. Being MIT licensed, you are welcome to fork and derive from it however you like, of course.

screenshot

A description translated from the godit readme:

Gemacs is an emacs-ish lightweight text editor.

Gemacs uses many of the emacs key bindings and operates using a notion of "micromodes". It's easier to explain what a micromode is by a simple example. Let's take the keyboard macros feature from both emacs and gemacs. You can start recording a macro using C-x ( key combination and then when you're ready to start repeating it, you do the following: C-x e (e...). Not only C-x e ends the recording of a macro, it executes the macro once and enters a micromode, where typing e again, will repeat that action. But as soon as some other key was pressed you quit this micromode and everything is back to normal again. The idea of micromode is used in gemacs a lot.

List of keybindings (updated for gemacs, * means new)


Basic things:
  C-g              - Universal cancel button
  C-x C-c          - Quit from the gemacs
  C-x C-s          - Save file [prompt maybe]
  C-x S            - Save file (raw) [prompt maybe]
  C-x M-s          - Save file as [prompt]
  C-x M-S          - Save file as (raw) [prompt]
  C-x C-w          - Save file as (raw) [prompt] *
  C-x C-f          - Open file
  M-g              - Go to line [prompt]
  C-_              - Undo
  C-x C-_ (C-_...) - Redo

View/buffer operations:
  C-x C-v          - View operations mode *
  C-x 0            - Kill active view
  C-x 1            - Kill all views but active
  C-x 2            - Split active view vertically
  C-x 3            - Split active view horizontally
  C-x o            - Cycle through views
  C-x b            - Switch buffer in the active view [prompt]
  C-x k            - Kill buffer in the active view

View operations mode:
  v                - Split active view vertically
  h                - Split active view horizontally
  k                - Kill active view
  C-f, <right>     - Expand/shrink active view to the right
  C-b, <left>      - Expand/shrink active view to the left
  C-n, <down>      - Expand/shrink active view to the bottom
  C-p, <up>        - Expand/shrink active view to the top
  1, 2, 3, 4, ...  - Select view

Cursor/view movement and text editing:
  C-f, <right>     - Move cursor one character forward
  M-f              - Move cursor one word forward
  C-b, <left>      - Move cursor one character backward
  M-b              - Move cursor one word backward
  C-n, <down>      - Move cursor to the next line
  C-p, <up>        - Move cursor to the previous line
  C-e, <end>       - Move cursor to the end of line
  C-a, <home>      - Move cursor to the beginning of the line
  C-v, <pgdn>      - Move view forward (half of the screen)
  M-v, <pgup>      - Move view backward (half of the screen)
  C-l              - Center view on line containing cursor
  C-s              - Search forward [interactive prompt]
  C-r              - Search backward [interactive prompt]
  C-j              - Insert a newline character and autoindent
  <enter>          - Insert a newline character
  <backspace>      - Delete one character backwards
  C-d, <delete>    - Delete one character in-place
  M-d              - Kill word
  M-<backspace>    - Kill word backwards
  C-k              - Kill line
  M-u              - Convert the following word to upper case
  M-l              - Convert the following word to lower case
  M-c              - Capitalize the following word
  <any other key>  - Insert character

Mark and region operations:
  C-<space>        - Set mark
  C-x C-x          - Swap cursor and mark locations
  C-x > (>...)     - Indent region (lines between the cursor and the mark)
  C-x < (<...)     - Deindent region (lines between the cursor and the mark)
  C-x C-r          - Search & replace (within region) [prompt]
  C-x C-u          - Convert the region to upper case
  C-x C-l          - Convert the region to lower case
  C-w              - Kill region (between the cursor and the mark)
  M-w              - Copy region (between the cursor and the mark)
  C-y              - Yank (aka Paste) previously killed/copied text
  M-q              - Fill region (lines between the cursor and the mark) [prompt]

Advanced:
  M-_              - Local words autocompletion
  C-x C-a          - Invoke buffer specific autocompletion menu [menu]
  C-x (            - Start keyboard macro recording
  C-x )            - Stop keyboard macro recording
  C-x e (e...)     - Stop keyboard macro recording and execute it
  C-x =            - Info about character under the cursor
  C-x !            - Filter region through an external command [prompt]

License: MIT License.

gemacs's People

Contributors

glycerine avatar jroes avatar kimshrier avatar nsf avatar tv42 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gemacs's Issues

escape key doesn't work on linux

works on OSX, but on linux, ESC + '>' and ESC + '<' do not work to go to end of/beginning of the buffer. They did work in godit under termbox-go.

doesn't work properly, cannot compile

I'm trying to use gemacs on Windows. Unfortunately, some key bindings do not work.
The C-<space> does not work and when I try C-x C-v the C-v does an OS-command "paste" on the window.
I'd like to look into the code to see if I can fix it even though I am a total Golang beginner.
But I can't even compile it with go on Windows (have go 1.21.1).
Perhaps over the time of five years, it became incompatible with current Golang compilers?

Some zygomys in gemacs ?

Hello @glycerine !

do you plan put some (a lot of) Zygomys in your implementation.

What make emacs great is the fact that it is greatly extensible. I think your lisp implementation is a good candidate.

I'm pretty sure you already think about it !

Sure it would be a good extension.

Backgrounding with Ctrl-Z, then resuming, leaves gemacs in an unusable state

Try the following on a Unix-esque system (Linux, in my case):

  1. Start up gemacs
  2. Tap Ctrl-Z to background it for a moment while you go find a piece of information you need in the editor.
  3. After finding that bit of info, type "fg" to foreground it.

Rather than restore the screen mode, it sets waiting for input on stdin. Ctrl-C kills it.

i suspect, without in any way being sure, that this is simply a matter of restoring the screen mode after resuming. How that's handled in Go, i haven't a clue (i'm a C guy).

My use case: my web hoster recently removed emacs from their shared servers and refuse to reinstall it, telling me i "will simply have to use vim." And yet 25 years of emacs muscle memory Does Not Simply Use Vim. So... gemacs is the only light-enough-weight alternative i've found for installing there. It often happens that i'm editing a file, need to background the editor to copy a filename or some such, and resume the session to paste that bit of info into the editor. That becomes impossible without running a second SSH session.

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.