modules/vim: add more options

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-16 16:54:10 +03:00
parent a2af6eecb6
commit 5933b5142f
Signed by: pleshevskiy
GPG Key ID: 17041163DA10A9A2
1 changed files with 521 additions and 0 deletions

View File

@ -62,6 +62,42 @@ let
'';
extraHelp = [ "sidescrolloff" ];
};
showbreak = {
type = str;
vimDefault = "";
description = ''
String to put at the start of lines that have been wrapped.
Only printable single-cell characters are allowed, excluding <Tab> and
comma (in a future version the comma might be used to separate the
part that is shown at the end and at the start of a line).
'';
};
sidescrolloff = {
type = number;
vimDefault = 0;
description = ''
The minimal number of screen columns to keep to the left and to the
right of the cursor if 'nowrap' is set. Setting this option to a
value greater than 0 while having |'sidescroll'| also at a non-zero
value makes some context visible in the line you are scrolling in
horizontally (except at beginning of the line). Setting this option
to a large value (like 999) has the effect of keeping the cursor
horizontally centered in the window, as long as one does not come too
close to the beginning of the line.
'';
extraHelp = [ "nowrap" "sidescroll" "scrolloff" ];
};
statusline = {
type = str;
vimDefault = "";
description = ''
When non-empty, this option determines the content of the status line.
'';
extraHelp = [ "status-line" ];
};
};
sharedGlobalOrBuffer = with lib; with types; {
@ -1661,9 +1697,350 @@ let
"shellquote"
"shellxquote"
"shellcmdflag"
"shell-powershell"
"option-backslash"
];
};
shellcmdflag = {
type = str;
vimDefault = ''
Windows: "/s /c"
others: "-c"
'';
description = ''
Flag passed to the shell to execute "!" and ":!" commands
'';
extraHelp = [ "shell-unquoting" ];
};
shellpipe = {
type = str;
vimDefault = ''
For MS-Windows the default is "2>&1| tee". The stdout and stderr are
saved in a file and echoed to the screen.
For Unix the default is "| tee". The stdout of the compiler is saved
in a file and echoed to the screen. If the 'shell' option is "csh" or
"tcsh" after initializations, the default becomes "|& tee". If the
'shell' option is "sh", "ksh", "mksh", "pdksh", "zsh", "zsh-beta",
"bash", "fish", "ash" or "dash" the default becomes "2>&1| tee". This
means that stderr is also included.
'';
description = ''
String to be used to put the output of the ":make" command in the
error file.
When 'shellpipe' is set to an empty string, no redirection of the
":make" output will be done.
'';
extraHelp = [ "shell" ":make" ":make_makeprg" ];
};
shellquote = {
type = str;
vimDefault = "";
description = ''
Quoting character(s), put around the command passed to the shell, for
the "!" and ":!" commands. The redirection is kept outside of the
quoting. See 'shellxquote' to include the redirection. It's
probably not useful to set both options.
'';
extraHelp = [ "shellxquote" ];
};
shellredir = {
type = str;
vimDefault = ''
The default is ">". For Unix, if the 'shell' option is "csh" or
"tcsh" during initializations, the default becomes ">&". If the
'shell' option is "sh", "ksh", "mksh", "pdksh", "zsh", "zsh-beta",
"bash" or "fish", the default becomes ">%s 2>&1". This means that
stderr is also included. For Win32, the Unix checks are done and
additionally "cmd" is checked for, which makes the default ">%s 2>&1".
'';
description = ''
String to be used to put the output of a filter command in a temporary
file.
The name of the temporary file can be represented by "%s" if necessary
(the file name is appended automatically if no %s appears in the value
of this option).
'';
};
shellslash = {
type = bool;
vimDefault = false;
description = ''
{only for MS-Windows}
When set, a forward slash is used when expanding file names. This is
useful when a Unix-like shell is used instead of cmd.exe. Backward
slashes can still be typed, but they are changed to forward slashes by
Vim.
'';
};
shelltemp = {
type = bool;
vimDefault = true;
description = ''
When on, use temp files for shell commands. When off use a pipe.
When using a pipe is not possible temp files are used anyway.
The advantage of using a pipe is that nobody can read the temp file
and the 'shell' command does not need to support redirection.
The advantage of using a temp file is that the file type and encoding
can be detected.
The |FilterReadPre|, |FilterReadPost| and |FilterWritePre|,
|FilterWritePost| autocommands event are not triggered when
'shelltemp' is off.
'';
};
shellxescape = {
type = str;
vimDefault = "";
description = ''
When 'shellxquote' is set to "(" then the characters listed in this
option will be escaped with a '^' character.
'';
extraHelp = [ "shellxquote" ];
};
shellxquote = {
type = str;
vimDefault = ''
Windows: "\"
others: ""
'';
description = ''
Quoting character(s), put around the command passed to the shell, for
the "!" and ":!" commands. Includes the redirection. See
'shellquote' to exclude the redirection. It's probably not useful
to set both options.
When the value is '(' then ')' is appended. When the value is '"('
then ')"' is appended.
When the value is '(' then also see 'shellxescape'.
'';
extraHelp = [ "shellquote" "shellxescape" ];
};
shiftround = {
type = bool;
vimDefault = false;
description = ''
Round indent to multiple of 'shiftwidth'. Applies to > and <
commands. CTRL-T and CTRL-D in Insert mode always round the indent to
a multiple of 'shiftwidth' (this is Vi compatible).
'';
extraHelp = [ "shiftwidth" ];
};
shortmess = {
type = str;
vimDefault = "filnxtToOF";
description = ''
This option helps to avoid all the |hit-enter| prompts caused by file
messages, for example with CTRL-G, and to avoid some other messages.
'';
extraHelp = [ "hit-enter" "CTRL-G" ];
};
showcmd = {
type = bool;
vimDefault = true;
description = ''
Show (partial) command in the last line of the screen. Set this
option off if your terminal is slow.
In Visual mode the size of the selected area is shown:
- When selecting characters within a line, the number of characters.
If the number of bytes is different it is also displayed: "2-6"
means two characters and six bytes.
- When selecting more than one line, the number of lines.
- When selecting a block, the size in screen characters:
{lines}x{columns}.
This information can be displayed in an alternative location using the
'showcmdloc' option, useful when 'cmdheight' is 0.
'';
extraHelp = [ "showcmdloc" "cmdheight" ];
};
showcmdloc = {
type = enum [ "last" "statusline" "tabline" ];
vimDefault = "last";
description = ''
This option can be used to display the (partially) entered command in
another location.
Setting this option to "statusline" or "tabline" means that these will
be redrawn whenever the command changes, which can be on every key
pressed.
'';
extraHelp = [ "statusline" "tabline" ];
};
showfulltag = {
type = bool;
vimDefault = false;
description = ''
When completing a word in insert mode (see |ins-completion|) from the
tags file, show both the tag name and a tidied-up form of the search
pattern (if there is one) as possible matches. Thus, if you have
matched a C function, you can see a template for what arguments are
required (coding style permitting).
Note that this doesn't work well together with having "longest" in
'completeopt', because the completion from the search pattern may not
match the typed text.
'';
extraHelp = [ "ins-completion" "completeopt" ];
};
showmatch = {
type = bool;
vimDefault = false;
description = ''
When a bracket is inserted, briefly jump to the matching one. The
jump is only done if the match can be seen on the screen. The time to
show the match can be set with 'matchtime'.
A Beep is given if there is no match (no matter if the match can be
seen or not).
'';
extraHelp = [ "matchtime" ];
};
showmode = {
type = bool;
vimDefault = true;
description = ''
If in Insert, Replace or Visual mode put a message on the last line.
The option has no effect when 'cmdheight' is zero.
'';
extraHelp = [ "cmdheight" ];
};
showtabline = {
type = number;
vimDefault = 1;
description = ''
The value of this option specifies when the line with tab page labels
will be displayed:
0: never
1: only if there are at least two tab pages
2: always
This is both for the GUI and non-GUI implementation of the tab pages
line.
'';
extraHelp = [ "tab-page" ];
};
sidescroll = {
type = number;
vimDefault = 1;
description = ''
The minimal number of columns to scroll horizontally. Used only when
the 'wrap' option is off and the cursor is moved off of the screen.
When it is zero the cursor will be put in the middle of the screen.
When using a slow terminal set it to a large number or 0. Not used
for "zh" and "zl" commands.
'';
extraHelp = [ "wrap" "zh" "zl" ];
};
smartcase = {
type = bool;
vimDefault = false;
description = ''
Override the 'ignorecase' option if the search pattern contains upper
case characters. Only used when the search pattern is typed and
'ignorecase' option is on. Used for the commands "/", "?", "n", "N",
":g" and ":s". Not used for "*", "#", "gd", tag search, etc. After
"*" and "#" you can make 'smartcase' used by doing a "/" command,
recalling the search pattern from history and hitting <Enter>.
'';
extraHelp = [ "ignorecase" ];
};
smarttab = {
type = bool;
vimDefault = true;
description = ''
When on, a <Tab> in front of a line inserts blanks according to
'shiftwidth'. 'tabstop' or 'softtabstop' is used in other places. A
<BS> will delete a 'shiftwidth' worth of space at the start of the
line.
When off, a <Tab> always inserts blanks according to 'tabstop' or
'softtabstop'. 'shiftwidth' is only used for shifting text left or
right |shift-left-right|.
What gets inserted (a <Tab> or spaces) depends on the 'expandtab'
option. Also see |ins-expandtab|. When 'expandtab' is not set, the
number of spaces is minimized by using <Tab>s.
'';
extraHelp = [
"shiftwidth"
"tabstop"
"softtabstop"
"shift-left-right"
"ins-expandtab"
"expandtab"
];
};
spellsuggest = {
type = commas;
vimDefault = [ "best" ];
description = ''
Methods used for spelling suggestions. Both for the |z=| command and
the |spellsuggest()| function.
'';
};
splitbelow = {
type = bool;
vimDefault = false;
description = ''
When on, splitting a window will put the new window below the current
one. |:split|
'';
extraHelp = [ ":split" ];
};
splitkeep = {
type = enum [ "cursor" "screen" "topline" ];
vimDefault = "cursor";
description = ''
The value of this option determines the scroll behavior when opening,
closing or resizing horizontal splits.
Possible values are:
cursor Keep the same relative cursor position.
screen Keep the text on the same screen line.
topline Keep the topline the same.
'';
};
splitright = {
type = bool;
vimDefault = false;
description = ''
When on, splitting a window will put the new window right of the
current one. |:vsplit|
'';
extraHelp = [ ":vsplit" ];
};
startofline = {
type = bool;
vimDefault = false;
description = ''
When "on" the commands listed below move the cursor to the first
non-blank of the line. When off the cursor is kept in the same column
(if possible). This applies to the commands: CTRL-D, CTRL-U, CTRL-B,
CTRL-F, "G", "H", "M", "L", gg, and to the commands "d", "<<" and ">>"
with a linewise operator, with "%" with a count and to buffer changing
commands (CTRL-^, :bnext, :bNext, etc.). Also for an Ex command that
only has a line number, e.g., ":25" or ":+".
In case of buffer changing commands the cursor is placed at the column
where it was the last time the buffer was edited.
'';
};
};
window = with lib; with types; sharedGlobalOrWindow // {
@ -2126,6 +2503,51 @@ let
'';
extraHelp = [ "scroll-binding" "scrollopt" ];
};
signcolumn = {
type = str;
vimDefault = "auto";
description = ''
When and how to draw the signcolumn. Valid values are:
"auto" only when there is a sign to display
"auto:[1-9]" resize to accommodate multiple signs up to the
given number (maximum 9), e.g. "auto:4"
"auto:[1-8]-[2-9]"
resize to accommodate multiple signs up to the
given maximum number (maximum 9) while keeping
at least the given minimum (maximum 8) fixed
space. The minimum number should always be less
than the maximum number, e.g. "auto:2-5"
"no" never
"yes" always
"yes:[1-9]" always, with fixed space for signs up to the given
number (maximum 9), e.g. "yes:3"
"number" display signs in the 'number' column. If the number
column is not present, then behaves like "auto".
'';
};
spell = {
type = bool;
vimDefault = false;
description = ''
When on spell checking will be done.
The languages are specified with 'spelllang'.
'';
extraHelp = [ "spelllang" ];
};
statuscolumn = {
type = str;
vimDefault = "";
description = ''
EXPERIMENTAL
When non-empty, this option determines the content of the area to the
side of a window, normally containing the fold, sign and number columns.
The format of this option is like that of 'statusline'.
'';
extraHelp = [ "statusline" ];
};
};
buffer = with lib; with types; sharedGlobalOrBuffer // {
@ -2647,6 +3069,105 @@ let
'';
extraHelp = [ "terminal" ];
};
shiftwidth = {
type = number;
vimDefault = 8;
description = ''
Number of spaces to use for each step of (auto)indent. Used for
|'cindent'|, |>>|, |<<|, etc.
When zero the 'tabstop' value will be used.
'';
extraHelp = [
"cindent"
">>"
"<<"
"tabstop"
];
};
smartindent = {
type = bool;
vimDefault = false;
description = ''
Do smart autoindenting when starting a new line. Works for C-like
programs, but can also be used for other languages. 'cindent' does
something like this, works better in most cases, but is more strict,
see |C-indenting|. When 'cindent' is on or 'indentexpr' is set,
setting 'si' has no effect. 'indentexpr' is a more advanced
alternative.
Normally 'autoindent' should also be on when using 'smartindent'.
An indent is automatically inserted:
- After a line ending in "{".
- After a line starting with a keyword from 'cinwords'.
- Before a line starting with "}" (only with the "O" command).
'';
extraHelp = [ "cindent" "C-indenting" "indentexpr" "autoindent" ];
};
softtabstop = {
type = number;
vimDefault = 0;
description = ''
Number of spaces that a <Tab> counts for while performing editing
operations, like inserting a <Tab> or using <BS>. It "feels" like
<Tab>s are being inserted, while in fact a mix of spaces and <Tab>s is
used. This is useful to keep the 'tabstop' setting at its standard value
of 8, while being able to edit like it is set to 'softtabstop'.
'';
extraHelp = [ "tabstop" ];
};
spellcapcheck = {
type = str;
vimDefault = ''"[.?!]\_[\])'" \t]\+'';
description = ''
Pattern to locate the end of a sentence. The following word will be
checked to start with a capital letter.
Only used when 'spell' is set.
'';
extraHelp = [ "spell" ];
};
spellfile = {
type = listOf (either str path);
vimDefault = [ ];
description = ''
Name of the word list file where words are added for the |zg| and |zw|
commands. It must end in ".{encoding}.add". You need to include the
path, otherwise the file is placed in the current directory.
The path may include characters from 'isfname', space, comma and '@'.
'';
extraHelp = [ "isfname" ];
};
spellang = {
type = listOf str;
vimDefault = "en";
description = ''
The word list name must consist of alphanumeric characters, a dash or
an underscore. It should not include a comma or dot. Using a dash is
recommended to separate the two letter language name from a
specification.
'';
};
spelloptions = {
type = listOf (enum [ "camel" "noplainbuffer" ]);
vimDefault = [ ];
description = ''
list of options for spell checking:
camel When a word is CamelCased, assume "Cased" is a
separate word: every upper-case character in a word
that comes after a lower case character indicates the
start of a new word.
noplainbuffer Only spellcheck a buffer when 'syntax' is enabled,
or when extmarks are set within the buffer. Only
designated regions of the buffer are spellchecked in
this case.
'';
};
};
in
mapAttrs (_: mapAttrs mkVimOptOption) {