aboutsummaryrefslogtreecommitdiff
path: root/main.c
AgeCommit message (Collapse)AuthorFilesLines
2017-02-08vis: make `ga` and `g8` more robustMarc André Tanner1-1/+5
Fixes CID 141179
2017-02-06Disable keymap for movement_key characterMichael Forney1-1/+6
The character following a movement_key command should not be subject to keymap translation since it is used to find characters in the document.
2017-02-04view: do not let new cursors automatically become primaryMarc André Tanner1-8/+12
We currently have the invariant that the primary cursor is always placed within the visisble viewport. Previously view_cursors_new would automatically make the new cursor primary. This in turn causes the viewport to be adjusted triggering lots of unnecessary redraws. As a result commands creating many new selections might become unbearably slow. Instead the caller has to explicitly make the new cursor primary.
2017-02-02Slight code cleanups, use buffer API where appropriateMarc André Tanner1-3/+2
2017-02-01vis: fix repetition of O when given a countMarc André Tanner1-0/+2
The cursor needs to be adjusted after every insertion, not just the first one. The implementation is currently rather ugly because it clobbers the dot register with pseudo keys.
2017-01-28vis: deindent blank autoindented lines when leaving insert modeMarc André Tanner1-2/+2
Does not work for the current implementation of `O` because the "lookbehind" i.e. second to last processed key is `<Up>` and not `<Enter>`. Fix #383
2017-01-27vis: do not set count when handling 0 motionMarc André Tanner1-1/+2
A count of zero is different than specifying no count. This fixes `0G` which previously moved to the start of the file. Fix #474
2017-01-19vis: make <C-n> in visual mode wrap aroundMarc André Tanner1-6/+13
Strictly speaking we actually not wrap around, but search backwards starting from the first cursor. This is seems more useful when for example renaming a local variable but not starting from its declaration. Close #305
2017-01-19vis: remove <C-o> mapping in insert modeMarc André Tanner1-6/+0
This was never really implemented properly and is not really needed anyway. Close #345
2017-01-18vis: support count for insertion and replacementMarc André Tanner1-2/+10
Fix #372
2016-12-26fix help text for next/prev matchErlend Fagerheim1-2/+2
2016-12-21vis: implement `gh` and `gl` to move by relative byte offsetsMarc André Tanner1-0/+12
2016-12-21vis: implement `go` to move to absolute byte positionMarc André Tanner1-0/+6
2016-12-21vis: implement g8Marc André Tanner1-4/+15
Shows hex values up to the next UTF-8 encoded character.
2016-12-20vis: improve literal insertion via <C-v> in insert modeMarc André Tanner1-21/+6
2016-12-20vis: improve gaMarc André Tanner1-9/+20
2016-12-19vis: introduce vis_register_from utility functionMarc André Tanner1-37/+17
2016-12-09Remove useless variable assignmentMarc André Tanner1-1/+0
Fixes CID 139067.
2016-12-09vis-lua: expose input key event in insert and replace modesMarc André Tanner1-0/+2
2016-12-08vis: rename some internal C function pointersMarc André Tanner1-3/+3
2016-11-28vis: move mark description into core codeMarc André Tanner1-19/+6
2016-11-27vis: cleanup signal handling codeMarc André Tanner1-4/+20
Move all signal handling code out of "library" code into user application.
2016-11-26vis: re-open /dev/tty read-writeableMarc André Tanner1-1/+1
libtermkey's initialization routine tries to write to the underlying file descriptor which fails with EBADF if it is opened read only. This was a problem in the terminal restore code called after a shell command is executed. It should fix the following: $ echo foo | vis - > bar :!/bin/sh exit where before vis would no longer accept any input.
2016-11-25vis: fix I/O redirection bugs, cleanup vis_pipeMarc André Tanner1-1/+1
The `:!` command did redirect stdout to a pipe which was used by `vis-menu` to return the selected entry. However, this breaks other interactive commands such as `:!/bin/sh` where command output was never displayed. Instead we modified `vis-menu` to re-open /dev/tty for its user interface which makes it work as a regular filter `:|` This patch also obsoletes the interactive flag previously passed to the vis_pipe function. Interactive mode is instead enabled by piping an invalid range.
2016-11-22vis-lua: introduce pre-save hookMarc André Tanner1-0/+1
The first argument is the file object while the second argument denotes the full path to which it will be written. Path might be `nil` if the file is going to be written to stdout. The Lua function is expected to return a boolean value indicating whether the write operation should proceed or be aborted.
2016-11-21vis-lua: rename file_save event to file_save_postMarc André Tanner1-1/+1
Indicating that the event is triggered *after* a successfull write.
2016-11-16sam: use default shell command for <, >, | and ! when applicapleMarc André Tanner1-0/+2
If the shell command is omitted, the last shell command (of any type) is substituted. The most recently used shell command is stored in a new register currently named `!`.
2016-11-15vis: defer UI initialization and overhaul argument parsingMarc André Tanner1-0/+64
Do not initalize curses UI before it is actually needed. Move vis command line argument parsing logic into main.c. This fixes `vis -v` output and exit status. Fix #351
2016-11-09vis: handle cancelation of `r` commandMarc André Tanner1-0/+3
Do not alter the text if <Escape> is pressed instead of a regular replacement character.
2016-11-09vis: improve `r` in normal and replace modeMarc André Tanner1-3/+20
In normal mode `r<key>` was previously implemented as `R<key><Escape>`. However this does not work when the replacement key is `<Enter>` to insert a new line, because in replace mode new lines are not overwritten. The count is now also respected. Also properly support `r` in visual mode where before it was aliased to `c`. Fix #190
2016-11-09vis: unify VIS_OP_{INSERT,REPLACE} implementationMarc André Tanner1-3/+3
They both perform a motion before changing mode.
2016-10-12Only complete up to cursor positionMarc André Tanner1-2/+4
2016-10-11File completion updatesRichard Burke1-4/+4
2016-10-03vis: improve cursor positioning after scrollingMarc André Tanner1-15/+23
Make cursor placement after scrolling (half) pages up/down less arbitrary. Close #390, fix #391
2016-10-02vis: make <C-w> delete word instead of WORDMarc André Tanner1-1/+1
Close #392
2016-09-25vis: disable language map for replacement character of `r` commandMarc André Tanner1-1/+3
The character following the `r` command in normal mode should be treated as regular input given in insert/replace mode, that is no tranformation should be applied. Temporarily disable the language map for this reason. Close #382
2016-09-25vis: move file name and word completion logic to a shell scriptMarc André Tanner1-4/+2
The shell script should be reviewed for quoting issues, currently it allows command injections as in: $ vis-complete "'; rm -f some-file; echo " However it is intended for interactive usage and from within vis it is only ever called with a valid completion prefix. The file name completion logic now supports nested directories. Close #347
2016-08-24vis: implement gJ like behaviorMarc André Tanner1-12/+15
The behavior is not exactly the same because vim preserves any existing white spaces wihle we remove existing ones but do not insert additional ones. The vim behavior (essentially only deleating new lines) can be achived using something like: :x/\n/d Close #374
2016-08-07vis: use vis-open for gf implementationMarc André Tanner1-27/+8
This has the effect that ~ and $HOME will be expanded by the shell. However it also opens files which do not yet exist. Fixes #346
2016-05-22vis: refactor status line handlingMarc André Tanner1-0/+1
Make window status bar content configurable via Lua.
2016-05-22vis: move syntax highlighting to pure Lua codeMarc André Tanner1-0/+2
2016-05-22vis: always start vis-menu with -b flagMarc André Tanner1-4/+4
2016-05-19vis: tweak completion commandsMarc André Tanner1-4/+4
Change tr command to split words, this won't properly work with Unicode but should at least avoid unwanted non-word symbols and be POSIX conformant. A possible alternative would be to use grep -o -E '\w+' while the -o option is not part of POSIX it seems to be mostly supported. However the \w regex syntax might not be supported. Force ls(1) output to be linewise and surpress the same prefix. Change sed invocation to only replace proper prefixes.
2016-05-19vis: fix behavior of complete-word on BSDMichel Martens1-2/+2
2016-05-18vis: add completion for file names in current directory via <C-x><C-f>Silvan Jegen1-0/+22
2016-05-18vis: add #define for VIS_MENUMarc André Tanner1-1/+1
2016-05-18vis: add completion for current file contents via <C-n> in insert modeMarc André Tanner1-0/+56
Based on a patch by Silvan Jegen. Close #128, close #277
2016-05-13vis: clean up key mapping implementationMarc André Tanner1-1/+1
2016-05-10Revert "vis: clean up interaction between vis and ui"Marc André Tanner1-1/+0
This caused issues on OpenBSD where it crashed the terminal. Also on Mac OS X suspend via ^Z (Ctrl-Z) was missing a \r i.e. the shell prompt was not properly redrawn. While in principle user interfaces should not have to depend on libtermkey, in practice this won't be an issue unless we are adding a non-terminal based UI (which won't happen anytime soon). This reverts commit 8f92b98848f9366e78c7aa824615bade83971513. Close #311
2016-05-08Fix autoindent when using ORichard Burke1-1/+5