Short: Next vi clone Author: Ali Gholami Rudi, Kyryl Melekhin Uploader: polluks+aminet sdf org (Stefan Haubenthal) Type: text/edit Version: 2.1 Architecture: ppc-morphos NEXTVI PATCHES ============== Optional patches for Nextvi. Apply: patch < name.patch 64bit.sh -------------- Convert entire codebase to 64 bit integers instead of 32 bit. This will enable Nextvi to read files & buffers up to 9,223,372 Terabytes. In addition, this will improve performance on 64 bit CPUs due to matching pointer <---> integer alignment and possibly more compiler optimizations. Run this after you've applied the patches. gen-widechars.sh -------------- A script I use to update zwchars and dwchars in uc.c arrowkeys_normal.patch -------------- Adds arrows keys support in normal mode. arrowkeys_insert.patch -------------- Adds arrows keys support in insert mode. threaded_search.patch -------------- Multithreaded version of lbuf_search(). Adjust the number of threads in use and buffer stepping in lbuf.c Ensure that your system supports posix threads, aka libpthread hl_part.patch -------------- Allow syntax highlight to continue past the terminal dimensions up to a certain limit. To customize the depth, adjust LEDFORW and LEDBACK definitions in led.c Patch will alter the meaning of <^> <$> assertions in syntax highlight regex, as the line would be considered to start/end beyond the visible columns. Patch works in reverse direction and with reordered text. hl_naive.patch -------------- Allow syntax highlight to continue past the terminal dimensions unlimited. Performance will degrade on very long lines. debug.patch -------------- Cleanup reachable memory upon termination. Use for debugging. Note: in some features leaks won't be freed - for example hlw (which is not enabled by default) Also initializes sdense in regex.c so that valgrind stops freaking out. grep.patch -------------- Adds a special temporary buffer /grep/ much like the default /hist/ or /fm/. When new keybind ^x is executed vi performs fs_search on every file and stores the results in /grep/ buffer. At last, user will be switched to /grep/. Line information is stored and displayed with special new syntax highlight rules. Searched keyword is also highlighted. Use the familiar keybind ^i or TAB on the wanted line to immediately open the file and goto the line specified. To quickly open /grep/ use new keybind: vx The format of the lines stored is specifically designed to mirror the output of grep -r -n "str" . The feature can be substituted with a pipe command in case of a higher performing grep implementation or loading of cached results from script. rstr.patch -------------- Adaptation from upstream Neatvi, where simple operations are optimized by running a specialized search code instead of full regex engine. rstr can yeild up to 3X faster search on non regex patterns. This is not included in base nextvi due to underlying complexity. stdin_pipe.patch -------------- Allows the user to use vi like less except you need to specify - as command line arg (just like in vim). Example: $ dmesg | vi - ec_closebuf.patch -------------- Allows the user to close the buffer using new ex command :cx Specify a number as an arg for what buffer to close. Specifying no argument(s) will close the current buffer. When the buffer is closed all buffers above will be shifted and renumbered. Range can be supplied like so :cx0-5 This will close buffers 0 to 5 inclusive Omiting the parameter of the range assumes current buffer index for that parameter (not inclusive and either begin or end of the range). Example :cx-5 or :cx5- filetype_shebang.patch -------------- Detect and set the corresponding filetype based on the shebang or specific data in the file. Currently supports only shell and python. kbd_layout.patch -------------- Changes hjkl to work well with other keyboard layouts. In this example hjkl is changed to yneo (workman keyboard layout) Note: this patch can be used as a base for remapping any base keybinds. quickexit.patch -------------- Added quickexit to insert mode keybind: kj It's important to understand that this has a caveat, if input comes too fast, for example a paste from terminal and the sequence has "kj" in it, insert mode will be cancelled mid way and paste will be wrong. Luckily this almost never happens because such letter combination is extremely rare. Delay time (in ms) can be set via :se qe=N or disabled by setting N to 0. hl_mark.patch ------------- Adds new ex option "mhl" which will highlight lbuf marks. Each mark has different color up to 16. Higher marks may duplicate the colors. Lazy redraw, use <^L> if needed. c_option.patch ------------- Adds -c commandline option. This can be used to pass in ex commands instead of EXINIT. exrc.patch ------------- Adds support for reading ~/.exrc file. This can be used to pass in ex commands instead of EXINIT. exrc-xdg.patch ------------- Adds XDG dir support for exrc.patch. readonly.patch ------------- Adds new ex option "ro" and commandline readonly option -R remove_vla_cliterals.patch -------------- Removes variable length arrays and compound literals for portability reasons. undojump.patch -------------- Adds a new keybind ^o which allows to jump through the undo marks without actually doing undo. undo_branches.patch -------------- Adds a basic multi-level undo implementation. Use the new ex command :up to print the divergent changes. Each path has an index, to switch to it use :up with a number as an argument. Example: :up1 The current undo branch is stored as the last index before swapping. alternate-w-behaviour.patch -------------- Implements more vim/like d/c/yw ac_context.patch -------------- Improvements to autocomplete, now the word completion will also use text that prefixes the insert when it makes sense. Makes it possible to autocomplete in more desired situations. linewrap.patch -------------- Soft line wrap proof of concept ex-scripting.patch -------------- Adds new commands :sc and :sx NEXTVI_FT - current buffer filetype NEXTVI_ROW - current line number NEXTVI_OFF - current byte offset NEXTVI_COFF - current character offset NEXTVI_LINE - current line NEXTVI_WORD - current word :sc runs a command with the environment variables above :sx runs a command with the environment variables above and executes its stdout as ex commands chunked_read.patch -------------- Allows nextvi to read files in chunks instead of reading the whole file into the memory right away. This patch optimizes the reading of binary files, since it would be truncated earlier before loading the whole file into memory. record_input.patch -------------- Adds ex option "rec". This option specifies a register in which to record all user input. Makes it easier to record macros. My current EXINIT setup: -------------- How it works: :led - temporarily disable redrawing the screen :ish - enable interactive shell :1io{n}^^kAn x1b - inserts macro on line 1 until x1b :1,3;0;$yaq - yank 3 lines into register q, excluding last newline :u - undo insert :inc (^(?:(?!^.git).)+[^/]+$) always exclude .git folder from :fd :pac - print autocomplete options :led - allow screen redraw Macros: @q = creates structure like this: { } @w = creates structure like this: whatever { whatever a } @e = brings :e !p $c into ex prompt Note: p is alias to printf. $c[0-9] is env var containing some path @a = creates a comment like this: /* whatever */ @s = from the cursor creates a comment like this: /* whatever */ @d = uncomment /* */ comment @x = indent % region left @f = brings :cd !p $c into ex prompt Note: p is alias to printf. $c[0-9] is env var containing some path @l = bring !cp % %_|w|!git diff --no-index %_ % macro into ex prompt. Use to create patch and diff files fast. It relies on you not saving the file prior to running the macro. @z = control character mapping placeholders export EXINIT="$(printf '%b' 'led:ish: 1io{n}kAn x1b:1,3;0;$yaq: 1iA {jo}koax1b:;0;$yaw: 1i\:e !p $cx1b:;0;$yae: 1iI/*A*/x1b:;0;$yaa: 1ii/*A*/x1b:;0;$yas: 1i//*n2x/*/n2xx1b:1,3;0;$yad: 1i>%<<$%<