From c6a299c44605e1001c7b6dc8d86df2c31e68c5de Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Wed, 15 May 2024 22:57:59 +0300 Subject: [PATCH] modules/vim: add more options --- modules/vim/options.nix | 830 ++++++++++++++++++++++++++++++++-------- 1 file changed, 664 insertions(+), 166 deletions(-) diff --git a/modules/vim/options.nix b/modules/vim/options.nix index bf9221c..9f58858 100644 --- a/modules/vim/options.nix +++ b/modules/vim/options.nix @@ -73,6 +73,34 @@ let ''; }; + define = { + type = str; + description = '' + Pattern to be used to find a macro definition. + ''; + }; + + dictionary = { + type = listOf (either str path); + description = '' + List of file names, separated by commas, that are used to lookup words + for keyword completion commands |i_CTRL-X_CTRL-K|. Each file should + contain a list of words. This can be one word per line, or several + words per line, separated by non-keyword characters (white space is + preferred). Maximum line length is 510 bytes. + ''; + }; + + equalprg = { + type = str; + vimDefault = ""; + description = '' + External program to use for "=" command. When this option is empty + the internal formatting functions are used; either 'lisp', 'cindent' + or 'indentexpr'. + ''; + }; + formatprg = { type = str; vimDefault = ""; @@ -128,7 +156,38 @@ let This is used for `:make`, `:lmake`, `:grep`, `:lgrep`, `:grepadd`, `:lgrepadd`, `:cfile`, `:cgetfile`, `:caddfile`, `:lfile`, `:lgetfile`, and `:laddfile`. - + ''; + }; + + makeprg = { + type = str; + vimDefault = "make"; + description = '' + Program to use for the ":make" command. See |:make_makeprg|. + This option may contain '%' and '#' characters (see |:_%| and |:_#|), + which are expanded to the current and alternate file name. Use |::S| + to escape file names in case they contain special characters. + ''; + extraHelp = [ + ":mka_makeprg" + ":_%" + ":_#" + "::S" + ]; + }; + + path = { + type = commas; + vimDefault = '' + on Unix: ".,/usr/include,," + other systems: ".,," + ''; + description = '' + This is a list of directories which will be searched when using the + |gf|, [f, ]f, ^Wf, |:find|, |:sfind|, |:tabfind| and other commands, + provided that the file being searched for has a relative path (not + starting with "/", "./" or "../"). The directories in the 'path' + option may be relative or absolute. ''; }; }; @@ -140,7 +199,6 @@ let Allow CTRL-_ in Insert and Command-line mode. This is default off, to avoid that users that accidentally type CTRL-_ instead of SHIFT-_ get into reverse Insert mode, and don't know how to get out. See - ''; }; @@ -150,7 +208,6 @@ let Tells Vim what to do with characters with East Asian Width Class Ambiguous (such as Euro, Registered Sign, Copyright Sign, Greek letters, Cyrillic letters). - ''; }; @@ -163,7 +220,6 @@ let or selected. When a buffer has no name it also has no directory, thus the current directory won't change when navigating to it. Note: When this option is on some plugins may not work. - ''; }; @@ -174,7 +230,6 @@ let When on and 'termbidi' is off, the required visual character corrections that need to take place for displaying the Arabic language take effect. - ''; }; @@ -186,7 +241,6 @@ let `:suspend`, `:tag`, `:!`, `:make`, CTRL-] and CTRL-^ command; and when a `:buffer`, CTRL-O, CTRL-I, '{A-Z0-9}, or `{A-Z0-9} command takes one to another file. - ''; }; @@ -216,7 +270,6 @@ let the color scheme adjusts to the value of 'background' this will work. However, if the color scheme sets 'background' itself the effect may be undone. First delete the "g:colors_name" variable when needed. - ''; }; @@ -226,7 +279,6 @@ let Influences the working of , , CTRL-W and CTRL-U in Insert mode. This is a list of items, separated by commas. Each item allows a way to backspace over something: - ''; }; @@ -248,7 +300,6 @@ let type = listOf (either str path); description = '' List of directories for the backup file, separated with commas. - ''; }; @@ -261,7 +312,6 @@ let prefer using ".bak", but make sure that you don't have files with ".bak" that you want to keep. Only normal file name characters can be used; "/\*?[|<>" are illegal. - ''; }; @@ -275,7 +325,6 @@ let Watch out for special characters, see |option-backslash|. When $TMPDIR, $TMP or $TEMP is not defined, it is not used for the default value. "/tmp/*" is only used for Unix. - ''; }; @@ -329,7 +378,6 @@ let spell | Error happened on spell suggest. wildmode | More matches in |cmdline-completion| available | (depends on the 'wildmode' setting). - ''; }; @@ -338,7 +386,6 @@ let description = '' This option lets you choose which characters might cause a line break if 'linebreak' is on. Only works for ASCII characters. - ''; }; @@ -350,7 +397,6 @@ let buffer Use the directory of the related buffer. current Use the current directory. {path} Use the specified directory - ''; }; @@ -364,7 +410,6 @@ let used when available. - keepascii - For the ASCII characters (0x00 to 0x7f) use the US case mapping, the current locale is not effective. This probably only matters for Turkish. - ''; }; @@ -373,7 +418,6 @@ let description = '' The key used in Command-line Mode to open the command-line window. Only non-printable keys are allowed. - ''; }; @@ -384,7 +428,6 @@ let An expression that is used for character encoding conversion. It is evaluated when a file that is to be read or has been written has a different encoding from what is desired. - ''; }; @@ -392,7 +435,6 @@ let type = listOf (enum [ "unnamed" "unnamedplus" ]); description = '' This option is a list of comma-separated names. - ''; }; @@ -400,7 +442,6 @@ let type = number; description = '' Number of screen lines to use for the command-line. Helps avoiding |hit-enter| prompts. - ''; }; @@ -423,7 +464,6 @@ let ]); description = '' A comma-separated list of options for Insert mode completion |ins-completion|. - ''; }; @@ -437,7 +477,6 @@ let If 'confirm' is off you can still activate confirmation for one command only (this is most useful in mappings) with the |:confirm| command. - ''; }; @@ -450,30 +489,21 @@ let not being Vi-compatible is mostly or sometimes preferred. 'cpoptions' stands for "compatible-options". Commas can be added for readability. - ''; }; debug = { type = listOf (enum [ "msg" "throw" "beep" ]); + vimDefault = [ ]; description = '' These values can be used: - - msg Error messages that would otherwise be omitted will be given anyway. - - throw Error messages that would otherwise be omitted will be given anyway and also throw an exception and set |v:errmsg|. - - beep A message will be given when otherwise only a beep would be produced. + - msg Error messages that would otherwise be omitted will be given anyway. + - throw Error messages that would otherwise be omitted will be given anyway and also throw an exception and set |v:errmsg|. + - beep A message will be given when otherwise only a beep would be produced. The values can be combined, separated by a comma. "msg" and "throw" are useful for debugging 'foldexpr', 'formatexpr' or 'indentexpr'. - - ''; - }; - - define = { - type = str; - description = '' - Pattern to be used to find a macro definition. - ''; }; @@ -484,19 +514,6 @@ let "x" delete each combining character on its own. When it is off (the default) the character along with its combining characters are deleted. - - ''; - }; - - dictionary = { - type = listOf (either str path); - description = '' - List of file names, separated by commas, that are used to lookup words - for keyword completion commands |i_CTRL-X_CTRL-K|. Each file should - contain a list of words. This can be one word per line, or several - words per line, separated by non-keyword characters (white space is - preferred). Maximum line length is 510 bytes. - ''; }; @@ -505,7 +522,6 @@ let description = '' Expression which is evaluated to obtain a diff file (either ed-style or unified-style) from two versions of a file. - ''; extraHelp = [ "diff-diffexpr" ]; }; @@ -514,7 +530,6 @@ let type = listOf str; description = '' Option settings for diff mode. - ''; }; @@ -522,7 +537,6 @@ let type = bool; description = '' Enable the entering of digraphs in Insert mode with {char1} {char2}. - ''; extraHelp = [ "digraphs" ]; }; @@ -531,7 +545,6 @@ let type = listOf (either str path); description = '' List of directory names for the swap file, separated with commas. - ''; }; @@ -539,7 +552,6 @@ let type = listOf (enum [ "lastline" "truncate" "uhex" "msgsep" ]); description = '' Change the way text is displayed. - ''; }; @@ -547,7 +559,6 @@ let type = (enum [ "ver" "hor" "both" ]); description = '' Tells when the 'equalalways' option applies: - ''; }; @@ -557,7 +568,6 @@ let When on all Unicode emoji characters are considered to be full width. This excludes "text emoji" characters, which are normally displayed as single width. - ''; }; @@ -568,17 +578,6 @@ let splitting or closing a window. This also happens the moment the option is switched on. When off, splitting a window will reduce the size of the current window and leave the other windows the same. - - ''; - }; - - equalprg = { - type = str; - description = '' - External program to use for "=" command. When this option is empty - the internal formatting functions are used; either 'lisp', 'cindent' - or 'indentexpr'. - ''; }; @@ -589,7 +588,6 @@ let Ring the bell (beep or screen flash) for error messages. This only makes a difference for error messages, the bell will be used always for a lot of errors without a message - ''; }; @@ -598,7 +596,6 @@ let vimDefault = "errors.err"; description = '' Name of the errorfile for the QuickFix mode. - ''; extraHelp = [ "cf" ]; }; @@ -607,7 +604,6 @@ let type = str; description = '' Scanf-like description of the format for the lines in the error file - ''; }; @@ -618,7 +614,6 @@ let A list of autocommand event names, which are to be ignored. When set to "all" or when "all" is one of the items, all autocommand events are ignored, autocommands will not be executed. - ''; }; @@ -629,18 +624,16 @@ let Automatically execute .nvim.lua, .nvimrc, and .exrc files in the current directory, if the file is in the |trust| list. Use |:trust| to manage trusted files. - ''; extraHelp = [ ":trust" ]; }; fileencodings = { type = listOf str; - vimDefault = ''["ucs-bom" "utf-8" "default" "latin1"]''; + vimDefault = [ "ucs-bom" "utf-8" "default" "latin1" ]; description = '' This is a list of character encodings considered when starting to edit an existing file. - ''; }; @@ -654,7 +647,6 @@ let This gives the end-of-line () formats that will be tried when starting to edit a new buffer and when reading a file into an existing buffer - ''; }; @@ -665,7 +657,6 @@ let ''; description = '' When set case is ignored when using file names and directories. - ''; }; @@ -676,7 +667,6 @@ let When set to "all", a fold is closed when the cursor isn't in it and its level is higher than 'foldlevel'. Useful if you want folds to automatically close when moving out of them. - ''; }; @@ -689,7 +679,6 @@ let some folds closed (one) or no folds closed (99). When the value is negative, it is not used. - ''; extraHelp = [ "foldlevel" ]; }; @@ -724,7 +713,6 @@ let Specifies for which type of commands folds will be opened, if the command moves the cursor into a closed fold. It is a comma-separated list of items. - ''; }; @@ -737,7 +725,6 @@ let This flushes the file to disk, ensuring that it is safely written. Slow on some systems: writing buffers, quitting Nvim, and other operations may sometimes take a few seconds. - ''; }; @@ -749,7 +736,6 @@ let all matches in a line are substituted instead of one. When a 'g' flag is given to a ":substitute" command, this will toggle the substitution of all or one match. See |complex-change|. - ''; }; @@ -758,7 +744,6 @@ let vimDefault = ''%f:%l:%m,%f:%l%m,%f %l%m''; description = '' Format to recognize for the ":grep" command output. - ''; extraHelp = [ "errorformat" ]; }; @@ -771,7 +756,6 @@ let terminals. See |tui-cursor-shape|. To disable cursor-styling, reset the option - ''; }; @@ -784,7 +768,6 @@ let the font cannot be found you will get an error message. To try other font names a list can be specified, font names separated with commas. The first valid font is used. - ''; }; @@ -794,7 +777,6 @@ let description = '' list of fonts to be used for double-width characters. The first font that can be loaded is used. - ''; }; @@ -805,7 +787,6 @@ let This option only has an effect in the GUI version of Vim. It is a sequence of letters which describes what components and options of the GUI should be used. - ''; }; @@ -816,7 +797,6 @@ let When non-empty describes the text to use in a label of the GUI tab pages line. When empty and when the result is empty Vim will use a default label. - ''; extraHelp = [ "setting-guitablabel" ]; }; @@ -827,7 +807,6 @@ let description = '' When non-empty describes the text to use in a tooltip for the GUI tab pages line. When empty Vim will use a default tooltip. - ''; }; @@ -836,7 +815,6 @@ let vimDefault = '' default (MS-Windows) "$VIMRUNTIME\doc\help.txt" (others) "$VIMRUNTIME/doc/help.txt" - ''; }; @@ -845,7 +823,6 @@ let vimDefault = 20; description = '' Minimal initial height of the help window when it is opened with the ":help" command. - ''; }; @@ -855,7 +832,6 @@ let description = '' list of languages. Vim will use the first language for which the desired help can be found. - ''; }; @@ -867,7 +843,6 @@ let when it is abandoned. When on a buffer becomes hidden when it is abandoned. A buffer displayed in another window does not become hidden, of course. - ''; extraHelp = [ "abadon" @@ -884,7 +859,6 @@ let each of these histories The maximum is 10000. - ''; extraHelp = [ "cmdline-editing" ]; }; @@ -894,7 +868,6 @@ let vimDefault = true; description = '' When there is a previous search pattern, highlight all its matches. - ''; extraHelp = [ "incsearch" @@ -911,7 +884,6 @@ let currently being edited. Only the last part of the name is used. Overridden by the 'iconstr' option. Only works if the terminal supports setting window icons. - ''; extraHelp = [ "iconstring" ]; }; @@ -921,7 +893,6 @@ let vimDefault = ""; description = '' When this option is not empty, it will be used for the icon text of the window. - ''; }; @@ -932,7 +903,6 @@ let Ignore case in search patterns. Also used when searching in the tags file. Also see 'smartcase' and 'tagcase'. - ''; }; @@ -942,7 +912,6 @@ let description = '' When set the Input Method is always on when starting to edit a command line, unless entering a search pattern. - ''; extraHelp = [ "imsearch" ]; }; @@ -956,7 +925,6 @@ let description = '' When set the Input Method is never used. This is useful to disable the IM when it doesn't work properly. - ''; }; @@ -967,7 +935,6 @@ let When nonempty, shows the effects of |:substitute|, |:smagic|, |:snomagic| and user commands with the |:command-preview| flag as you type. - ''; }; @@ -978,7 +945,6 @@ let While typing a search command, show where the pattern, as it was typed so far, matches. The matched str is highlighted. If the pattern is invalid or not found, nothing is shown. - ''; }; @@ -1000,7 +966,6 @@ let The characters given by this option are included in identifiers. Identifiers are used in recognizing environment variables and after a match of the 'define' option. - ''; }; @@ -1010,7 +975,6 @@ let description = '' The characters given by this option are displayed directly on the screen. It is also used for "\p" in a |pattern|. - ''; extraHelp = [ "pattern" ]; }; @@ -1020,7 +984,6 @@ let vimDefault = ""; description = '' List of words that change the behavior of the |jumplist| - ''; extraHelp = [ "jumplist" ]; }; @@ -1031,7 +994,6 @@ let description = '' Insert two spaces after a '.', '?' and '!' with a join command. Otherwise only one space is inserted. - ''; }; @@ -1040,7 +1002,6 @@ let vimDefault = [ ]; description = '' List of comma-separated words, which enable special things that keys can do. - ''; }; @@ -1054,7 +1015,6 @@ let care of translating these special characters to the original meaning of the key. This means you don't have to change the keyboard mode to be able to execute Normal mode commands. - ''; }; @@ -1063,7 +1023,6 @@ let vimDefault = ""; description = '' Language to use for menu translation. - ''; }; @@ -1074,7 +1033,6 @@ let When off, setting 'langmap' does not apply to characters resulting from a mapping. If setting 'langmap' disables some of your mappings, make sure this option is off. - ''; }; @@ -1088,7 +1046,6 @@ let - 1: only if there are at least two windows - 2: always - 3: always and ONLY the last window - ''; }; @@ -1100,7 +1057,6 @@ let executing macros, registers and other commands that have not been typed. Also, updating the window title is postponed. To force an update use |:redraw|. - ''; extraHelp = [ ":redraw" ]; }; @@ -1112,7 +1068,6 @@ let Number of pixel lines inserted between characters. Useful if the font uses the full character cell height, making lines touch each other. When non-zero there is room for underlining. - ''; }; @@ -1123,7 +1078,6 @@ let When on the plugin scripts are loaded when starting up |load-plugins|. This option can be reset in your |vimrc| file to disable the loading of plugins. - ''; }; @@ -1135,7 +1089,6 @@ let See |pattern|. WARNING: Switching this option off most likely breaks plugins! That is because many patterns assume it's on and will fail when it's off. - ''; }; @@ -1148,9 +1101,391 @@ let When it is empty, an internally generated temp file will be used. When "##" is included, it is replaced by a number to make the name unique. - ''; }; + + matchtime = { + type = number; + vimDefault = 5; + description = '' + Tenths of a second to show the matching paren, when 'showmatch' is + set. Note that this is not in milliseconds, like other options that + set a time. This is to be compatible with Nvi. + ''; + }; + + maxfuncdepth = { + type = number; + vimDefault = 100; + description = '' + Maximum depth of function calls for user functions. This normally + catches endless recursion. When using a recursive function with + more depth, set 'maxfuncdepth' to a bigger number. But this will use + more memory, there is the danger of failing when memory is exhausted. + Increasing this limit above 200 also changes the maximum for Ex + command recursion, see |E169|. + ''; + extraHelp = [ + "E169" + ":function" + ]; + }; + + maxmapdepth = { + type = number; + vimDefault = 1000; + description = '' + Maximum number of times a mapping is done without resulting in a + character to be used. This normally catches endless mappings, like + ":map x y" with ":map y x". It still does not catch ":map g wg" + ''; + extraHelp = [ "key-mapping" ]; + }; + + maxmempattern = { + type = number; + vimDefault = 1000; + description = '' + Maximum amount of memory (in Kbyte) to use for pattern matching. + The maximum value is about 2000000. Use this to work without a limit. + ''; + extraHelp = [ "E363" ]; + }; + + menuitems = { + type = number; + vimDefault = 25; + description = '' + Maximum number of items to use in a menu. Used for menus that are + generated from a list of items, e.g., the Buffers menu. Changing this + option has no direct effect, the menu must be refreshed first. + ''; + }; + + mkspellmem = { + type = str; + vimDefault = "46000,2000,500"; + description = '' + Parameters for |:mkspell|. This tunes when to start compressing the + word tree. Compression can be slow when there are many words, but + it's needed to avoid running out of memory. The amount of memory used + per word depends very much on how similar the words are, that's why + this tuning is complicated. + + There are three numbers, separated by commas: + {start},{inc},{added} + ''; + extraHelp = [ ":mkspell" ]; + }; + + modelineexpr = { + type = bool; + vimDefault = false; + description = '' + When on allow some options that are an expression to be set in the + modeline. + ''; + extraHelp = [ "modeline" ]; + }; + + modelines = { + type = number; + vimDefault = 5; + description = '' + If 'modeline' is on 'modelines' gives the number of lines that is + checked for set commands. + ''; + extraHelp = [ "modeline" ]; + }; + + more = { + type = bool; + vimDefault = true; + description = '' + When on, listings pause when the whole screen is filled. You will get + the |more-prompt|. When this option is off there are no pauses, the + listing continues until finished. + ''; + extraHelp = [ "more-prompt" ]; + }; + + mouse = { + type = str; + vimDefault = "nvi"; + description = '' + Enables mouse support. + + Mouse support can be enabled for different modes: + n Normal mode + v Visual mode + i Insert mode + c Command-line mode + h all previous modes when editing a help file + a all previous modes + r for |hit-enter| and |more-prompt| prompt + ''; + }; + + mousefocus = { + type = bool; + vimDefault = false; + description = '' + The window that the mouse pointer is on is automatically activated. + When changing the window layout or window focus in another way, the + mouse pointer is moved to the window with keyboard focus. Off is the + default because it makes using the pull down menus a little goofy, as + a pointer transit may activate a window unintentionally. + ''; + }; + + mousehide = { + type = bool; + vimDefault = true; + description = '' + When on, the mouse pointer is hidden when characters are typed. + The mouse pointer is restored when the mouse is moved. + ''; + }; + + mousemodel = { + type = enum [ "extend" "popup" "popup_setpos" ]; + vimDefault = "popup_setpos"; + description = '' + Sets the model to use for the mouse. The name mostly specifies what + the right mouse button is used for: + + extend Right mouse button extends a selection. This works + like in an xterm. + popup Right mouse button pops up a menu. The shifted left + mouse button extends a selection. This works like + with Microsoft Windows. + popup_setpos Like "popup", but the cursor will be moved to the + position where the mouse was clicked, and thus the + selected operation will act upon the clicked object. + If clicking inside a selection, that selection will + be acted upon, i.e. no cursor move. This implies of + course, that right clicking outside a selection will + end Visual mode. + ''; + }; + + mousemoveevent = { + type = bool; + vimDefault = false; + description = '' + When on, mouse move events are delivered to the input queue and are + available for mapping. The default, off, avoids the mouse movement + overhead except when needed. + + Warning: Setting this option can make pending mappings to be aborted + when the mouse is moved. + ''; + }; + + mousescroll = { + type = commas; + vimDefault = [ "ver:3" "hor:6" ]; + description = '' + This option controls the number of lines / columns to scroll by when + scrolling with a mouse. The option is a comma separated list of parts. + Each part consists of a direction and a count as follows: + direction:count,direction:count + ''; + }; + + mouseshape = { + type = commas; + vimDefault = [ "i:beam" "r:beam" "s:updown" "sd:cross" "m:no" "ml:up-arrow" "v:rightup-arrow" ]; + description = '' + This option tells Vim what the mouse pointer should look like in + different modes. The option is a comma-separated list of parts, much + like used for 'guicursor'. Each part consist of a mode/location-list + and an argument-list: + mode-list:shape,mode-list:shape,.. + ''; + }; + + mousetime = { + type = number; + vimDefault = 500; + description = '' + Defines the maximum time in msec between two mouse clicks for the + second click to be recognized as a multi click. + ''; + }; + + operatorfunc = { + type = str; + vimDefault = ""; + description = '' + his option specifies a function to be called by the |g@| operator. + ''; + extraHelp = [ "g@" ":map-operator" ]; + }; + + # TODO: packpath + + paragraphs = { + type = str; + vimDefault = "IPLPPPQPP TPHPLIPpLpItpplpipbp"; + description = '' + Specifies the nroff macros that separate paragraphs. These are pairs + of two letters. + ''; + extraHelp = [ "object-motions" ]; + }; + + patchexpr = { + type = str; + vimDefault = ""; + description = '' + Expression which is evaluated to apply a patch to a file and generate + the resulting new version of the file. + ''; + extraHelp = [ "diff-patchexpr" ]; + }; + + patchmode = { + type = str; + vimDefault = ""; + description = '' + When non-empty the oldest version of a file is kept. This can be used + to keep the original version of a file if you are changing files in a + source distribution. Only the first time that a file is written a + copy of the original file will be kept. The name of the copy is the + name of the original file with the string in the 'patchmode' option + appended. This option should start with a dot. Use a string like + ".orig" or ".org". 'backupdir' must not be empty for this to work + (Detail: The backup file is renamed to the patchmode file after the + new file has been successfully written, that's why it must be possible + to write a backup file). If there was no file to be backed up, an + empty file is created. + ''; + extraHelp = [ "backupdir" "backupskip" ]; + }; + + previewheight = { + type = number; + vimDefault = 12; + description = '' + Default height for a preview window. Used for |:ptag| and associated + commands. Used for |CTRL-W_}| when no count is given. + ''; + extraHelp = [ ":ptag" "CTRL-W_}" ]; + }; + + pumblend = { + type = number; + vimDefault = 0; + description = '' + Enables pseudo-transparency for the |popup-menu|. Valid values are in + the range of 0 for fully opaque popupmenu (disabled) to 100 for fully + transparent background. Values between 0-30 are typically most useful. + ''; + extraHelp = [ "popup-menu" "highlight-blend" ]; + }; + + pumheight = { + type = number; + vimDefault = 0; + description = '' + Maximum number of items to show in the popup menu + (|ins-completion-menu|). Zero means "use available screen space". + ''; + extraHelp = [ "ins-completion-menu" ]; + }; + + pumwidth = { + type = number; + vimDefault = 15; + description = '' + Minimum width for the popup menu (|ins-completion-menu|). If the + cursor column + 'pumwidth' exceeds screen width, the popup menu is + nudged to fit on the screen. + ''; + extraHelp = [ "ins-completion-menu" ]; + }; + + pyxversion = { + type = number; + vimDefault = 3; + description = '' + Specifies the python version used for pyx* functions and commands + |python_x|. As only Python 3 is supported, this always has the value + `3`. Setting any other value is an error. + ''; + extraHelp = [ "python_x" ]; + }; + + quickfixtextfunc = { + type = str; + vimDefault = ""; + description = '' + This option specifies a function to be used to get the text to display + in the quickfix and location list windows. This can be used to + customize the information displayed in the quickfix or location window + for each entry in the corresponding quickfix or location list. + ''; + extraHelp = [ "quickfix-window-function" ]; + }; + + redrawdebug = { + type = listOf (enum [ "compositor" "line" "flush" "nothrottle" "invalid" "nodelta" ]); + vimDefault = [ ]; + description = '' + Flags to change the way redrawing works, for debugging purposes. + Most useful with 'writedelay' set to some reasonable value. + ''; + extraHelp = [ "writedelay" ]; + }; + + redrawtime = { + type = number; + vimDefault = 2000; + description = '' + Time in milliseconds for redrawing the display. Applies to + 'hlsearch', 'inccommand', |:match| highlighting and syntax + highlighting. + When redrawing takes more than this many milliseconds no further + matches will be highlighted. + ''; + }; + + regexpengine = { + type = number; + vimDefault = 0; + description = '' + This selects the default regexp engine. + The possible values are: + 0 automatic selection + 1 old engine + 2 NFA engine + ''; + extraHelp = [ "two-engines" ]; + }; + + report = { + type = number; + vimDefault = 2; + description = '' + Threshold for reporting number of lines changed. When the number of + changed lines is more than 'report' a message will be given for most + ":" commands. If you want it always, set 'report' to 0. + For the ":substitute" command the number of substitutions is used + instead of the number of lines. + ''; + }; + + revins = { + type = bool; + vimDefault = false; + description = '' + Inserting characters in Insert mode will work backwards. See "typing + backwards" |ins-reverse|. This option can be toggled with the CTRL-_ + command in Insert mode, when 'allowrevins' is set. + ''; + extraHelp = [ "ins-reserve" "allowrevins" ]; + }; }; window = with lib; with types; sharedGlobalOrWindow // { @@ -1159,7 +1494,6 @@ let vimDefault = false; description = '' This option can be set to start editing Arabic text. - ''; }; @@ -1170,7 +1504,6 @@ let Every wrapped line will continue visually indented (same amount of space as the beginning of that line), thus preserving horizontal blocks of text. - ''; }; @@ -1179,7 +1512,6 @@ let vimDefault = [ ]; description = '' Settings for 'breakindent - ''; }; @@ -1190,7 +1522,6 @@ let 'colorcolumn' is a comma-separated list of screen columns that are highlighted with ColorColumn |hl-ColorColumn|. Useful to align text. Will make screen redrawing slower. - ''; }; @@ -1199,7 +1530,6 @@ let vimDefault = ""; description = '' Sets the modes in which text in the cursor line can also be concealed. - ''; }; @@ -1209,7 +1539,6 @@ let description = '' Determine how text with the "conceal" syntax attribute |:syn-conceal| is shown - ''; extraHelp = [ "syn-conceal" ]; }; @@ -1221,11 +1550,54 @@ let When this option is set, as the cursor in the current window moves other cursorbound windows (windows that also have this option set) move their cursors to the corresponding line and - column. - + column. This option is useful for viewing the + differences between two versions of a file (see 'diff'); in diff mode, + inserted and deleted lines (though not characters within a line) are + taken into account. ''; }; + cursorcolumn = { + type = bool; + vimDefault = false; + description = '' + Highlight the screen column of the cursor with CursorColumn + |hl-CursorColumn|. Useful to align text. Will make screen redrawing + slower. + ''; + extraHelp = [ "hl-CursorColumn" ]; + }; + + cursorline = { + type = bool; + vimDefault = false; + description = '' + Highlight the text line of the cursor with CursorLine |hl-CursorLine|. + Useful to easily spot the cursor. Will make screen redrawing slower. + When Visual mode is active the highlighting isn't used to make it + easier to see the selected text. + ''; + extraHelp = [ "hl-CursorLine" ]; + }; + + cursorlineopt = { + type = listOf (enum [ "line" "screenline" "number" "both" ]); + vimDefault = [ "number" "line" ]; + description = '' + list of settings for how 'cursorline' is displayed. + ''; + }; + + diff = { + type = bool; + vimDefault = false; + description = '' + Join the current window in the group of windows that shows differences + between files. + ''; + extraHelp = [ "diff-mode" ]; + }; + foldcolumn = { type = str; vimDefault = "0"; @@ -1235,7 +1607,6 @@ let "auto:[1-9]": resize to accommodate multiple folds up to the selected level "0": to disable foldcolumn "[1-9]": to display a fixed number of columns - ''; extraHelp = [ "folding" ]; }; @@ -1249,7 +1620,6 @@ let folds (including manually opened or closed folds). It can be toggled with the |zi| command. The 'foldcolumn' will remain blank when 'foldenable' is off. - ''; extraHelp = [ "folding" ]; }; @@ -1260,7 +1630,6 @@ let description = '' The expression used for when 'foldmethod' is "expr". It is evaluated for each line to obtain its fold level. - ''; extraHelp = [ "fold-expr" ]; }; @@ -1272,7 +1641,6 @@ let Used only when 'foldmethod' is "indent". Lines starting with characters in 'foldignore' will get their fold level from surrounding lines. White space is skipped before checking for this character. - ''; extraHelp = [ "fold-indent" ]; }; @@ -1285,7 +1653,6 @@ let Setting this option to zero will close all folds. Higher numbers will close fewer folds. This option is set by commands like |zm|, |zM| and |zR|. - ''; extraHelp = [ "fold-foldlevel" ]; }; @@ -1293,10 +1660,9 @@ let foldmarker = { type = listOf str; apply = x: assert (x == null || builtins.length x == 2 || abort "`foldmarker` must contain start and end markers in the list"); x; - vimDefault = ''["{{{" "}}}"]''; + vimDefault = [ "{{{" "}}}" ]; description = '' The start and end marker used when 'foldmethod' is "marker". - ''; }; @@ -1322,7 +1688,6 @@ let description = '' Sets the number of screen lines above which a fold can be displayed closed. Also for manually closed folds. - ''; }; @@ -1333,7 +1698,6 @@ let Sets the maximum nesting of folds for the "indent" and "syntax" methods. This avoids that too many folds will be created. Using more than 20 doesn't work, because the internal limit is 20. - ''; }; @@ -1342,7 +1706,6 @@ let vimDefault = "foldtext()"; description = '' An expression which is used to specify the text displayed for a closed fold. - ''; extraHelp = [ "fold-foldtext" ]; }; @@ -1355,7 +1718,6 @@ let than at the last character that fits on the screen. Unlike 'wrapmargin' and 'textwidth', this does not insert s in the file, it only affects the way the file is displayed, not its contents. - ''; }; @@ -1367,7 +1729,6 @@ let non-breakable space characters as "+". Useful to see the difference between tabs and spaces and for trailing blanks. Further changed by the 'listchars' option. - ''; extraHelp = [ "listchars" ]; }; @@ -1428,7 +1789,6 @@ let Character to show for leading spaces. When omitted, leading spaces are blank. Overrides the "space" and "multispace" settings for leading spaces. - ''; }; @@ -1481,6 +1841,57 @@ let }); }; }; + + number = { + type = bool; + vimDefault = false; + description = '' + Print the line number in front of each line. When the 'n' option is + excluded from 'cpoptions' a wrapped line will not use the column of + line numbers. + Use the 'numberwidth' option to adjust the room for the line number. + When a long, wrapped line doesn't start with the first character, '-' + characters are put before the number. + For highlighting see |hl-LineNr|, |hl-CursorLineNr|, and the + |:sign-define| "numhl" argument. + The 'relativenumber' option changes the displayed number to be + relative to the cursor. Together with 'number' there are these + four combinations (cursor in line 3): + ''; + extraHelp = [ + "cpoptions" + "relativenumber" + "hl-LineNr" + "hl-CursorLineNr" + ]; + }; + + numberwidth = { + type = number; + vimDefault = 4; + description = '' + Minimal number of columns to use for the line number. Only relevant + when the 'number' or 'relativenumber' option is set or printing lines + with a line number. Since one space is always between the number and + the text, there is one less character for the number itself. + The value is the minimum width. + + The minimum value is 1, the maximum value is 20. + ''; + extraHelp = [ "number" "relativenumber" ]; + }; + + relativenumber = { + type = bool; + vimDefault = false; + description = '' + Show the line number relative to the line with the cursor in front of + each line. Relative line numbers help you use the |count| you can + precede some vertical motion commands (e.g. j k + -) with, without + having to calculate it yourself. Especially useful in combination with + other commands (e.g. y d c < > gq gw =). + ''; + }; }; buffer = with lib; with types; sharedGlobalOrBuffer // { @@ -1492,7 +1903,6 @@ let in Insert mode or when using the "o" or "O" command). If you do not type anything on the new line except or CTRL-D and then type , CTRL-O or , the indent is deleted again. - ''; }; @@ -1515,7 +1925,6 @@ let - the 'binary' option is off - 'fileencoding' is "utf-8", "ucs-2", "ucs-4" or one of the little/big endian variants. - ''; }; @@ -1525,7 +1934,6 @@ let description = '' This option specifies what happens when a buffer is no longer displayed in a window - ''; }; @@ -1534,7 +1942,6 @@ let vimDefault = true; description = '' When this option is set, the buffer shows up in the buffer list. - ''; }; @@ -1544,7 +1951,6 @@ let description = '' This option is used together with 'bufhidden' and 'swapfile' to specify special kinds of buffers. - ''; extraHelp = [ "special-buffers" ]; }; @@ -1554,7 +1960,6 @@ let vimDefault = false; description = '' Enables automatic C program indenting. - ''; }; @@ -1564,7 +1969,6 @@ let description = '' A list of keys that, when typed in Insert mode, cause reindenting of the current line. - ''; }; @@ -1580,23 +1984,21 @@ let cinwords = { type = commas; - vimDefault = ''["if" "else" "while" "do" "for" "switch"]''; + vimDefault = [ "if" "else" "while" "do" "for" "switch" ]; descrpition = '' These keywords start an extra indent in the next line when 'smartindent' or 'cindent' is set. For 'cindent' this is only done at an appropriate place (inside {}). - ''; }; cinscopedecls = { type = commas; - vimDefault = ''["public" "protected" "private"]''; + vimDefault = [ "public" "protected" "private" ]; descrpition = '' Keywords that are interpreted as a C++ scope declaration by |cino-g|. Useful e.g. for working with the Qt framework that defines additional scope declarations "signals", "public slots" and "private slots" - ''; }; @@ -1617,7 +2019,6 @@ let ''; description = '' list of strs that can start a comment line. - ''; extraHelp = [ "format-comments" ]; }; @@ -1629,18 +2030,16 @@ let A template for a comment. The "%s" in the value is replaced with the comment text. Currently only used to add markers for folding, see |fold-marker|. - ''; extraHelp = [ "fold-marker" ]; }; complete = { type = commas; - vimDefault = ''["." "w" "b" "u" "t"]''; + vimDefault = [ "." "w" "b" "u" "t" ]; description = '' This option specifies how keyword completion |ins-completion| works when CTRL-P or CTRL-N are used. - ''; extraHelp = [ "ins-completion" ]; }; @@ -1651,7 +2050,6 @@ let description = '' This option specifies a function to be used for Insert mode completion with CTRL-X CTRL-U. - ''; extraHelp = [ "complete-functions" @@ -1669,7 +2067,6 @@ let in which case only spaces are used). Enabling this option makes the new line copy whatever characters were used for indenting on the existing line. - ''; extraHelp = [ "expandtab" @@ -1677,6 +2074,19 @@ let ]; }; + endofline = { + type = bool; + vimDefault = true; + description = '' + When writing a file and this option is off and the 'binary' option + is on, or 'fixeol' option is off, no will be written for the + last line in the file. This option is automatically set or reset when + starting to edit a new file, depending on whether file has an + for the last line in the file. Normally you don't have to set or + reset this option. + ''; + }; + expandtab = { type = bool; vimDefault = false; @@ -1699,7 +2109,6 @@ let writing the file. For reading see below. When 'fileencoding' is empty, the file will be saved with UTF-8 encoding (no conversion when reading or writing a file). - ''; }; @@ -1729,7 +2138,6 @@ let this use the ":filetype on" command. |:filetype| When a dot appears in the value then this separates two filetype names. - ''; extraHelp = [ ":filetype" ]; }; @@ -1743,7 +2151,6 @@ let preserve the situation from the original file. When the 'binary' option is set the value of this option doesn't matter. - ''; extraHelp = [ "binary" @@ -1759,7 +2166,6 @@ let Expression which is evaluated to format a range of lines for the |gq| operator or automatic formatting (see 'formatoptions'). When this option is empty 'formatprg' is used. - ''; }; @@ -1771,7 +2177,6 @@ let the "n" flag in 'formatoptions'. The default recognizes a number, followed by an optional punctuation - ''; extraHelp = [ "formatoptions" ]; }; @@ -1782,7 +2187,6 @@ let description = '' This is a sequence of letters which describes how automatic formatting is to be done. - ''; extraHelp = [ "fo-table" ]; }; @@ -1796,7 +2200,6 @@ let - 0 :lmap is off and IM is off - 1 :lmap is ON and IM is off - 2 :lmap is off and IM is ON - ''; }; @@ -1811,7 +2214,6 @@ let - 0 :lmap is off and IM is off - 1 :lmap is ON and IM is off - 2 :lmap is off and IM is ON - ''; }; @@ -1821,7 +2223,6 @@ let description = '' Expression to be used to transform the str found with the 'include' option to a file name. - ''; }; @@ -1832,7 +2233,6 @@ let Expression which is evaluated to obtain the proper indent for a line. It is used when a new line is created, for the |=| operator and in Insert mode as specified with the 'indentkeys' option. - ''; }; @@ -1842,7 +2242,6 @@ let description = '' A list of keys that, when typed in Insert mode, cause reindenting of the current line. - ''; }; @@ -1855,7 +2254,6 @@ let on the typed text. If the typed text contains a lowercase letter where the match has an upper case letter, the completed part is made lowercase. - ''; }; @@ -1865,7 +2263,6 @@ let description = '' Keywords are used in searching and recognizing with many commands: "w", "*", "[i", etc. It is also used for "\k" in a |pattern|. - ''; extraHelp = [ "pattern" ]; }; @@ -1875,7 +2272,6 @@ let vimDefault = ""; description = '' Name of a keyboard mapping. - ''; extraHelp = [ "mbyte-keymap" ]; }; @@ -1887,7 +2283,6 @@ let Lisp mode: When is typed in insert mode set the indent for the next line to Lisp standards (well, sort of). Also happens with "cc" or "S". - ''; }; @@ -1904,6 +2299,109 @@ let ''; extraHelp = [ "list" ]; }; + + matchpairs = { + type = commas; + vimDefault = [ "(:)" "{:}" "[:]" ]; + description = '' + Characters that form pairs. The |%| command jumps from one to the other. + Only character pairs are allowed that are different, thus you cannot + jump between two double quotes. + The characters must be separated by a colon. + ''; + }; + + modeline = { + type = bool; + vimDefault = '' + true (false for root) + ''; + description = '' + If 'modeline' is on 'modelines' gives the number of lines that is + checked for set commands. If 'modeline' is off or 'modelines' is zero + no lines are checked. + ''; + extraHelp = [ "modelines" ]; + }; + + modified = { + type = bool; + vimDefault = false; + description = '' + When on, the buffer is considered to be modified. + ''; + extraHelp = [ "gzip-example" ]; + }; + + nrformats = { + type = listOf (enum [ "alpha" "octal" "hex" "bin" "unsigned" ]); + vimDefault = [ "bin" "hex" ]; + description = '' + This defines what bases Vim will consider for numbers when using the + CTRL-A and CTRL-X commands for adding to and subtracting from a number + respectively; + ''; + extraHelp = [ "CTRL-A" "CTRL-X" ]; + }; + + omnifunc = { + type = str; + vimDefault = ""; + description = '' + This option specifies a function to be used for Insert mode omni + completion with CTRL-X CTRL-O. + ''; + extraHelp = [ + "i_CTRL-X_CTRL-O" + "complete-functions" + ]; + }; + + preserveindent = { + type = bool; + vimDefault = false; + description = '' + When changing the indent of the current line, preserve as much of the + indent structure as possible. Normally the indent is replaced by a + series of tabs followed by spaces as required (unless |'expandtab'| is + enabled, in which case only spaces are used). Enabling this option + means the indent will preserve as many existing characters as possible + for indenting, and only add additional tabs or spaces as required. + 'expandtab' does not apply to the preserved white space, a Tab remains + a Tab. + + NOTE: When using ">>" multiple times the resulting indent is a mix of + tabs and spaces. You might not like this. + ''; + extraHelp = [ "expandtab" "copyindent" ":retab" ]; + }; + + quoteescape = { + type = str; + vimDefault = ''\''; + description = '' + The characters that are used to escape quotes in a string. Used for + objects like a', a" and a` |a'|. + When one of the characters in this option is found inside a string, + the following character will be skipped. The default value makes the + text "foo\"bar\\" considered to be one string. + ''; + extraHelp = [ "a'" ]; + }; + + readonly = { + type = bool; + vimDefault = false; + description = '' + If on, writes fail unless you use a '!'. Protects you from + accidentally overwriting a file. Default on when Vim is started + in read-only mode ("vim -R") or when the executable is called "view". + When using ":w!" the 'readonly' option is reset for the current + buffer + ''; + extraHelp = [ "cpoptions" ":view" ]; + }; + }; in mapAttrs (_: mapAttrs mkVimOptOption) {