mirror of
https://github.com/neovim/neovim
synced 2025-07-18 10:11:50 +00:00
fix(defaults): "syntax sync maxlines=1" on CmdwinEnter #15552
I mistakenly suggested maxlines=&cmdwinheight, forgetting that it is
calculated from topline, not cursor. maxlines=1 makes the most sense in
cmdwin.
ref #15401 622a36b1f1
This commit is contained in:
@ -1141,7 +1141,7 @@ The |getcmdwintype()| function returns the type of the command-line being
|
|||||||
edited as described in |cmdwin-char|.
|
edited as described in |cmdwin-char|.
|
||||||
|
|
||||||
Nvim defines this default CmdWinEnter autocmd in the "nvim_cmdwin" group: >
|
Nvim defines this default CmdWinEnter autocmd in the "nvim_cmdwin" group: >
|
||||||
autocmd CmdWinEnter [:>] exe 'syntax sync minlines=1 maxlines='..&cmdwinheight
|
autocmd CmdWinEnter [:>] syntax sync minlines=1 maxlines=1
|
||||||
<
|
<
|
||||||
You can disable this in your config with "autocmd! nvim_cmdwin". |default-autocmds|
|
You can disable this in your config with "autocmd! nvim_cmdwin". |default-autocmds|
|
||||||
|
|
||||||
|
@ -388,8 +388,8 @@ argument.
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
Initialization *initialization* *startup*
|
Initialization *initialization* *startup*
|
||||||
|
|
||||||
At startup, Vim checks environment variables and files and sets values
|
At startup, Nvim checks environment variables and files and sets values
|
||||||
accordingly. Vim proceeds in this order:
|
accordingly, proceeding as follows:
|
||||||
|
|
||||||
1. Set the 'shell' option *SHELL* *COMSPEC*
|
1. Set the 'shell' option *SHELL* *COMSPEC*
|
||||||
The environment variable SHELL, if it exists, is used to set the
|
The environment variable SHELL, if it exists, is used to set the
|
||||||
@ -406,9 +406,7 @@ accordingly. Vim proceeds in this order:
|
|||||||
Nvim started with |--embed| waits for the UI to connect before
|
Nvim started with |--embed| waits for the UI to connect before
|
||||||
proceeding to load user configuration.
|
proceeding to load user configuration.
|
||||||
|
|
||||||
4. Setup default mappings and autocommands.
|
4. Setup |default-mappings| and |default-autocmds|.
|
||||||
Default mappings |default-mappings| and autocommands |default-autocmds|
|
|
||||||
are created.
|
|
||||||
|
|
||||||
5. Load user config (execute Ex commands from files, environment, …).
|
5. Load user config (execute Ex commands from files, environment, …).
|
||||||
$VIMINIT environment variable is read as one Ex command line (separate
|
$VIMINIT environment variable is read as one Ex command line (separate
|
||||||
@ -501,21 +499,16 @@ accordingly. Vim proceeds in this order:
|
|||||||
9. Set 'shellpipe' and 'shellredir'
|
9. Set 'shellpipe' and 'shellredir'
|
||||||
The 'shellpipe' and 'shellredir' options are set according to the
|
The 'shellpipe' and 'shellredir' options are set according to the
|
||||||
value of the 'shell' option, unless they have been set before.
|
value of the 'shell' option, unless they have been set before.
|
||||||
This means that Vim will figure out the values of 'shellpipe' and
|
This means that Nvim will figure out the values of 'shellpipe' and
|
||||||
'shellredir' for you, unless you have set them yourself.
|
'shellredir' for you, unless you have set them yourself.
|
||||||
|
|
||||||
10. Set 'updatecount' to zero, if "-n" command argument used
|
10. Set 'updatecount' to zero, if "-n" command argument used
|
||||||
|
|
||||||
11. Set binary options
|
11. Set binary options if the |-b| flag was given.
|
||||||
If the "-b" flag was given to Vim, the options for binary editing will
|
|
||||||
be set now. See |-b|.
|
|
||||||
|
|
||||||
12. Read the ShaDa file
|
12. Read the |shada-file|.
|
||||||
See |shada-file|.
|
|
||||||
|
|
||||||
13. Read the quickfix file
|
13. Read the quickfix file if the |-q| flag was given, or exit on failure.
|
||||||
If the "-q" flag was given to Vim, the quickfix file is read. If this
|
|
||||||
fails, Vim exits.
|
|
||||||
|
|
||||||
14. Open all windows
|
14. Open all windows
|
||||||
When the |-o| flag was given, windows will be opened (but not
|
When the |-o| flag was given, windows will be opened (but not
|
||||||
@ -523,13 +516,13 @@ accordingly. Vim proceeds in this order:
|
|||||||
When the |-p| flag was given, tab pages will be created (but not
|
When the |-p| flag was given, tab pages will be created (but not
|
||||||
displayed yet).
|
displayed yet).
|
||||||
When switching screens, it happens now. Redrawing starts.
|
When switching screens, it happens now. Redrawing starts.
|
||||||
If the "-q" flag was given to Vim, the first error is jumped to.
|
If the |-q| flag was given, the first error is jumped to.
|
||||||
Buffers for all windows will be loaded, without triggering |BufAdd|
|
Buffers for all windows will be loaded, without triggering |BufAdd|
|
||||||
autocommands.
|
autocommands.
|
||||||
|
|
||||||
15. Execute startup commands
|
15. Execute startup commands
|
||||||
If a "-t" flag was given to Vim, the tag is jumped to.
|
If a |-t| flag was given, the tag is jumped to.
|
||||||
The commands given with the |-c| and |+cmd| arguments are executed.
|
Commands given with |-c| and |+cmd| are executed.
|
||||||
If the 'insertmode' option is set, Insert mode is entered.
|
If the 'insertmode' option is set, Insert mode is entered.
|
||||||
The starting flag is reset, has("vim_starting") will now return zero.
|
The starting flag is reset, has("vim_starting") will now return zero.
|
||||||
The |v:vim_did_enter| variable is set to 1.
|
The |v:vim_did_enter| variable is set to 1.
|
||||||
|
@ -90,13 +90,10 @@ Default autocommands exist in the following groups. Use ":autocmd! {group}" to
|
|||||||
remove them and ":autocmd {group}" to see how they're defined.
|
remove them and ":autocmd {group}" to see how they're defined.
|
||||||
|
|
||||||
nvim_terminal:
|
nvim_terminal:
|
||||||
- BufReadCmd: New files with a name matching
|
- BufReadCmd: Treats "term://" buffers as |terminal| buffers. |terminal-start|
|
||||||
`term://(.{-}//(\d+:)?)?\zs.*` are treated as terminal
|
|
||||||
buffers. |terminal-start|
|
|
||||||
|
|
||||||
nvim_cmdwin:
|
nvim_cmdwin:
|
||||||
- CmdWinEnter: Synchronize syntax highlighting within the command
|
- CmdwinEnter: Limits syntax sync to maxlines=1 in the |cmdwin|.
|
||||||
window.
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
3. New Features *nvim-features*
|
3. New Features *nvim-features*
|
||||||
|
@ -41,7 +41,6 @@ void init_default_autocmds(void)
|
|||||||
// open terminals when opening files that start with term://
|
// open terminals when opening files that start with term://
|
||||||
#define PROTO "term://"
|
#define PROTO "term://"
|
||||||
do_cmdline_cmd("augroup nvim_terminal");
|
do_cmdline_cmd("augroup nvim_terminal");
|
||||||
do_cmdline_cmd("autocmd!");
|
|
||||||
do_cmdline_cmd("autocmd BufReadCmd " PROTO "* ++nested "
|
do_cmdline_cmd("autocmd BufReadCmd " PROTO "* ++nested "
|
||||||
"if !exists('b:term_title')|call termopen("
|
"if !exists('b:term_title')|call termopen("
|
||||||
// Capture the command string
|
// Capture the command string
|
||||||
@ -56,7 +55,7 @@ void init_default_autocmds(void)
|
|||||||
|
|
||||||
// limit syntax synchronization in the command window
|
// limit syntax synchronization in the command window
|
||||||
do_cmdline_cmd("augroup nvim_cmdwin");
|
do_cmdline_cmd("augroup nvim_cmdwin");
|
||||||
do_cmdline_cmd("autocmd! CmdWinEnter [:>] exe 'syntax sync minlines=1 maxlines='..&cmdwinheight");
|
do_cmdline_cmd("autocmd! CmdwinEnter [:>] syntax sync minlines=1 maxlines=1");
|
||||||
do_cmdline_cmd("augroup END");
|
do_cmdline_cmd("augroup END");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user