aboutsummaryrefslogtreecommitdiff
path: root/vis-cmds.c
AgeCommit message (Collapse)AuthorFilesLines
2025-12-22move all standard library includes into util.hRandy Palamar1-1/+0
2025-12-05vis-lua: complete_command: utilize map_prefix() instead of grepRandy Palamar1-3/+4
we already have a function for filtering by a prefix. No need for snprintf and extra grep process for filtering. also use simpler buffer_append for appending instead of going through string formatting
2025-11-28Add command completion with tab keyMax Schillinger1-0/+9
In the command prompt, press <tab> to get a list of all available commands and pick one (using vis-menu). This works also after typing the first letters of a command (p.e. `:la<tab>`). Co-authored-by: Matěj Cepl <mcepl@cepl.eu>
2025-11-24text: remove a bunch of unused save functionsRandy Palamar1-1/+1
These functions were only used for testing the text system. One of them was moved to text-test.c to continue to facilitate this. Otherwise these functions are just cluttering up the code and making it hard to modify.
2025-01-11buffer: delete pointless buffer_init functionRandy Palamar1-4/+1
lets not make the code harder to read for no reason
2025-01-04remove duplicated read_buffer functionsRandy Palamar1-1/+1
When you take a pointer to a function in C that function is going to appear in full in the final binary. This means that there were 3 sections of the final binary with the exact same code. You could argue that in very high performance programs having that function closer to the current instruction when it is needed will give a performance boost but there are so many other places to gain more significant speed ups in vis before that would be remotely relevant. In fact, removing these allows the buffer_append call to inlined so that buffer_insert can be hopped to directly instead of including a useless hop in the middle.
2024-05-24combine Win and UiWinRandy Palamar1-12/+12
These are not seperate things and keeping them this way makes gives this convoluted mess where both Wins and UiWins must have linked lists to the other Wins and UiWins in the program despite the fact that neither of them can exist in isolation. This, like my previous cleanup commits, is part of a larger goal of properly isolating the various subsystems in vis. Doing so is required if we ever want to be able to have a vis-server and a vis-client.
2024-05-21remove some view pointer chasingRandy Palamar1-17/+17
Same as previous commit each window only has a single View. No need for it to be stored elsewhere in memory.
2024-05-21remove some ui pointer chasingRandy Palamar1-8/+7
There only exists a single Ui so there is no need to force a pointer redirection for accessing it. The Ui member was moved down in vis-core.h to punt around an issue with the way lua checks for existing objects. It may show up again as I flatten more structs.
2024-05-21replace UiTerm with Ui & delete function pointersRandy Palamar1-11/+7
2024-05-21replace UiTermWin with UiWin & remove function pointersRandy Palamar1-6/+6
2024-05-21make Selection unopaqueRandy Palamar1-1/+1
2024-05-21make View unopaqueRandy Palamar1-2/+4
2024-04-21vis-cmd: silence gcc warning & remove strlen callMatěj Cepl1-1/+2
2024-02-01allow disabling of statusbarsewn1-0/+2
2023-08-27Make expandtab option window-localAlexey Yerin1-1/+1
2023-08-27Make tabwidth option window-localAlexey Yerin1-9/+1
2023-08-26support old option names but mark as deprecatedRandy Palamar1-0/+3
This is in response to a comment left on a35e7ea. Backwards compatibility is a good idea for at least a release.
2023-08-24Lua API: access and set all available optionsRandy Palamar1-11/+13
The first point of this commit is to allow all options to be read from lua. This has a number of uses for plugin writers. They are grouped into a couple of tables depending on what they control: `vis.options`: table with global configuration `win.options`: table with window specific configuration The second point is to allow you to set all these options as if they were simply lua variables. Technically this is already possible by using `vis:command("set ...")` but personally I think this interface is cleaner. Note that this already possible for some things like the current mode (eg. vis.mode = vis.modes.VISUAL). Examples: `vis.options.ai = true` `win.options.brk = " !?."` `win.options = { showeof = true, showtabs = true } There are a number of related issues and pull requests: closes #803: Lua API: let plugins read the values of options closes #812: Window layout property supersedes/closes #717: Add ability to access tabwidth from Lua supersedes/closes #1066: expose UI layout and allow it to be set from lua API
2023-07-28view.c: add word wrappingAndrey Proskurin1-0/+9
this is contolled by the wrapcolumn/wc and breakat/brk options related #142: Word wrap and line breaks related #932: Vis for Prose? related #1092: Disabling line wrapping
2023-07-18Add fullscreen param to vis_pipe_collect() and Lua API vis:pipe()Jörg Bakker1-1/+1
This enables restoring the terminal from a fullscreen command like curses based program. Use cases are e.g. a file picker based on some external program like nnn (https://github.com/jarun/nnn).
2023-07-18fix warning about field width not being an intRandy Palamar1-4/+4
this slipped through in commit 6be370d
2023-07-17Print keybindings containing space correctlyMax Schillinger1-2/+22
Fixes #1060 - :help doesn't display mappings starting with <Space> correctly Co-authored-by: Randy Palamar <palamar@ualberta.ca>
2023-02-12Do tilde expansion only for the tilde character at the beginning of the pattern.Matěj Cepl1-1/+5
2020-11-13vis: use localtime_r(3) instead of localtime(3)Marc André Tanner1-1/+2
This makes it thread safe. While it is unlikely that we use threads in the near future, it is sensible to avoid unnecessary global state.
2020-09-19Add ignorecase optionEvan Gates1-0/+3
Add a global ignorecase boolean option. When set add REG_ICASE to cflags when calling text_regex_compile().
2020-02-10vis: omit error message when vis-menu(1) is cancelledMarc André Tanner1-1/+1
2020-01-28vis: support an optional exit status in :q and :qall commandsMarc André Tanner1-3/+3
This can for example be used to abort git commit messages with :q! 1.
2019-05-23Add layout optionKarl Schultheisz1-0/+13
This introduces a new `set` option for setting the layout to vertical or horizontal, which previously could not be done without creating a new window (via `split` or `vsplit`). Now, `set layout|lay h|v` will control this without creating a new window.
2018-05-30vis: add loadmethod optionMarc André Tanner1-0/+13
Valid values are `read`, `mmap` or `auto`.
2017-06-27Merge branch 'show-eof' of https://github.com/p-e-w/visMarc André Tanner1-0/+2
Conflicts: view.c view.h
2017-06-15vis: rename uses of Cursor to SelectionMarc André Tanner1-21/+21
2017-06-04Add option to hide EOF markerPhilipp Emanuel Weidmann1-0/+2
2017-05-06vis: add doxygen commentsMarc André Tanner1-2/+2
Rename some structures, add typedefs for function pointers, remove unused arguments from vis_run.
2017-05-03text: remove count argument from text_{earlier,later}Marc André Tanner1-4/+7
2017-03-21vis: reject invalid option namesMarc André Tanner1-0/+4
This should fix the ressource leak as found by CID 142510.
2017-03-19Move :set horizon option implementaiton to luaMarc André Tanner1-3/+0
2017-03-19Move :set theme option implementation to luaMarc André Tanner1-6/+0
2017-03-19Move :set syntax option implementation to luaMarc André Tanner1-17/+0
It is no longer possible to change the used syntax by assigning to the `win.syntax = name` field, instead the function win:set_syntax(name)` should be called. The distinction between filetype and syntax lexer to use should probably be clarified/cleaned up at some point.
2017-03-19vis: add infrastructure to dynamically add :set optionsMarc André Tanner1-25/+86
2017-03-14Add experimental raw vt100 UI backendMarc André Tanner1-0/+1
The intention of this is not to slowly reimplement curses but to provide a minimal working terminal UI backend which can also be used for debugging, fuzzing and in environments where curses is not available. Currently no attempt is made to optimize terminal output. The amount of flickering will depend on the smartness of your terminal emulator.
2017-03-02vis: remove :bdelete commandMarc André Tanner1-18/+0
It does not really fit into the style of the rest of the command language. Eventually we should be able to express this kind of thing using a looping construct based on the `X` and `Y` commands.
2017-02-27vis: allow useage of file dialog for :read commandMarc André Tanner1-0/+18
Fix #505
2017-02-24vis: make help texts optional to produce a smaller binaryMarc André Tanner1-12/+20
$ ./configure --disable-help shrinks the binary by about 20K on a x86_64 system.
2017-02-23vis: unify error path of command registration functionsMarc André Tanner1-6/+10
2017-02-08vis: fix cursor positioning after :helpMarc André Tanner1-0/+1
2017-02-05vis: add file argument to vis_pipeMarc André Tanner1-1/+2
2017-02-02vis: support rudimentary help search using :help patternMarc André Tanner1-0/+3
The argument needs to be a valid regular expression. It currently clobbers the last used search term and hence allows repeated searches using `n` and `N` respectively.
2017-01-31vis: add workaround for broken color handling in Terminal.appMarc André Tanner1-0/+3
Terminal.app sets $TERM=xterm-256color and ships a corresponding terminfo description advocating that it is capable of color changes to the 256 color palette when in fact it can not. We introduce a new boolean option "change-256colors" which is true by default but can be used to disable color changes. It is automatically set if Terminal.app is detected using $TERM_PROGRAM. This should fix display artifacts as described in #456.
2017-01-19text-regex: add regex backend based on libtreMarc André Tanner1-0/+1
While memory consumption should be improved, backward searches will still be slow, because they are implemented in terms of repeated forward searches. It needs to be investigated whether the underlying automaton can have its transitions reversed and essentially run backwards, as is the case in sam.