aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
Commit message (Collapse)AuthorAge
...
* vim-patch:7.4.1384James McCoy2016-07-08
| | | | | | | Problem: It is not easy to use a set of plugins and their dependencies. Solution: Add packages, ":loadopt", 'packpath'. https://github.com/vim/vim/commit/f6fee0e2d4341c0c2f5339c1268e5877fafd07cf
* options: Default t_Co to 256.Justin M. Keyes2016-07-02
| | | | | | | | This commit doesn't change any behavior, only moves the init out of main.c We _could_ move some initialization from tui.c:terminfo_start to an earlier phase, in order to avoid mis-reporting 't_Co' during startup. But this will be messy, and gains very little: TERM=linux works "good enough" as long as we correct t_Co in tui.c:terminfo_start (c5b02d5a7).
* vim-patch:7.4.1716Marco Hinz2016-07-01
| | | | | | | Problem: 'autochdir' doesn't work for the first file. (Rob Hoelz) Solution: Call DO_AUTOCHDIR after startup. (Christian Brabandt) https://github.com/vim/vim/commit/baec5c1768098f9dd867b465aaabfdfb294f10c2
* timers: stop all timers on teardownBjörn Linse2016-06-01
|
* *: Rename main loop variable from loop to main_loopZyX2016-05-30
| | | | | | | | | | | | | | | | Current name is inappropriate for the following reasons: 1. It is often masked by local `loop` variables. 2. It cannot be searched for. There are many `loop` variables where `loop` is some local variable. There are many cases when “loop” word is used in a comment. 3. It is in any case bad idea to use a generic name as a name of the global variable. Best if global has module prefix: this is why it is in `main.h`: `main_loop` both stands for “a main loop” and “a loop defined in `main.*`”. Since I have no idea how to list every occurrence of this variable method used to rename it is “remove it from globals.h, try to compile, fix errors”. Thus if some occurrence was hidden under false `#if` branch it was not replaced.
* *: Make set_vim_var_\* functions have proper argument typesZyX2016-04-18
|
* defaults: Enable syntax/filetype for real.Justin M. Keyes2016-04-15
| | | | | Fixes a bug in #4252: we enabled filetype/syntax if -u was passed, but not otherwise. So it did not work for an empty or missing vimrc.
* main.c: Free msgpack packer in --api-info handler to make ASAN happyThiago de Arruda2016-04-11
|
* main: Move term:// protocol name to a macrosZyX2016-02-28
|
* main: Make using :edit term:// run TermOpen eventZyX2016-02-28
| | | | Ref #4306
* Revert "Merge pull request #4362 from justinmk/termopen"ZyX2016-02-28
| | | | | This reverts commit b01db02de4753908b3595b5ada0a6929e595e930, reversing changes made to 62321e5132ed29b11f79c8a56ca172d56b9ac042.
* term: publish TermOpen in "e term://" handler.Justin M. Keyes2016-02-23
| | | | | | | | After 87a49405b00b38b58c4c1d8fc4069d1a254a621d, terminal_open() is not nested by default. The default "term://" handler depended on that, but it should instead explicitly raise TermOpen. References #4306
* build: install *.mo into the "standard" directoryJun T2016-02-23
| | | | | | | Change POROJECT_NAME to 'nvim', and use it as the gettext domain name. The *.mo files, previously installed as $runtime/lang/xx/LC_MESSAGES/nvim.mo, are now installed as $prefix/locale/xx/LC_MESSAGES/nvim.mo.
* startup: Avoid VimL global. Introduce TriState enum.Justin M. Keyes2016-02-14
| | | | | | | - `syntax_on` is documented. Rather than introduce a new undocumented VimL global `g:syntax_off`, use a module-local flag. - Rename "maybe" functions to follow style guidelines (use standard module prefix)
* startup: respect earlier :filetype and :syntax.Felipe Morales2016-02-14
| | | | | If user invokes :filetype or :syntax before startup defaults are applied, don't clobber their choices.
* ex_docmd: rename force_enable_filetype().Justin M. Keyes2016-02-14
| | | | It is no longer forcing anything.
* syntax: don't override user settingsFelipe Morales2016-02-14
|
* syntax: avoid extra global macroJustin M. Keyes2016-02-14
|
* defaults: Enable syntax and filetype plugins.Felipe Morales2016-02-14
|
* vim-patch:7.4.689watiko2016-02-07
| | | | | | | | | | | | | | Problem: On MS-Windows, when 'autochdir' is set, diff mode with files in different directories does not work. (Axel Bender) Solution: Remember the current directory and use it where needed. (Christian Brabandt) https://github.com/vim/vim/commit/d87c36ea5eae50580f3c733734669250cc969019 --- see: "autochdir + encoding=utf8 messes up diff" https://groups.google.com/d/msg/vim_dev/QrE4Y2LMJR8/uxigns5KGxYJ
* src/*: Remove `VIM - Vi improved ...` headerMichael Reed2015-11-27
| | | | | | | | | | | | | | | | | | | Regarding the individual items in the header: `Vim - Vi improved by Bram Moolenar` Bram Moolenar is already mentioned throughout the documentation, as well as the intro screen. `:help uganda` It's already shown to all users who don't use `shortmess+=I` upon starting nvim, and is already placed prominently in help.txt, i.e., `:help` run with no arguments. `:help credits` Already mentioned near the top of help.txt. `README.md` Already mentioned in develop.txt.
* Remove unnecessary includes for errno.hRui Abreu Ferreira2015-11-25
|
* src: README.txt -> README.mdMichael Reed2015-11-23
| | | | | The former no longer exists in this repo; see the top of src/nvim/README.md.
* Merge pull request #3651 from mhinz/remove-nvimrc-refsJustin M. Keyes2015-11-11
|\ | | | | Remove all invalid nvimrc references
| * Remove all invalid nvimrc and ngvimrc referencesMarco Hinz2015-11-11
| | | | | | | | | | | | | | | | | | | | "vimrc" refers to all files that are used to configure Neovim. The main configuration file is init.vim nowadays. All nvimrc references that are left refer to a local ".nvimrc" which is read if 'exrc' is set. ".ngvimrc" references were completely wiped. Closes #3552.
* | Be more explicit about the lack of X11 integrationMichael Reed2015-11-10
|/ | | | | I don't want anyone getting the idea that the `-X` flag they might have used has anything to do with why the `+` is working for them
* Fix 'exrc' optionOvidiu Curcan2015-10-29
| | | | | `do_user_initialization()` ignored changes to the value of the `exrc` option caused by the processing of environment variables or sourcing of files.
* main: Start modeling Nvim as pushdown automatonThiago de Arruda2015-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From a very high level point of view, Vim/Nvim can be described as state machines following these instructions in a loop: - Read user input - Peform some action. The action is determined by the current state and can switch states. - Possibly display some feedback to the user. This is not immediately visible because these instructions spread across dozens of nested loops and function calls, making it very hard to modify the state machine(to support more event types, for example). So far, the approach Nvim has taken to allow more events is this: - At the very core function that blocks for input, poll for arbitrary events. - If the event received from the OS is user input, just return it normally to the callers. - If the event is not direct result of user input(possibly a vimscript function call coming from a msgpack-rpc socket or a job control callback), return a special key code(`K_EVENT`) that is handled by callers where it is safer to perform arbitrary actions. One problem with this approach is that the `K_EVENT` signal is being sent across multiple states that may be unaware of it. This was partially fixed with the `input_enable_events`/`input_disable_events` functions, which were added as a mechanism that the upper layers can use to tell the core input functions that it is ready to accept `K_EVENT`. Another problem is that the mapping engine is implemented in getchar.c which is called from every state, but the mapping engine is not aware of `K_EVENT` so events can break mappings. While it is theoretically possible to modify getchar.c to make it aware of `K_EVENT`, this commit fixes the problem with a different approach: Model Nvim as a pushdown automaton(https://en.wikipedia.org/wiki/Pushdown_automaton). This design has many advantages which include: - Decoupling the event loop from the states reponsible for handling events. - Better control of state transition with less dependency on global variable hacks(eg: 'restart_edit' global variable). - Easier removal of global variables and function splitting. That is because many variables are for state-specific information, and probably ended up being global to simplify communication between functions, which we fix by storing state-specific information in specialized structures. The final goal is to let Nvim have a single top-level event loop represented by the following pseudo-code: ``` while not quitting let event = read_event current_state(event) update_screen() ``` This closely mirrors the state machine description above and makes it easier to understand, extend and debug the program. Note that while the pseudo code suggests an explicit stack of states that doesn't rely on return addresses(as suggested by the principles of automata-based programming: https://en.wikipedia.org/wiki/Automata-based_programming), for now we'll use the call stack as a structure to manage state transitioning as it would be very difficult to refactor Nvim to use an explicit stack of states, and the benefits would be small. While this change may seem like an endless amount of work, it is possible to do it incrementally as was shown in the previous commits. The general procedure is: 1- Find a blocking `vgetc()`(or derivatives) call. This call represents an implicit state of the program. 2- Split the code before and after the `vgetc()` call into functions that match the signature of `state_check_callback` and `state_execute_callback. Only `state_execute_callback` is required. 3- Create a `VimState` "subclass" and a initializer function that sets the function pointers and performs any other required initialization steps. If the state has no local variables, just use `VimState` without subclassing. 4- Instead of calling the original function containing the `vgetc()`, initialize a stack-allocated `VimState` subclass, then call `state_enter` to begin processing events in the state. 5- The check/execute callbacks can return 1 to continue normally, 0 to break the loop or -1 to skip to the next iteration. These callbacks contain code that execute before and after the old `vgetc()` call. The functions created in step 2 may contain other `vgetc()` calls. These represent implicit sub-states of the current state, but it is fine to remove them later in smaller steps since we didn't break compatibility with existing code.
* main: Extract `normal_check` from `main_loop`Thiago de Arruda2015-10-26
| | | | | | The new function contains logic that must be executed after handling input in normal mode and also before the first main loop iteration. Also rename `main_loop` to `normal_enter` and move it to normal.c
* main: Check init.vim files also in other XDG directoriesZyX2015-10-24
|
* *: Fix linter errorsZyX2015-10-23
|
* main,version: Remove USR_EXRC_FILE*ZyX2015-10-23
|
* main,os/env: Fix lint errorsZyX2015-10-23
|
* documentation: Update documentationZyX2015-10-23
| | | | | | | Note about ~/.local/share/nvim/site used in one usr_\* file: this one talks about user-local installation of third-party plugins, and ~/.local/share/nvim/site is the proper place for them. Most other files talk about user own configuration and this is ~/.config.
* shada: Move shada file to a new locationZyX2015-10-23
|
* stdpaths,main: Remove all remaining memory leaksZyX2015-10-23
|
* stdpaths: Rename export functions so that they have common prefixZyX2015-10-23
|
* option,main: Partial support of XDG base directory specificationKeerthan Jaic2015-10-23
| | | | | | | | | | | | - Add functions that are able to query XDG. - Replace defaults for - &runtimepath. Does not follow #78. - &viewdir. - &undodir. - &directory. - &backupdir. Does not follow #78. - vimrc location. - Remove user vimrc file line from :version message.
* *: Fix lint errors found in new code in previously ignored filesZyX2015-10-08
|
* shada: Translate errors and add error codesZyX2015-10-08
| | | | | | | | | | Notes: - E136 code greatly changed its meaning: now it is write error and not read error. - E195 was removed because shada_read_everything will already do all the necessary error reporting. - E886 can be reported by both :rshada and :wshada, but :rshada comes first and AFAIR it is the only error which is not E575 and can be reported by :rshada.
* main: Silence -Wunused-result in main.c for shada_read_fileZyX2015-10-08
|
* Replace references to viminfo in various placesZyX2015-10-08
|
* main: Read marks at startupZyX2015-10-08
| | | | | I do not know why marks were not read originally, but without this change marks are not going to be read at startup when Vim starts without arguments.
* viminfo: First version of ShaDa file dumpingZyX2015-10-08
| | | | | | | | | | | | | | | | | | | | What works: 1. ShaDa file dumping: header, registers, jump list, history, search patterns, substitute strings, variables. 2. ShaDa file reading: registers, global marks, variables. Most was not tested. TODO: 1. Merging. 2. Reading history, local marks, jump and buffer lists. 3. Documentation update. 4. Converting some data from &encoding. 5. Safer variant of dumping viminfo (dump to temporary file then rename). 6. Removing old viminfo code (currently masked with `#if 0` in a ShaDa file for reference).
* encoding: don't allow changing encoding after startup scriptsBjörn Linse2015-09-08
|
* log: Make logging thread-safeThiago de Arruda2015-09-06
|
* Remove instances of TRUE/FALSE macroSteven Oliver2015-09-04
| | | | | | memory.c os_unix.c path.c
* main: Initialize event loop before command_line_scanThiago de Arruda2015-08-21
| | | | | | | | The call to `event_init()` was too late. `command_line_scan()` in `main()` could already need the loop initialized. Ref https://github.com/neovim/neovim/issues/3045#issuecomment-123405833. A consequence of this change is that it was necessary to move the `channel_from_stdio()` call to `command_line_scan()` when embedded_mode is set.
* event: Refactor async event processingThiago de Arruda2015-08-13
| | | | | | | | | | - Improve the implementation of deferred/immediate events. - Use the new queue module to change how/when events are queued/processed by giving a private queue to each emitter. - Immediate events(which only exist to break uv_run recursion) are now represented in the `loop->fast_events` queue. - Events pushed to child queues are propagated to the event loop main queue and processed as K_EVENT keys.
* Source provider at start if &cb is set #3025Marco Hinz2015-07-20
| | | | | | | | | | | | | The main problem is that <c-c> is a default mapping but also sets got_int. Because of the former, normal_cmd() is kicked off which eventually leads to sourcing the clipboard provider. But due to the latter, do_source() throws an error, because got_int is set. This is a temporary workaround and sources the clipboard provider before main_loop(), if &clipboard is set. References #3023.