summaryrefslogtreecommitdiff
path: root/vis.c
AgeCommit message (Collapse)Author
2015-07-28vis: fix bugs uncovered by coverity scanMarc André Tanner
2015-07-28vis: fix join operatorMarc André Tanner
Only skip last line break if range comes from linewise visual mode.
2015-07-28vis: pass cursor to operator implementationsMarc André Tanner
2015-07-28text-object: introduce utility function text_range_is_linewiseMarc André Tanner
2015-07-28vis: use multiple cursor/selection infrastructureMarc André Tanner
This commits introduces the following keybindings, in normal mode: CTRL-N select word the cursor is currently over, switch to visual mode CTRL-P remove least recently added cursor ESC if a selection is active, clear it. Otherwise dispose all but the primary cursor. In visual mode: CTRL-N create new cursor and select next word matching current selection CTRL-X clear (skip) current selection, but select next matching word CTRL-P remove least recently added cursor
2015-07-28vis: do not move cursor in multicursor mode after undo/redoMarc André Tanner
2015-07-28vis: try to align cursors on the same column with CTRL-AMarc André Tanner
2015-07-28vis: CTRL+J and CTRL+K creates a new cursor on the line below/aboveMarc André Tanner
2015-07-28vis: ESC in normal mode clears all cursorsMarc André Tanner
2015-07-28vis: add per cursor registersMarc André Tanner
2015-07-28vis: add an operator to create new cursorsMarc André Tanner
The operator creates a new cursor at the start of every line covered by the given range. It is currently only available as CTRL+O in visual mode.
2015-07-28text: move utility functions to separate fileMarc André Tanner
2015-07-26vis: add infrastructure to support multiple cursors/selectionsMarc André Tanner
This cleans up the existing selection handling code and adds the necessary bits to eventually support multiple cursors/selections. The cursor position is kept track of using marks, which means retrieving the cursor position is no longer a constant time operation. Furthermore the terminal cursor is no longer used, instead the whole window is redrawn after every cursor movement.
2015-07-21ui: further separate curses related user interface codeMarc André Tanner
By now ui-curses.[hc] are the only files dealing directly with curses related functions. Integration of a proper mainloop is still pending.
2015-07-20vis: improve insertion of verbatim characters via CTRL-V in insert modeMarc André Tanner
Recognized formats are: CTRL-V nnn decimal value nnn CTRL-V onnn or CTRL-V Onnn octal value nnn CTRL-V xnn or CTRL-V Xnn hex value nn CTRL-V unnnn Unicode codepoint nnnn CTRL-V Unnnnnnnn Unicode codepoint nnnnnnnn Leading zeros can be omitted, any illegal character for the given format will be ignored and terminates the numerical code.
2015-07-19vis: handle file truncation more gracefullyMarc André Tanner
If we use the file / virtual memory system as cache (using mmap(2)) and another process truncates the file we are editing, we have a problem. All we can do is catch the resulting SIGBUS, close the corresponding window and print a warning message. To test this use: $ dd if=/dev/zero of=TEST bs=8M count=1 $ vis TEST :! echo TRUNCATE > TEST
2015-07-11vis: rename struct member to avoid conflict with standard libraryMarc André Tanner
Closes #60
2015-07-10vis: add a file open dialogMarc André Tanner
For this to work make sure you have vis-open and slmenu or dmenu somewhere in $PATH. For now the file dialog is shown for :open, :split and :vsplit when the argument is either . (a dot) or looks like a file pattern. For example :open *.[ch] will show a listing of all C source and header files in the current directory. Use a fuzzy search to make your choice.
2015-07-10vis: fix detection of file changes outside the editorMarc André Tanner
2015-07-09ui: move terminal state handling code to ui specific fileMarc André Tanner
2015-07-09ui: move input handling code to ui specific filesMarc André Tanner
2015-07-09vis: improve handling of linewise deletion at end of fileMarc André Tanner
dd on the last line now moves the cursor to the start of the preceding line.
2015-07-08vis: make J (join) behave like in vim when given a countMarc André Tanner
2015-07-08vis: only read file content from stdin if - was specifiedMarc André Tanner
This allows to feed keyboard input from a file as in: cat keyboard-input | vis input-file which will be used for testing purposes.
2015-07-06Warn when saving a file which has been changed outside the editorMarc André Tanner
2015-07-06text: remove text_load_fd and text_fd_getMarc André Tanner
2015-07-06Move filename from Text to FileMarc André Tanner
Also apply syntax rules every time the file name changes.
2015-07-03Add movements to next/previous character within same lineMarc André Tanner
These movements always keep the cursor on the same line and do not move over newlines.
2015-07-03Add :show command to display special symbols for whitespacesMarc André Tanner
Enable/disable by setting to 0/1 respectively: :set show spaces=0 tabs=0 newlines=1
2015-06-30Fix segfault in cmd_filterMarc André Tanner
Using FD_ISSET on negative file descriptors results in breakage. Closes #55.
2015-06-30Perform character prev/next movements based on Text not ViewMarc André Tanner
While it is slower, it allows to move to characters which are currently not visible. This will be handy when experimenting with multiple cursors.
2015-06-30Cleanup insert/replace mode input handlingMarc André Tanner
View should only display the file content, but not modify it.
2015-06-28Do not take address of variables which go out of scopeMarc André Tanner
This is a bit of a hack, since now the callers range is modified. The various cmd_* functions should probably take a const Filerange pointer as argument and modify a local Filerange variable if needed.
2015-06-28Mark intentional case statement fall throughMarc André Tanner
2015-06-27Make :earlier and :later accept arguments similar to vimMarc André Tanner
Currently the following arguments are accepted: {count} Go to older text state {count} times. {N}s Go to older text state about {N} seconds before. {N}m Go to older text state about {N} minutes before. {N}h Go to older text state about {N} hours before. {N}d Go to older text state about {N} days before
2015-06-27Hook up :-commands & keybindings for earlier/laterRyan Chipman
2015-05-17Implement :substitute by invoking sed as a filterMarc André Tanner
2015-05-17Implement :r and :r! in terms of filter commandsMarc André Tanner
2015-05-17Filter command :!Marc André Tanner
If no range is given then stdin is passed through which allows interactive usage as in :!ls -1 *.c | slmenu For this to work the command needs to use stderr for its user interface and write any data for vis to stdout.
2015-05-16Let each :-command decide what to do if no range is specifiedMarc André Tanner
2015-05-16Improve parsing of :-command name and parametersSilvan Jegen
2015-05-14In command mode make the '.' range specifier match the current lineMarc André Tanner
2015-05-07Add '--' as end of optionsMatias Linares
Now it works properly, `vis -- -v` edit a file named `-v`. Also added the proper info to the man page.
2015-05-06Use the command name without the Filerange in argvSilvan Jegen
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
2015-04-29Move redrawing out of operator implementationsMarc André Tanner
Note that currently all windows are redrawn, this could be further optimized to only redraw the affected windows.
2015-04-29Make operators return new cursor positionMarc André Tanner
2015-04-22Cleanup line ending type detection and insertionMarc André Tanner
2015-04-22Fix echo foo | vis -Marc André Tanner
A single '-' indicates read from stdin. Also adjust coding style.
2015-04-22for editor command compare string, not just first characterChristian Hesse
Signed-off-by: Christian Hesse <mail@eworm.de>
2015-04-22make vis print version with command option -vChristian Hesse
The man page states this is possible, so add the code. Signed-off-by: Christian Hesse <mail@eworm.de>