/Text-Editore

Implementation of a simple text editor like vim from scratch by using "piece table" data structure.

Primary LanguageJavaMIT LicenseMIT

Text-Editor

Simple text editor like vim with implementation of "piece table".

How to use?

After compiling the code if you want to open a file with text editor run the code like this:

java Main vim filename.txt

and if you want to open empty text editor run code without any parameter:

java Main

note: please run code in your terminal to have the best result

Modes

  • Command mode : default mode that get commands from user

  • Insert mode : insert user inputs into text

  • Statistics mode : show number of lines and words exist in text

  • Search Mode : show results of search

    shows line index and number of rpeats of word in that line

Write ESC to exit from each mode and goto default mode.

Commands

note : This command work only in command mode.

  • i : go to insert mode

  • R : move cursor right

  • L : move cursor left

  • 0 : move cursor to start of line

  • $ : move cursor to end of line

  • :0 : move cursor to start of file

  • :$ : move cursor to end of file

  • :[i] : move cursor to start of i'th line

    for exampe :3 moves cursor to start of 3'th line

    note: line indexes started from 0

  • :w : move cursor to start of next word

  • :w[i] : run previous command for i times

  • :b : move cursor to start of previous word

  • :b[i] : run previous command for i times

  • :D : delete chars from cursor index to end of line

  • :dd : delete line that cursor is there

  • :Y : copy chars from cursor index to end of line

  • :yy : copy line that cursor is there

  • :p : paste

  • /[word] : search word in text and show results

  • :q : quit

  • :wq : ‫‪save to file ‫‪and‬‬ ‫‪quit‬‬