Coder Social home page Coder Social logo

liner's Introduction

Liner

This fork adds minimal support for vi editing to Liner. Projects that make use of Liner have users that may be looking for vi editing functionality. The modifications in this repository offer basic vi editing behavior.

code statistics
===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 Go                     17         3211         2666          272          273
 Markdown                1           87            0           75           12
===============================================================================
 Total                  18         3298         2666          347          285
===============================================================================

We implement basic, single-action, vi editing functions. At present, we do not support number keys to execute multiple operations, a repeat key, or undo actions.

Users may expect a method to visually discern between vi normal and insert modes. Though we do not support changing cursor behavior, however, we can send terminal escape codes change the appearance of text in the terminal.

Vi Keys Supported

key function
r replace character under cursor
i enter insert mode
I enter insert mode at beginning of line
a enter insert mode one character to the right
A enter insert mode at end of line
^ H move cursor to the beginning of line
$ L move cursor to the end of line
h move cursor one character to the left
l move cursor one character to the right
w move cursor to the next word
W move cursor to the next Word
e move cursor to the end of next word
E move cursor to the end of next Word
b move cursor to the previous word
x delete the character under cursor
X delete the character before cursor
d delete the next word
D delete from cursor to end of line
C change text from cursor to end of line
j next matching history
k previous matching history
p paste from yank buffer
~ change character case
default keys supported
key function
Ctrl-A, Home move cursor to the beginning of line
Ctrl-E, End move cursor to the end of line
Ctrl-B, Left move cursor one character to the left
Ctrl-F, Right move cursor one character to the right
Ctrl-Left, Alt-B move cursor to the previous word
Ctrl-Right, Alt-F move cursor to the next word
Ctrl-D, Del delete character under cursor if line is not empty
Ctrl-D end of file/exit if line is empty
Ctrl-C abort input
Ctrl-L clear screen
Ctrl-T transpose previous character with current character
Ctrl-H, BackSpace delete character before cursor
Ctrl-W, Alt-BackSpace delete word leading up to cursor
Alt-D delete word following cursor
Ctrl-K delete from cursor to end of line
Ctrl-U delete from start of line to cursor
Ctrl-P, Up previous match from history
Ctrl-N, Down next match from history
Ctrl-R reverse search history (Ctrl-S forward, Ctrl-G cancel)
Ctrl-Y paste from yank buffer (Alt-Y to paste next yank instead)
Tab next completion
Shift-Tab (after Tab) previous completion

Vi Functions

EnableViMode(bool)      // enable or disable vi editing functionality
EnableViPrompt(bool)    // allow liner prompt to change based on current vi mode
SetViMode(vimode)       // explicitly se the vi mode (normal, insert, replace)
SetViNormalStyle(style) // style used when in vi normal mode
SetViInsertStyle(style) // style used when in vi insert mode

liner's People

Contributors

ndsizeif avatar

Watchers

 avatar

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.