isbadawi / badavi Goto Github PK
View Code? Open in Web Editor NEWvi-like text editor
License: MIT License
vi-like text editor
License: MIT License
e.g. paths for :e
, tags for :tag
5. Replace mode *Replace* *Replace-mode* *mode-replace*
Enter Replace mode with the "R" command in normal mode.
In Replace mode, one character in the line is deleted for every character you
type. If there is no character to delete (at the end of the line), the
typed character is appended (as in Insert mode). Thus the number of
characters in a line stays the same until you get to the end of the line.
If a <NL> is typed, a line break is inserted and no character is deleted.
Be careful with <Tab> characters. If you type a normal printing character in
its place, the number of characters is still the same, but the number of
columns will become smaller.
If you delete characters in Replace mode (with <BS>, CTRL-W, or CTRL-U), what
happens is that you delete the changes. The characters that were replaced
are restored. If you had typed past the existing text, the characters you
added are deleted. This is effectively a character-at-a-time undo.
If the 'expandtab' option is on, a <Tab> will replace one character with
several spaces. The result of this is that the number of characters in the
line increases. Backspacing will delete one space at a time. The original
character will be put back for only one space that you backspace over (the
last one). {Vi does not have the 'expandtab' option}
ctags format is not hard to parse. Can at least implement badavi -t, :tag, and the tag stack.
i.e. don't read the whole file into memory.
:help ins-completion
, :help 'complete'
Can see by running :ls
that there is always a [No Name]
buffer
Right now we support these
:set opt
: set boolean option to true, or show value of int or string option:set noopt
: set boolean option to false:set opt=val
: set string or int option to value:set opt!
: toggle boolean option:set opt?
: show value of optionAccording to :help set-option
, vim also supports these
:set
: show all options that differ from default -- done in 9ed92f1:set all
: show all options (except terminal options) -- done in 9ed92f1:set termcap
: show terminal options:set invopt
: same as :set opt!
:set opt&
: reset option value to default -- done in b97a8f8:set opt&vi
, :set opt&vim
: reset to vi default or vim default:set all&
: reset all option values to default (with a few exceptions):set opt:val
: same as :set opt=val
:set opt+=val
: increment int option, append string option. If string option is a comma separated list, adds a comma, also makes sure there's no duplicate -- done in e7e27cf:set opt^-=val
: multiply int option, prepend string option.:set opt-=val
: decrement int option, remove value from string option:set
multiple options at the same time:set
is also affected by the 'verbose'
option and can print information about where an option was last setMost of these make sense to add, except maybe :set opt&vi
, :set opt&vim
, :set termcap
(I've already fixed this, just trying out GitHub projects convert to issue feature)
Try e.g. dj
at the bottom of the file and undoing it.
Weird garbage seen on the screen and occasionally a segfault.
autoindent, smartindent, expandtab, shiftwidth, tabstop, softtabstop...
It would be nice to get useful output out of LSan in the tests, but there's a lot of noise because the tests themselves allocate things without freeing. Some leaks could maybe be suppressed (e.g. LSAN_OPTIONS=suppressions=<(echo "leak:test_*__initialize")
) but it would be better to fix.
Some structs like editor, buffer, gapbuf don't have free
functions because they stay around for the life of the program (for now), so those would have to be added.
It would be better to scroll the window down so the cursor line is centered.
Not any harder to implement than vertical splits.
Main open question is the best way to go up, down, left, right. It's easy now with a singly linked list going left to right.
From :help registers
Can't consistently reproduce, but closing a split window in a complicated layout sometimes segfault.
Need a way for modes to affect the drawing.
(Could also use this to draw the cursor in / and : modes.)
Easy to implement -- just don't want to have too much duplication with motion code.
nsf/termbox is not maintained anymore.
This fork seems interesting: https://github.com/tomas/termbox
Also came across https://github.com/nullgemm/termbox_next
Especially now with splits, horizontal scrolling is kind of lame.
badavi <file> +<line>
is also broken, not clear since when.
Both are implemented using editor_send_keys
to translate to <num>G
The window cursor is just an offset from the start of the file, so if the file changes the cursor gets stale.
There are references to termbox sprinkled throughout the code. Could imagine a struct terminal
with function pointers wrapping the termbox api.
One advantage would be that we could set up a mock terminal for testing. This would let us test the code in draw.c
, and also clean this up:
Lines 351 to 357 in 63feceb
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.