From b2fa93c305f666abd57c26eb70f07e60e8266fa5 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Mon, 13 May 2024 14:30:59 +0300 Subject: [PATCH] modules/vim: init vim options --- modules/build/neovim.nix | 2 +- modules/profiles/base.nix | 2 +- modules/vim/options.nix | 4232 +++++++++++++++++++++++++++++++++++++ modules/vim/opts.nix | 13 +- 4 files changed, 4236 insertions(+), 13 deletions(-) create mode 100644 modules/vim/options.nix diff --git a/modules/build/neovim.nix b/modules/build/neovim.nix index 92bb6f8..20a25af 100644 --- a/modules/build/neovim.nix +++ b/modules/build/neovim.nix @@ -38,7 +38,7 @@ in # Global Opts (flip mapAttrsToList config.vim.g (k: set "vim.g.${k}")) # Opts - (flip mapAttrsToList config.vim.opt (k: set "vim.opt.${k}")) + (flip mapAttrsToList config.vim.opt (k: v: if v == null then null else set "vim.opt.${k}" v)) # Plugins (map (v: v.genConfig) (filter (v: v.enable) (attrValues config.plugin))) # Cmd diff --git a/modules/profiles/base.nix b/modules/profiles/base.nix index e5fa806..22d63b2 100644 --- a/modules/profiles/base.nix +++ b/modules/profiles/base.nix @@ -7,7 +7,7 @@ in vim.opt = { # Better Unix support viewoptions = lib.mkDefault [ "folds" "options" "cursor" "unix" "slash" ]; - encoding = lib.mkDefault "utf-8"; + fileencoding = lib.mkDefault "utf-8"; # Enable 24-bit color termguicolors = lib.mkDefault true; diff --git a/modules/vim/options.nix b/modules/vim/options.nix new file mode 100644 index 0000000..5f0df73 --- /dev/null +++ b/modules/vim/options.nix @@ -0,0 +1,4232 @@ +{ lib }: + +let + inherit (builtins) mapAttrs; + mkVimOptOption = + key: + { type + , vimDefault ? null + , default ? null + , description ? "" + , extraHelp ? [ ] + , apply ? null + }: + lib.mkOption ({ + type = lib.types.nullOr type; + inherit default; + defaultText = lib.literalExpression (builtins.toJSON vimDefault); + description = lib.concatLines ( + [ description "" ] + ++ map (help: "`:help ${help}") ([ key ] ++ extraHelp) + ); + } // lib.optionalAttrs (apply != null) { inherit apply; }); + + + sharedGlobalOrWindow = with lib.types; { + fillchars = { + type = listOf (enum [ + "stl" + "stlnc" + "wbr" + "horiz" + "horizup" + "horizdown" + "vert" + "vertleft" + "vertright" + "verthoriz" + "fold" + "foldopen" + "foldclose" + "foldsep" + "diff" + "msgsep" + "eob" + "lastline" + ]); + vimDefault = [ ]; + description = '' + Characters to fill the statuslines, vertical separators and special lines in the window. + ''; + }; + + scrolloff = { + type = number; + vimDefault = 0; + description = '' + Minimal number of screen lines to keep above and below the cursor. + This will make some context visible around where you are working. If + you set it to a very large value (999) the cursor line will always be + in the middle of the window (except at the start or end of the file or + when long lines wrap). + ''; + 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 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" ]; + }; + + virtualedit = { + type = listOf (enum [ "block" "insert" "all" "onemore" "none" "NONE" ]); + vimDefault = [ ]; + description = '' + Virtual editing means that the cursor can be positioned where there is + no actual character. This can be halfway into a tab or beyond the end + of the line. Useful for selecting a rectangle in Visual mode and + editing a table. + ''; + }; + + winbar = { + type = str; + vimDefault = ""; + description = '' + When non-empty, this option enables the window bar and determines its + contents. The window bar is a bar that's shown at the top of every + window with it enabled. The value of 'winbar' is evaluated like with + 'statusline'. + + When changing something that is used in 'winbar' that does not trigger + it to be updated, use |:redrawstatus|. + + Floating windows do not use the global value of 'winbar'. The + window-local value of 'winbar' must be set for a floating window to + have a window bar. + ''; + extraHelp = [ "statusline" ":redrawstatus" ]; + }; + }; + + sharedGlobalOrBuffer = with lib.types; { + autoread = { + type = bool; + vimDefault = true; + description = '' + When a file has been detected to have been changed outside of Vim and + it has not been changed inside of Vim, automatically read it again. + When the file has been deleted this is not done, so you have the text + from before it was deleted. When it appears again then it is read. + ''; + extraHelp = [ "timestamp" ]; + }; + + backupcopy = { + type = listOf (enum [ "yes" "no" "auto" "breaksymlink" "breakhardlink" ]); + vimDefault = [ "auto" ]; + description = '' + When writing a file and a backup is made, this option tells how it's + done. This is a comma-separated list of words. + ''; + }; + + define = { + type = str; + vimDefault = ""; + description = '' + Pattern to be used to find a macro definition. + ''; + }; + + dictionary = { + type = listOf (either str path); + vimDefault = [ ]; + 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 = ""; + description = '' + The name of an external program that will be used to format the lines + selected with the |gq| operator. The program must take the input on + stdin and produce the output on stdout. + ''; + }; + + grepprg = { + type = str; + vimDefault = '' + default "grep -n ", + Unix: "grep -n $* /dev/null" + ''; + description = '' + Program to use for the |:grep| command. This option may contain '%' + and '#' characters, which are expanded like when used in a command-line. + ''; + extraHelp = [ + ":grep" + ":vimgrep" + ":lvimgrep" + ":grepadd" + ":vimgrepadd" + ":lgrepadd" + ":lvimgrepadd" + ]; + }; + + include = { + type = str; + vimDefault = ''^\s*#\s*include''; + description = '' + Pattern to be used to find an include command. + ''; + }; + + keywordprg = { + type = str; + vimDefault = '' + Windows: ":help" + otherwise: ":Man" + ''; + description = '' + Program to use for the |K| command. + ''; + }; + + lispwords = { + type = listOf str; + vimDefault = is very long; + description = '' + list of words that influence the Lisp indenting when + enabled with the |'lisp'| option. + ''; + }; + + makeencoding = { + type = str; + vimDefault = ""; + description = '' + Encoding used for reading the output of external commands. When empty, + encoding is not converted. + 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. + ''; + }; + + tagcase = { + type = enum [ "followic" "followscs" "ignore" "match" "smart" ]; + vimDefault = "followic"; + description = '' + This option specifies how case is handled when searching the tags + file: + followic Follow the 'ignorecase' option + followscs Follow the 'smartcase' and 'ignorecase' options + ignore Ignore case + match Match case + smart Ignore case unless an upper case letter is used + ''; + }; + + tags = { + type = commas; + vimDefault = [ "./tags;" "tags" ]; + description = '' + Filenames for the tag command, separated by spaces or commas. To + include a space or comma in a file name, precede it with a backslash + (see |option-backslash| about including spaces and backslashes). + When a file name starts with "./", the '.' is replaced with the path + of the current file. But only when the 'd' flag is not included in + 'cpoptions'. Environment variables are expanded |:set_env|. Also see + |tags-option|. + "*", "**" and other wildcards can be used to search for tags files in + a directory tree. See |file-searching|. E.g., "/lib/**/tags" will + find all files named "tags" below "/lib". The filename itself cannot + contain wildcards, it is used as-is. E.g., "/lib/**/tags?" will find + files called "tags?". + The |tagfiles()| function can be used to get a list of the file names + actually used. + ''; + extraHelp = [ "tags-option" "file-searching" "tagfiles()" ]; + }; + + thesaurus = { + type = listOf (either str path); + vimDefault = [ ]; + description = '' + List of file names, separated by commas, that are used to lookup words + for thesaurus completion commands |i_CTRL-X_CTRL-T|. See + |compl-thesaurus|. + + This option is not used if 'thesaurusfunc' is set, either for the + buffer or globally. + + To include a comma in a file name precede it with a backslash. Spaces + after a comma are ignored, otherwise spaces are included in the file + name. + ''; + extraHelp = [ "i_CTRL-X_CTRL-T" "compl-thesaurus" "thesaurusfunc" ]; + }; + + thesaurusfunc = { + type = str; + vimDefault = ""; + description = '' + This option specifies a function to be used for thesaurus completion + with CTRL-X CTRL-T + ''; + extraHelp = [ "i_CTRL-X_CTRL-T" "compl-thesaurusfunc" ]; + }; + + undolevels = { + type = number; + vimDefault = 1000; + description = '' + Maximum number of changes that can be undone. Since undo information + is kept in memory, higher numbers will cause more memory to be used. + Nevertheless, a single change can already use a large amount of memory. + Set to 0 for Vi compatibility: One level of undo and "u" undoes + itself + But you can also get Vi compatibility by including the 'u' flag in + 'cpoptions', and still be able to use CTRL-R to repeat undo. + Also see |undo-two-ways|. + Set to -1 for no undo at all. You might want to do this only for the + current buffer + This helps when you run out of memory for a single change. + ''; + extraHelp = [ "cpoptions" "undo-two-ways" "clear-undo" ]; + }; + }; + + global = with lib.types; sharedGlobalOrWindow // sharedGlobalOrBuffer // { + allowrevins = { + type = bool; + vimDefault = false; + description = '' + 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 + ''; + }; + + ambiwidth = { + type = enum [ "single" "double" ]; + vimDefault = "single"; + description = '' + Tells Vim what to do with characters with East Asian Width Class + Ambiguous (such as Euro, Registered Sign, Copyright Sign, Greek + letters, Cyrillic letters). + ''; + }; + + autochdir = { + type = bool; + vimDefault = false; + description = '' + When on, Vim will change the current working directory whenever you + open a file, switch buffers, delete a buffer or open/close a window. + It will change to the directory containing the file which was opened + 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. + ''; + }; + + arabicshape = { + type = bool; + vimDefault = false; + description = '' + When on and 'termbidi' is off, the required visual character + corrections that need to take place for displaying the Arabic language + take effect. + ''; + }; + + autowrite = { + type = bool; + vimDefault = false; + description = '' + Write the contents of the file, if it has been modified, on each + `:next`, `:rewind`, `:last`, `:first`, `:previous`, `:stop`, + `: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. + ''; + }; + + autowriteall = { + type = bool; + vimDefault = false; + description = '' + Like 'autowrite', but also used for commands ":edit", ":enew", ":quit", + ":qall", ":exit", ":xit", ":recover" and closing the Vim window. + Setting this option also implies that Vim behaves like 'autowrite' has + been set. + ''; + }; + + background = { + type = str; + vimDefault = "dark"; + description = '' + When set to "dark" or "light", adjusts the default color groups for + that background type. The |TUI| or other UI sets this on startup + (triggering |OptionSet|) if it can detect the background color. + + This option does NOT change the background color, it tells Nvim what + the "inherited" (terminal/GUI) background looks like. + See |:hi-normal| if you want to set the background color explicitly. + + When a color scheme is loaded (the "g:colors_name" variable is set) + setting 'background' will cause the color scheme to be reloaded. If + 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. + ''; + }; + + backspace = { + type = listOf (enum [ "indent" "eol" "start" "nostop" ]); + vimDefault = [ "indent" "eol" "start" ]; + description = '' + 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: + ''; + }; + + backup = { + type = bool; + vimDefault = false; + description = '' + Make a backup before overwriting a file. Leave it around after the + file has been successfully written. If you do not want to keep the + backup file, but you do want a backup while the file is being + written, reset this option and set the 'writebackup' option (this is + the default). If you do not want a backup file at all reset both + options (use this if your file system is almost full). See the + |backup-table| for more explanations. + ''; + extraHelp = [ "backup-table" ]; + }; + + backupdir = { + type = listOf (either str path); + vimDefault = [ "." "$XDG_STATE_HOME/nvim/backup//" ]; + description = '' + List of directories for the backup file, separated with commas. + ''; + }; + + backupext = { + type = str; + vimDefault = "~"; + description = '' + str which is appended to a file name to make the name of the + backup file. The default is quite unusual, because this avoids + accidentally overwriting existing files with a backup file. You might + 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. + ''; + }; + + backupskip = { + type = listOf (either str path); + vimDefault = '' + default: "$TMPDIR/*,$TMP/*,$TEMP/*" + Unix: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*" + Mac: "/private/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*" + ''; + description = '' + A list of file patterns. When one of the patterns matches with the + name of the file which is written, no backup file is created. Both + the specified file name and the full path name of the file are used. + The pattern is used like with |:autocmd|, see |autocmd-pattern|. + 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. + ''; + }; + + belloff = { + type = listOf (enum [ + "all" + "backspace" + "cursor" + "complete" + "copy" + "ctrlg" + "error" + "esc" + "hangul" + "lang" + "mess" + "showmatch" + "operator" + "register" + "shell" + "spell" + "willmode" + ]); + vimDefault = [ "all" ]; + description = '' + Specifies for which events the bell will not be rung. It is a comma- + separated list of items. For each item that is present, the bell + will be silenced. This is most useful to specify specific events in + insert mode to be silenced. + + item | meaning when present + -------------------------------------------------------------------- + all | All events. + backspace | When hitting or and deleting results in an error. + cursor | Fail to move around using the cursor keys or + | / in |Insert-mode|. + complete | Error occurred when using |i_CTRL-X_CTRL-K| or + | |i_CTRL-X_CTRL-T|. + copy | Cannot copy char from insert mode using |i_CTRL-Y| or + | |i_CTRL-E|. + ctrlg | Unknown Char after in Insert mode. + error | Other Error occurred (e.g. try to join last line) + | (mostly used in |Normal-mode| or |Cmdline-mode|). + esc | hitting in |Normal-mode|. + hangul | Ignored. + lang | Calling the beep module for Lua/Mzscheme/TCL. + mess | No output available for |g<|. + showmatch | Error occurred for 'showmatch' function. + operator | Empty region error |cpo-E|. + register | Unknown register after in |Insert-mode|. + shell | Bell from shell output |:!|. + spell | Error happened on spell suggest. + wildmode | More matches in |cmdline-completion| available + | (depends on the 'wildmode' setting). + ''; + }; + + breakat = { + type = str; + vimDefault = " ^I!@*-+;:,./?"; + description = '' + This option lets you choose which characters might cause a line + break if 'linebreak' is on. Only works for ASCII characters. + ''; + }; + + browsedir = { + type = either path (enum [ "last" "buffer" "current" ]); + vimDefault = "last"; + description = '' + Which directory to use for the file browser: + last Use same directory as with last file browser, where a file was opened or saved. + buffer Use the directory of the related buffer. + current Use the current directory. + {path} Use the specified directory + ''; + }; + + casemap = { + type = listOf (enum [ "internal" "keepascii" ]); + vimDefault = [ "internal" "keepascii" ]; + description = '' + Specifies details about changing the case of letters. It may contain + these words, separated by a comma: + - internal - Use internal case mapping functions, the current locale does not change the case + mapping. When "internal" is omitted, the towupper() and towlower() system library functions are + 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. + ''; + }; + + cedit = { + type = str; + vimDefault = lib.mod.ctrl "F"; + description = '' + The key used in Command-line Mode to open the command-line window. + Only non-printable keys are allowed. + ''; + }; + + charconvert = { + type = str; + vimDefault = ""; + description = '' + 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. + ''; + }; + + clipboard = { + type = let t = enum [ "unnamed" "unnamedplus" ]; in either t (listOf t); + vimDefault = [ ]; + description = '' + This option is a list of comma-separated names. + ''; + }; + + cmdheight = { + type = number; + vimDefault = 1; + description = '' + Number of screen lines to use for the command-line. Helps avoiding |hit-enter| prompts. + ''; + }; + + cmdwinheight = { + type = number; + vimDefault = 7; + description = '' + Number of screen lines to use for the command-line window. + ''; + extraHelp = [ "cmdwin" ]; + }; + + completeopt = { + type = listOf (enum [ + "menu" + "menuone" + "longest" + "preview" + "noinsert" + "noselect" + ]); + vimDefault = [ "menu" "preview" ]; + description = '' + A comma-separated list of options for Insert mode completion |ins-completion|. + ''; + }; + + confirm = { + type = bool; + vimDefault = false; + description = '' + When 'confirm' is on, certain operations that would normally + fail because of unsaved changes to a buffer, e.g. ":q" and ":e", + instead raise a dialog asking if you wish to save the current + file(s). You can still use a ! to unconditionally |abandon| a buffer. + If 'confirm' is off you can still activate confirmation for one + command only (this is most useful in mappings) with the |:confirm| + command. + ''; + }; + + cpoptions = { + type = str; + vimDefault = true; + description = '' + A sequence of single character flags. When a character is present + this indicates Vi-compatible behavior. This is used for things where + 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. + + The values can be combined, separated by a comma. + "msg" and "throw" are useful for debugging 'foldexpr', 'formatexpr' or + 'indentexpr'. + ''; + }; + + delcombine = { + type = bool; + vimDefault = false; + description = '' + If editing Unicode and this option is set, backspace and Normal mode + "x" delete each combining character on its own. When it is off (the + default) the character along with its combining characters are + deleted. + ''; + }; + + diffexpr = { + type = str; + vimDefault = ""; + 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" ]; + }; + + diffopt = { + type = listOf str; + vimDefault = [ "internal" "filler" "closeoff" ]; + description = '' + Option settings for diff mode. + ''; + }; + + digraph = { + type = bool; + vimDefault = false; + description = '' + Enable the entering of digraphs in Insert mode with {char1} {char2}. + ''; + extraHelp = [ "digraphs" ]; + }; + + directory = { + type = listOf (either str path); + vimDefault = [ "$XDG_STATE_HOME/nvim/swap//" ]; + description = '' + List of directory names for the swap file, separated with commas. + ''; + }; + + display = { + type = listOf (enum [ "lastline" "truncate" "uhex" "msgsep" ]); + vimDefault = [ "lastline" ]; + description = '' + Change the way text is displayed. + ''; + }; + + eadirection = { + type = enum [ "ver" "hor" "both" ]; + vimDefault = "both"; + description = '' + Tells when the 'equalalways' option applies: + ''; + }; + + emoji = { + type = bool; + vimDefault = true; + description = '' + When on all Unicode emoji characters are considered to be full width. + This excludes "text emoji" characters, which are normally displayed as + single width. + ''; + }; + + equalalways = { + type = bool; + vimDefault = true; + description = '' + When on, all the windows are automatically made the same size after + 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. + ''; + }; + + errorbells = { + type = bool; + vimDefault = false; + description = '' + 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 + ''; + }; + + errorfile = { + type = str; + vimDefault = "errors.err"; + description = '' + Name of the errorfile for the QuickFix mode. + ''; + extraHelp = [ "cf" ]; + }; + + errorformat = { + type = str; + vimDefault = "default is very long"; + description = '' + Scanf-like description of the format for the lines in the error file + ''; + }; + + eventignore = { + type = listOf str; + vimDefault = [ ]; + description = '' + 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. + ''; + }; + + exrc = { + type = bool; + vimDefault = false; + description = '' + 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" ]; + description = '' + This is a list of character encodings considered when starting to edit + an existing file. + ''; + }; + + fileformats = { + type = listOf (enum [ "dos" "unix" "mac" ]); + vimDefault = '' + Windows default: ["dos" "unix"], + Unix default: ["unix" "dos"] + ''; + description = '' + 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 + ''; + }; + + fileignorecase = { + type = bool; + vimDefault = '' + `true` for systems where case in file names is normally ignored" + ''; + description = '' + When set case is ignored when using file names and directories. + ''; + }; + + foldclose = { + type = str; + vimDefault = ""; + description = '' + 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. + ''; + }; + + foldlevelstart = { + type = number; + vimDefault = -1; + description = '' + Sets 'foldlevel' when starting to edit another buffer in a window. + Useful to always start editing with all folds closed (value zero), + some folds closed (one) or no folds closed (99). + + When the value is negative, it is not used. + ''; + extraHelp = [ "foldlevel" ]; + }; + + foldopen = { + type = listOf (enum [ + "all" + "block" + "hor" + "insert" + "jump" + "mark" + "percent" + "quickfix" + "search" + "tag" + "undo" + ]); + vimDefault = [ + "block" + "hor" + "mark" + "percent" + "quickfix" + "search" + "tag" + "undo" + ]; + description = '' + 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. + ''; + }; + + fsync = { + type = bool; + vimDefault = true; + description = '' + When on, the OS function fsync() will be called after saving a file + (|:write|, |writefile()|, …), |swap-file|, |undo-persistence| and |shada-file|. + 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. + ''; + }; + + gvimDefault = { + type = bool; + vimDefault = false; + description = '' + When on, the ":substitute" flag 'g' is default on. This means that + 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|. + ''; + }; + + grepformat = { + type = str; + vimDefault = ''%f:%l:%m,%f:%l%m,%f %l%m''; + description = '' + Format to recognize for the ":grep" command output. + ''; + extraHelp = [ "errorformat" ]; + }; + + guicursor = { + type = str; + vimDefault = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20"; + description = '' + Configures the cursor style for each mode. Works in the GUI and many + terminals. See |tui-cursor-shape|. + + To disable cursor-styling, reset the option + ''; + }; + + guifont = { + type = listOf str; + vimDefault = [ ]; + description = '' + This is a list of fonts which will be used for the GUI version of Vim. + In its simplest form the value is just one font name. When + 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. + ''; + }; + + guifontwide = { + type = listOf str; + vimDefault = [ ]; + description = '' + list of fonts to be used for double-width characters. + The first font that can be loaded is used. + ''; + }; + + guioptions = { + type = str; + vimDefault = "egmrLT"; + description = '' + 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. + ''; + }; + + guitablabel = { + type = str; + vimDefault = ""; + description = '' + 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" ]; + }; + + guitabtooltip = { + type = str; + vimDefault = ""; + 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. + ''; + }; + + helpfile = { + type = (either str path); + vimDefault = '' + default (MS-Windows) "$VIMRUNTIME\doc\help.txt" + (others) "$VIMRUNTIME/doc/help.txt" + ''; + }; + + helpheight = { + type = number; + vimDefault = 20; + description = '' + Minimal initial height of the help window when it is opened with the ":help" command. + ''; + }; + + helplang = { + type = listOf str; + vimDefault = "messages language or empty"; + description = '' + list of languages. Vim will use the first language + for which the desired help can be found. + ''; + }; + + hidden = { + type = bool; + vimDefault = true; + description = '' + When off a buffer is unloaded (including loss of undo information) + 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" + "bufhidden" + ]; + }; + + history = { + type = number; + vimDefault = 10000; + description = '' + A history of ":" commands, and a history of previous search patterns + is remembered. This option decides how many entries may be stored in + each of these histories + + The maximum is 10000. + ''; + extraHelp = [ "cmdline-editing" ]; + }; + + hlsearch = { + type = bool; + vimDefault = true; + description = '' + When there is a previous search pattern, highlight all its matches. + ''; + extraHelp = [ + "incsearch" + "match" + ]; + }; + + icon = { + type = bool; + vimDefault = false; + description = '' + When on, the icon text of the window will be set to the value of + 'iconstr' (if it is not empty), or to the name of the file + 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" ]; + }; + + iconstring = { + type = str; + vimDefault = ""; + description = '' + When this option is not empty, it will be used for the icon text of the window. + ''; + }; + + ignorecase = { + type = bool; + vimDefault = false; + description = '' + Ignore case in search patterns. Also used when searching in the tags file. + + Also see 'smartcase' and 'tagcase'. + ''; + }; + + imcmdline = { + type = bool; + vimDefault = false; + description = '' + When set the Input Method is always on when starting to edit a command + line, unless entering a search pattern. + ''; + extraHelp = [ "imsearch" ]; + }; + + imdisable = { + type = bool; + vimDefault = '' + false + true for some systems (SGI) + ''; + description = '' + When set the Input Method is never used. This is useful to disable + the IM when it doesn't work properly. + ''; + }; + + inccommand = { + type = enum [ "nosplit" "split" ]; + vimDefault = "nosplit"; + description = '' + When nonempty, shows the effects of |:substitute|, |:smagic|, + |:snomagic| and user commands with the |:command-preview| flag as you + type. + ''; + }; + + incsearch = { + type = bool; + vimDefault = true; + description = '' + 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. + ''; + }; + + isfname = { + type = str; + vimDefault = '' + Windows: "@,48-57,/,\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=" + otherwise: "@,48-57,/,.,-,_,+,,,#,$,%,~,=" + ''; + }; + + isident = { + type = str; + vimDefault = '' + Windows: "@,48-57,_,128-167,224-235" + otherwise: "@,48-57,_,192-255" + ''; + description = '' + 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. + ''; + }; + + isprint = { + type = str; + vimDefault = "@,161-255"; + description = '' + The characters given by this option are displayed directly on the + screen. It is also used for "\p" in a |pattern|. + ''; + extraHelp = [ "pattern" ]; + }; + + jumpoptions = { + type = str; + vimDefault = ""; + description = '' + List of words that change the behavior of the |jumplist| + ''; + extraHelp = [ "jumplist" ]; + }; + + joinspaces = { + type = bool; + vimDefault = false; + description = '' + Insert two spaces after a '.', '?' and '!' with a join command. + Otherwise only one space is inserted. + ''; + }; + + keymodel = { + type = listOf str; + vimDefault = [ ]; + description = '' + List of comma-separated words, which enable special things that keys can do. + ''; + }; + + langmap = { + type = listOf str; + vimDefault = [ ]; + description = '' + This option allows switching your keyboard into a special language + mode. When you are typing text in Insert mode the characters are + inserted directly. When in Normal mode the 'langmap' option takes + 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. + ''; + }; + + langmenu = { + type = str; + vimDefault = ""; + description = '' + Language to use for menu translation. + ''; + }; + + langremap = { + type = bool; + vimDefault = false; + description = '' + 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. + ''; + }; + + laststatus = { + type = number; + vimDefault = 2; + description = '' + The value of this option influences when the last window will have a + status line: + - 0: never + - 1: only if there are at least two windows + - 2: always + - 3: always and ONLY the last window + ''; + }; + + lazyredraw = { + type = bool; + vimDefault = false; + description = '' + When this option is set, the screen will not be redrawn while + 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" ]; + }; + + linespace = { + type = number; + vimDefault = 0; + description = '' + 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. + ''; + }; + + loadplugins = { + type = bool; + vimDefault = true; + description = '' + 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. + ''; + }; + + magic = { + type = bool; + vimDefault = true; + description = '' + Changes the special characters that can be used in search patterns. + 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. + ''; + }; + + makeef = { + type = (either str path); + vimDefault = ""; + description = '' + Name of the errorfile for the |:make| command (see |:make_makeprg|) + and the |:grep| command. + 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" ]; + }; + + ruler = { + type = bool; + vimDefault = true; + description = '' + Show the line and column number of the cursor position, separated by a + comma. When there is room, the relative position of the displayed + text in the file is shown on the far right: + Top first line is visible + Bot last line is visible + All first and last line are visible + 45% relative position in the file + If 'rulerformat' is set, it will determine the contents of the ruler. + Each window has its own ruler. If a window has a status line, the + ruler is shown there. If a window doesn't have a status line and + 'cmdheight' is zero, the ruler is not shown. Otherwise it is shown in + the last line of the screen. If the statusline is given by + 'statusline' (i.e. not empty), this option takes precedence over + 'ruler' and 'rulerformat'. + ''; + extraHelp = [ + "rulerformat" + "cmdheight" + "statusline" + "g_CTRL-G" + ]; + }; + + rulerformat = { + type = str; + vimDefault = ""; + description = '' + When this option is not empty, it determines the content of the ruler + string, as displayed for the 'ruler' option. + The format of this option is like that of 'statusline'. + This option cannot be set in a modeline when 'modelineexpr' is off. + ''; + extraHelp = [ "ruler" "statusline" ]; + }; + + # TODO: runtimepath + + scrolljump = { + type = number; + vimDefault = 1; + description = '' + Minimal number of lines to scroll when the cursor gets off the + screen (e.g., with "j"). Not used for scroll commands. + ''; + }; + + scrollopt = { + type = listOf (enum [ "ver" "hor" "jump" ]); + vimDefault = [ "ver" "jump" ]; + description = '' + This is a comma-separated list of words that specifies how + 'scrollbind' windows should behave. + + ''; + extraHelp = [ "scrollbind" "scroll-binding" ]; + }; + + sections = { + type = str; + vimDefault = "SHNHH HUnhsh"; + description = '' + Specifies the nroff macros that separate sections. These are pairs of + two letters + ''; + extraHelp = [ "object-motions" ]; + }; + + sessionoptions = { + type = listOf (enum [ + "blank" + "buffers" + "curdir" + "folds" + "globals" + "help" + "localoptions" + "options" + "skiprtp" + "resize" + "sesdir" + "tabpages" + "terminal" + "winpos" + "winsize" + ]); + vimDefault = [ + "blank" + "buffers" + "curdir" + "folds" + "help" + "tabpages" + "winsize" + "terminal" + ]; + description = '' + Changes the effect of the |:mksession| command. It is a comma- + separated list of words. + + Don't include both "curdir" and "sesdir". When neither is included + filenames are stored as absolute paths. + If you leave out "options" many things won't work well after restoring + the session. + ''; + extraHelp = [ ":mksession" ]; + }; + + shada = { + type = commas; + vimDefault = '' + Win32: !,'100,<50,s10,h,rA:,rB: + others: !,'100,<50,s10,h) + ''; + description = '' + When non-empty, the shada file is read upon startup and written + when exiting Vim (see |shada-file|). The string should be a comma- + separated list of parameters, each consisting of a single character + identifying the particular parameter, followed by a number or string + which specifies the value of that parameter. If a particular + character is left out, then the default value is used for that + parameter. + ''; + extraHelp = [ "shada-file" ]; + }; + + shadafile = { + type = str; + vimDefault = ""; + description = '' + When non-empty, overrides the file name used for |shada| (viminfo). + When equal to "NONE" no shada file will be read or written. + This option can be set with the |-i| command line flag. The |--clean| + command line flag sets it to "NONE". + ''; + extraHelp = [ "shada" ]; + }; + + shell = { + type = str; + vimDefault = '' + Win32: "cmd.exe" + others: $SHELL or "sh" + ''; + description = '' + Name of the shell to use for ! and :! commands. When changing the + value also check these options: 'shellpipe', 'shellslash' + 'shellredir', 'shellquote', 'shellxquote' and 'shellcmdflag'. + It is allowed to give an argument to the command, e.g. "csh -f". + See |option-backslash| about including spaces and backslashes. + ''; + extraHelp = [ + "shellpipe" + "shellslash" + "shellredir" + "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 . + ''; + extraHelp = [ "ignorecase" ]; + }; + + smarttab = { + type = bool; + vimDefault = true; + description = '' + When on, a in front of a line inserts blanks according to + 'shiftwidth'. 'tabstop' or 'softtabstop' is used in other places. A + will delete a 'shiftwidth' worth of space at the start of the + line. + When off, a 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 or spaces) depends on the 'expandtab' + option. Also see |ins-expandtab|. When 'expandtab' is not set, the + number of spaces is minimized by using 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. + ''; + }; + + suffixes = { + type = commas; + vimDefault = [ ".bak" "~" ".o" ".h" ".info" ".swp" ".obj" ]; + description = '' + Files with these suffixes get a lower priority when multiple files + match a wildcard. + ''; + extraHelp = [ "wildignore" ]; + }; + + switchbuf = { + type = listOf (enum [ "useopen" "usetab" "split" "vsplit" "newtab" "uselast" ]); + vimDefault = [ "uselast" ]; + description = '' + This option controls the behavior when switching between buffers. + Mostly for |quickfix| commands some values are also used for other + commands, as mentioned below. + ''; + }; + + tabline = { + type = str; + vimDefault = ""; + description = '' + When non-empty, this option determines the content of the tab pages + line at the top of the Vim window. When empty Vim will use a default + tab pages line. See |setting-tabline| for more info. + ''; + extraHelp = [ "setting-tabline" "showtabline" "statusline" ]; + }; + + tabpagemax = { + type = number; + vimDefault = 50; + description = '' + Maximum number of tab pages to be opened by the |-p| command line + argument or the ":tab all" command. |tabpage| + ''; + extraHelp = [ ":tab" "tabpage" ]; + }; + + tagbsearch = { + type = bool; + vimDefault = true; + description = '' + When searching for a tag (e.g., for the |:ta| command), Vim can either + use a binary search or a linear search in a tags file. Binary + searching makes searching for a tag a LOT faster, but a linear search + will find more tags if the tags file wasn't properly sorted. + Vim normally assumes that your tags files are sorted, or indicate that + they are not sorted. Only when this is not the case does the + 'tagbsearch' option need to be switched off. + ''; + extraHelp = [ ":ta" "ignorecase" "tagcase" "smartcase" ]; + }; + + taglength = { + type = number; + vimDefault = 0; + description = '' + If non-zero, tags are significant up to this number of characters. + ''; + }; + + tagrelative = { + type = bool; + vimDefault = true; + description = '' + If on and using a tags file in another directory, file names in that + tags file are relative to the directory where the tags file is. + ''; + }; + + tagstack = { + type = bool; + vimDefault = true; + description = '' + When on, the |tagstack| is used normally. When off, a ":tag" or + ":tselect" command with an argument will not push the tag onto the + tagstack. A following ":tag" without an argument, a ":pop" command or + any other command that uses the tagstack will use the unmodified + tagstack, but does change the pointer to the active entry. + Resetting this option is useful when using a ":tag" command in a + mapping which should not change the tagstack. + ''; + }; + + termbidi = { + type = bool; + vimDefault = false; + description = '' + The terminal is in charge of Bi-directionality of text (as specified + by Unicode). The terminal is also expected to do the required shaping + that some languages (such as Arabic) require. + ''; + }; + + termguicolors = { + type = bool; + vimDefault = false; + description = '' + Enables 24-bit RGB color in the |TUI|. Uses "gui" |:highlight| + attributes instead of "cterm" attributes. |guifg| + Requires an ISO-8613-3 compatible terminal. + ''; + }; + + termpastefilter = { + type = listOf (enum [ "BS" "HT" "FF" "ESC" "DEL" "C0" "C1" ]); + vimDefault = [ "BS" "HT" "ESC" "DEL" ]; + description = '' + list of options for specifying control characters + to be removed from the text pasted into the terminal window. + ''; + }; + + tildeop = { + type = bool; + vimDefault = false; + description = '' + When on: The tilde command "~" behaves like an operator. + ''; + }; + + timeout = { + type = bool; + vimDefault = true; + description = '' + This option and 'timeoutlen' determine the behavior when part of a + mapped key sequence has been received. For example, if is + pressed and 'timeout' is set, Nvim will wait 'timeoutlen' milliseconds + for any key that can follow in a mapping. + ''; + extraHelp = [ "timeoutlen" ]; + }; + + ttimeout = { + type = bool; + vimDefault = true; + description = '' + This option and 'ttimeoutlen' determine the behavior when part of a + key code sequence has been received by the |TUI|. + + For example if (the \x1b byte) is received and 'ttimeout' is + set, Nvim waits 'ttimeoutlen' milliseconds for the terminal to + complete a key code sequence. If no input arrives before the timeout, + a single is assumed. Many TUI cursor key codes start with . + + On very slow systems this may fail, causing cursor keys not to work + sometimes. If you discover this problem you can ":set ttimeoutlen=9999". + Nvim will wait for the next character to arrive after an . + ''; + extraHelp = [ "ttimeoutlen" ]; + }; + + timeoutlen = { + type = number; + vimDefault = 1000; + description = '' + Time in milliseconds to wait for a mapped sequence to complete. + ''; + }; + + ttimeoutlen = { + type = number; + vimDefault = 50; + description = '' + Time in milliseconds to wait for a key code sequence to complete. Also + used for CTRL-\ CTRL-N and CTRL-\ CTRL-G when part of a command has + been typed. + ''; + }; + + title = { + type = bool; + vimDefault = false; + description = '' + When on, the title of the window will be set to the value of + 'titlestring' (if it is not empty), or to: + filename [+=-] (path) - NVIM + ''; + extraHelp = [ "titlestring" ]; + }; + + titlelen = { + type = number; + vimDefault = 85; + description = '' + Gives the percentage of 'columns' to use for the length of the window + title. When the title is longer, only the end of the path name is + shown. + ''; + }; + + titlestring = { + type = str; + vimDefault = ""; + description = '' + When this option is not empty, it will be used for the title of the + window. This happens only when the 'title' option is on. + + When this option contains printf-style '%' items, they will be + expanded according to the rules used for 'statusline'. + This option cannot be set in a modeline when 'modelineexpr' is off. + ''; + extraHelp = [ "title" "titlelen" ]; + }; + + undodir = { + type = listOf (either str path); + vimDefault = [ "$XDG_STATE_HOME/nvim/undo//" ]; + description = '' + List of directory names for undo files, separated with commas. + See 'backupdir' for details of the format. + "." means using the directory of the file. The undo file name for + "file.txt" is ".file.txt.un~". + For other directories the file name is the full path of the edited + file, with path separators replaced with "%". + When writing: The first directory that exists is used. "." always + works, no directories after "." will be used for writing. If none of + the directories exist Nvim will attempt to create the last directory in + the list. + When reading all entries are tried to find an undo file. The first + undo file that exists is used. When it cannot be read an error is + given, no further entry is used. + + Note that unlike 'directory' and 'backupdir', 'undodir' always acts as + though the trailing slashes are present (see 'backupdir' for what this + means). + ''; + extraHelp = [ "backupdir" "undo-persistence" ]; + }; + + undoreload = { + type = number; + vimDefault = 10000; + description = '' + Save the whole buffer for undo when reloading it. This applies to the + ":e!" command and reloading for when the buffer changed outside of + Vim. |FileChangedShell| + The save only happens when this option is negative or when the number + of lines is smaller than the value of this option. + Set this option to zero to disable undo for a reload. + + When saving undo for a reload, any undo file is not read. + + Note that this causes the whole buffer to be stored in memory. Set + this option to a lower value if you run out of memory. + ''; + }; + + updatecount = { + type = number; + vimDefault = 200; + description = '' + After typing this many characters the swap file will be written to + disk. When zero, no swap file will be created at all (see chapter on + recovery |crash-recovery|). 'updatecount' is set to zero by starting + Vim with the "-n" option, see |startup|. When editing in readonly + mode this option will be initialized to 10000. + The swapfile can be disabled per buffer with |'swapfile'|. + ''; + extraHelp = [ "crash-recovery" "startup" "swapfile" ]; + }; + + updatetime = { + type = number; + vimDefault = 4000; + description = '' + If this many milliseconds nothing is typed the swap file will be + written to disk (see |crash-recovery|). Also used for the + |CursorHold| autocommand event. + ''; + extraHelp = [ "crash-recovery" "CursorHold" ]; + }; + + verbose = { + type = number; + vimDefault = 0; + description = '' + Sets the verbosity level. + + Level Messages + ---------------------------------------------------------------------- + 1 Lua assignments to options, mappings, etc. + 2 When a file is ":source"'ed, or |shada| file is read or written. + 3 UI info, terminal capabilities. + 4 Shell commands. + 5 Every searched tags file and include file. + 8 Files for which a group of autocommands is executed. + 9 Executed autocommands. + 11 Finding items in a path. + 12 Vimscript function calls. + 13 When an exception is thrown, caught, finished, or discarded. + 14 Anything pending in a ":finally" clause. + 15 Ex commands from a script (truncated at 200 characters). + 16 Ex commands. + + If 'verbosefile' is set then the verbose messages are not displayed. + ''; + extraHelp = [ "verbosefile" ]; + }; + + verbosefile = { + type = either str path; + vimDefault = ""; + description = '' + When not empty all messages are written in a file with this name. + When the file exists messages are appended. + Writing to the file ends when Vim exits or when 'verbosefile' is made + empty. Writes are buffered, thus may not show up for some time. + Setting 'verbosefile' to a new value is like making it empty first. + The difference with |:redir| is that verbose messages are not + displayed when 'verbosefile' is set. + ''; + }; + + viewdir = { + type = str; + vimDefault = "$XDG_STATE_HOME/nvim/view//"; + description = '' + Name of the directory where to store files for |:mkview|. + ''; + extraHelp = [ ":mkview" ]; + }; + + viewoptions = { + type = listOf (enum [ "cursor" "curdir" "folds" "options" "localoptions" "slash" "unix" ]); + vimDefault = [ "folds" "cursor" "curdir" ]; + description = '' + Changes the effect of the |:mkview| command. + ''; + extraHelp = [ ":mkview" ]; + }; + + visualbell = { + type = bool; + vimDefault = false; + description = '' + Use visual bell instead of beeping. Also see 'errorbells'. + ''; + extraHelp = [ "errorbells" ]; + }; + + warn = { + type = bool; + vimDefault = true; + description = '' + Give a warning message when a shell command is used while the buffer + has been changed. + ''; + }; + + whichwrap = { + type = listOf (enum [ "b" "s" "h" "l" "<" ">" "~" "[" "]" ]); + vimDefault = [ "b" "s" ]; + description = '' + Allow specified keys that move the cursor left/right to move to the + previous/next line when the cursor is on the first/last character in + the line. Concatenate characters to allow this for these keys: + char key mode + b Normal and Visual + s Normal and Visual + h "h" Normal and Visual (not recommended) + l "l" Normal and Visual (not recommended) + < Normal and Visual + > Normal and Visual + ~ "~" Normal + [ Insert and Replace + ] Insert and Replace + ''; + }; + + wildchar = { + type = either str number; + vimDefault = lib.mod.tab; + description = '' + Character you have to type to start wildcard expansion in the + command-line, as specified with 'wildmode'. + More info here: |cmdline-completion|. + The character is not recognized when used inside a macro. See + 'wildcharm' for that. + Some keys will not work, such as CTRL-C, and Enter. + Although 'wc' is a number option, you can set it to a special key: + ''; + extraHelp = [ "wildmode" "cmdline-completion" "wildcharm" ]; + }; + + wildcharm = { + type = str; + vimDefault = ""; + description = '' + 'wildcharm' works exactly like 'wildchar', except that it is + recognized when used inside a macro. You can find "spare" command-line + keys suitable for this option by looking at |ex-edit-index|. + ''; + extraHelp = [ "wildchar" "ex-edit-index" ]; + }; + + wildignore = { + type = commas; + vimDefault = [ ]; + description = '' + A list of file patterns. A file that matches with one of these + patterns is ignored when expanding |wildcards|, completing file or + directory names, and influences the result of |expand()|, |glob()| and + |globpath()| unless a flag is passed to disable this. + The pattern is used like with |:autocmd|, see |autocmd-pattern|. + Also see 'suffixes'. + ''; + extraHelp = [ + "wildcards" + "expand()" + "glob()" + "globpath()" + ":autocmd" + "autocmd-pattern" + "suffixes" + ]; + }; + + wildcardignorecase = { + type = bool; + vimDefault = false; + description = '' + When set case is ignored when completing file names and directories. + Has no effect when 'fileignorecase' is set. + Does not apply when the shell is used to expand wildcards, which + happens when there are special characters. + ''; + extraHelp = [ "fileignorecase" ]; + }; + + wildmenu = { + type = bool; + vimDefault = true; + description = '' + When 'wildmenu' is on, command-line completion operates in an enhanced + mode. On pressing 'wildchar' (usually ) to invoke completion, + the possible matches are shown. + ''; + }; + + wildmode = { + type = str; + vimDefault = "full"; + description = '' + Completion mode that is used for the character specified with + 'wildchar'. It is a comma-separated list of up to four parts. Each + part specifies what to do for each consecutive use of 'wildchar'. The + first part specifies the behavior for the first use of 'wildchar', + The second part for the second use, etc. + + Each part consists of a colon separated list consisting of the + following possible values: + "" Complete only the first match. + "full" Complete the next full match. After the last match, + the original string is used and then the first match + again. Will also start 'wildmenu' if it is enabled. + "longest" Complete till longest common string. If this doesn't + result in a longer string, use the next part. + "list" When more than one match, list all matches. + "lastused" When completing buffer names and more than one buffer + matches, sort buffers by time last used (other than + the current buffer). + ''; + }; + + wildoptions = { + type = listOf (enum [ "fuzzy" "pum" "tagfile" ]); + vimDefault = [ "pum" "tagfile" ]; + description = '' + A list of words that change how |cmdline-completion| is done. + The following values are supported: + fuzzy Use |fuzzy-matching| to find completion matches. When + this value is specified, wildcard expansion will not + be used for completion. The matches will be sorted by + the "best match" rather than alphabetically sorted. + This will find more matches than the wildcard + expansion. Currently fuzzy matching based completion + is not supported for file and directory names and + instead wildcard expansion is used. + pum Display the completion matches using the popup menu + in the same style as the |ins-completion-menu|. + tagfile When using CTRL-D to list matching tags, the kind of + tag and the file of the tag is listed. Only one match + is displayed per line. Often used tag kinds are: + d #define + f function + ''; + extraHelp = [ "cmdline-completion" "ins-completion-menu" "fuzzy-matching" ]; + }; + + winaltkeys = { + type = enum [ "no" "yes" "menu" ]; + vimDefault = "menu"; + description = '' + {only used in Win32} + Some GUI versions allow the access to menu entries by using the ALT + key in combination with a character that appears underlined in the + menu. This conflicts with the use of the ALT key for mappings and + entering special characters. This option tells what to do: + no Don't use ALT keys for menus. ALT key combinations can be + mapped, but there is no automatic handling. + yes ALT key handling is done by the windowing system. ALT key + combinations cannot be mapped. + menu Using ALT in combination with a character that is a menu + shortcut key, will be handled by the windowing system. Other + keys can be mapped. + + If the menu is disabled by excluding 'm' from 'guioptions', the ALT + key is never used for the menu. + This option is not used for ; on Win32. + ''; + extraHelp = [ "guioptions" ]; + }; + + window = { + type = number; + vimDefault = "screen height - 1"; + description = '' + Window height used for |CTRL-F| and |CTRL-B| when there is only one + window and the value is smaller than 'lines' minus one. The screen + will scroll 'window' minus two lines, with a minimum of one. + When 'window' is equal to 'lines' minus one CTRL-F and CTRL-B scroll + in a much smarter way, taking care of wrapping lines. + When resizing the Vim window, the value is smaller than 1 or more than + or equal to 'lines' it will be set to 'lines' minus 1. + Note: Do not confuse this with the height of the Vim window, use + 'lines' for that. + ''; + extraHelp = [ "lines" ]; + }; + + winheight = { + type = number; + vimDefault = 1; + description = '' + Minimal number of lines for the current window. This is not a hard + minimum, Vim will use fewer lines if there is not enough room. If the + focus goes to a window that is smaller, its size is increased, at the + cost of the height of other windows. + ''; + }; + + winminheight = { + type = number; + vimDefault = 1; + description = '' + The minimal height of a window, when it's not the current window. + This is a hard minimum, windows will never become smaller. + When set to zero, windows may be "squashed" to zero lines (i.e. just a + status bar) if necessary. They will return to at least one line when + they become active (since the cursor has to have somewhere to go.) + Use 'winheight' to set the minimal height of the current window. + This option is only checked when making a window smaller. Don't use a + large number, it will cause errors when opening more than a few + windows. A value of 0 to 3 is reasonable. + ''; + extraHelp = [ "winheight" ]; + }; + + winminwidth = { + type = number; + vimDefault = 1; + description = '' + The minimal width of a window, when it's not the current window. + This is a hard minimum, windows will never become smaller. + When set to zero, windows may be "squashed" to zero columns (i.e. just + a vertical separator) if necessary. They will return to at least one + line when they become active (since the cursor has to have somewhere + to go.) + Use 'winwidth' to set the minimal width of the current window. + This option is only checked when making a window smaller. Don't use a + large number, it will cause errors when opening more than a few + windows. A value of 0 to 12 is reasonable. + ''; + extraHelp = [ "winwidth" ]; + }; + + winwidth = { + type = number; + vimDefault = 20; + description = '' + Minimal number of columns for the current window. This is not a hard + minimum, Vim will use fewer columns if there is not enough room. If + the current window is smaller, its size is increased, at the cost of + the width of other windows. Set it to 999 to make the current window + always fill the screen. Set it to a small number for normal editing. + The width is not adjusted after one of the commands to change the + width of the current window. + 'winwidth' applies to the current window. Use 'winminwidth' to set + the minimal width for other windows. + ''; + extraHelp = [ "winminwidth" ]; + }; + + wrapscan = { + type = bool; + vimDefault = true; + description = '' + Searches wrap around the end of the file. Also applies to |]s| and + |[s|, searching for spelling mistakes. + ''; + }; + + write = { + type = bool; + vimDefault = true; + description = '' + Allows writing files. When not set, writing a file is not allowed. + Can be used for a view-only mode, where modifications to the text are + still allowed. Can be reset with the |-m| or |-M| command line + argument. Filtering text is still possible, even though this requires + writing a temporary file. + ''; + }; + + writeany = { + type = bool; + vimDefault = false; + description = '' + Allows writing to any file with no need for "!" override. + ''; + }; + + writebackup = { + type = bool; + vimDefault = true; + description = '' + Make a backup before overwriting a file. The backup is removed after + the file was successfully written, unless the 'backup' option is + also on. + WARNING: Switching this option off means that when Vim fails to write + your buffer correctly and then, for whatever reason, Vim exits, you + lose both the original file and what you were writing. Only reset + this option if your file system is almost full and it makes the write + fail (and make sure not to exit Vim until the write was successful). + See |backup-table| for another explanation. + When the 'backupskip' pattern matches, a backup is not made anyway. + Depending on 'backupcopy' the backup is a new file or the original + file renamed (and a new file is written). + ''; + extraHelp = [ "backup" "backup-table" "backupskip" "backupcopy" ]; + }; + + writedelay = { + type = number; + vimDefault = 0; + description = '' + Only takes effect together with 'redrawdebug'. + The number of milliseconds to wait after each line or each flush + ''; + extraHelp = [ "redrawdebug" ]; + }; + }; + + window = with lib.types; sharedGlobalOrWindow // { + arabic = { + type = bool; + vimDefault = false; + description = '' + This option can be set to start editing Arabic text. + ''; + }; + + breakindent = { + type = bool; + vimDefault = false; + description = '' + Every wrapped line will continue visually indented (same amount of + space as the beginning of that line), thus preserving horizontal blocks + of text. + ''; + }; + + breakindentopt = { + type = commas; + vimDefault = [ ]; + description = '' + Settings for 'breakindent + ''; + }; + + colorcolumn = { + type = commas; + vimDefault = [ ]; + description = '' + '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. + ''; + }; + + concealcursor = { + type = str; + vimDefault = ""; + description = '' + Sets the modes in which text in the cursor line can also be concealed. + ''; + }; + + conceallevel = { + type = number; + vimDefault = 0; + description = '' + Determine how text with the "conceal" syntax attribute |:syn-conceal| + is shown + ''; + extraHelp = [ "syn-conceal" ]; + }; + + cursorbind = { + type = bool; + vimDefault = false; + description = '' + 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. 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"; + description = '' + When and how to draw the foldcolumn. Valid values are: + "auto": resize to the minimum amount of folds to display. + "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" ]; + }; + + foldenable = { + type = bool; + vimDefault = false; + description = '' + When off, all folds are open. This option can be used to quickly + switch between showing all text unfolded and viewing the text with + 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" ]; + }; + + foldexpr = { + type = str; + vimDefault = "0"; + description = '' + The expression used for when 'foldmethod' is "expr". It is evaluated + for each line to obtain its fold level. + ''; + extraHelp = [ "fold-expr" ]; + }; + + foldignore = { + type = str; + vimDefault = "#"; + description = '' + 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" ]; + }; + + foldlevel = { + type = number; + vimDefault = 0; + description = '' + Sets the fold level: Folds with a higher level will be closed. + 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" ]; + }; + + 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 = [ "{{{" "}}}" ]; + description = '' + The start and end marker used when 'foldmethod' is "marker". + ''; + }; + + foldmethod = { + type = (enum [ "manual" "indent" "expr" "marker" "syntax" "diff" ]); + vimDefault = "manual"; + description = '' + The kind of folding used for the current window. + ''; + extraHelp = [ + "fold-manual" + "fold-indent" + "fold-expr" + "fold-marker" + "fold-syntax" + "fold-diff" + ]; + }; + + foldminlines = { + type = number; + vimDefault = 1; + description = '' + Sets the number of screen lines above which a fold can be displayed + closed. Also for manually closed folds. + ''; + }; + + foldnestmax = { + type = number; + vimDefault = 20; + description = '' + 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. + ''; + }; + + foldtext = { + type = str; + vimDefault = "foldtext()"; + description = '' + An expression which is used to specify the text displayed for a closed fold. + ''; + extraHelp = [ "fold-foldtext" ]; + }; + + linebreak = { + type = bool; + vimDefault = false; + description = '' + If on, Vim will wrap long lines at a character in 'breakat' rather + 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. + ''; + }; + + list = { + type = bool; + vimDefault = false; + description = '' + List mode: By default, show tabs as ">", trailing spaces as "-", and + 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" ]; + }; + + listchars = { + type = submodule { + options = + let + inherit (builtins) stringLength; + mkListcharsOption = k: { description, min ? 1, max ? 1 }: mkVimOptOption k { + type = lib.types.str; + apply = x: + assert ( + (x == null || (stringLength x >= min /*&& stringLength x <= max*/)) + # ^^^^^^^ + # FIXME: stringLength doesn't support utf8 characters. + || abort '' + The number of characters ${x} does not correspond to the boundaries + (min: ${toString min}; max: ${toString max}) + '' + ); + x; + inherit description; + }; + in + (mapAttrs mkListcharsOption { + eol = { + description = '' + Character to show at the end of each line. When + omitted, there is no extra character at the end of the + line. + ''; + }; + + tab = { + description = '' + Two or three characters to be used to show a tab. + The third character is optional. + ''; + max = 3; + }; + + space = { + description = '' + Character to show for a space. When omitted, spaces are left blank. + ''; + }; + + multispace = { + description = '' + One or more characters to use cyclically to show for + multiple consecutive spaces. Overrides the "space" + setting, except for single spaces. + ''; + max = 99; + }; + + lead = { + description = '' + Character to show for leading spaces. When omitted, + leading spaces are blank. Overrides the "space" and + "multispace" settings for leading spaces. + ''; + }; + + leadmultispace = { + description = '' + Like the |lcs-multispace| value, but for leading + spaces only. Also overrides |lcs-lead| for leading + multiple spaces. + ''; + max = 99; + }; + + trail = { + description = '' + Character to show for trailing spaces. When omitted, + trailing spaces are blank. Overrides the "space" and + "multispace" settings for trailing spaces. + ''; + }; + + extends = { + description = '' + Character to show in the last column, when 'wrap' is + off and the line continues beyond the right of the + screen. + ''; + }; + + precedes = { + description = '' + Character to show in the first visible column of the + physical line, when there is text preceding the + character visible in the first column. + ''; + }; + + conceal = { + description = '' + Character to show in place of concealed text, when + 'conceallevel' is set to 1. A space when omitted. + ''; + }; + + nbsp = { + description = '' + Character to show for a non-breakable space character + (0xA0 (160 decimal) and U+202F). + ''; + }; + }); + }; + }; + + 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 =). + ''; + }; + + rightleft = { + type = bool; + vimDefault = false; + description = '' + When on, display orientation becomes right-to-left, i.e., characters + that are stored in the file appear from the right to the left. + Using this option, it is possible to edit files for languages that + are written from the right to the left such as Hebrew and Arabic. + ''; + extraHelp = [ "rileft.txt" ]; + }; + + rightleftcmd = { + type = enum [ "search" ]; + vimDefault = "search"; + description = '' + Each word in this option enables the command line editing to work in + right-to-left mode for a group of commands: + + search "/" and "?" commands + ''; + extraHelp = [ "rightleft" ]; + }; + + scroll = { + type = number; + vimDefault = 0; + description = '' + Number of lines to scroll with CTRL-U and CTRL-D commands. Will be + set to half the number of lines in the window when the window size + changes. This may happen when enabling the |status-line| or + 'tabline' option after setting the 'scroll' option. + If you give a count to the CTRL-U or CTRL-D command it will + be used as the new value for 'scroll'. Reset to half the window + height with ":set scroll=0". + ''; + extraHelp = [ "CTRL-U" "CTRL-D" ]; + }; + + scrollbind = { + type = bool; + vimDefault = false; + description = '' + See also |scroll-binding|. When this option is set, the current + window scrolls as other scrollbind windows (windows that also have + this option set) scroll. This option is useful for viewing the + differences between two versions of a file, see 'diff'. + See |'scrollopt'| for options that determine how this option should be + interpreted. + This option is mostly reset when splitting a window to edit another + file. This means that ":split | edit file" results in two windows + with scroll-binding, but ":split file" does not. + ''; + 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" ]; + }; + + winblend = { + type = number; + vimDefault = 0; + description = '' + Enables pseudo-transparency for a floating window. Valid values are in + the range of 0 for fully opaque window (disabled) to 100 for fully + transparent background. Values between 0-30 are typically most useful. + + UI-dependent. Works best with RGB colors. 'termguicolors' + ''; + extraHelp = [ "termguicolors" ]; + }; + + winhighlight = { + type = commas; + vimDefault = [ ]; + description = '' + Window-local highlights. Comma-delimited list of highlight + |group-name| pairs "{hl-from}:{hl-to},..." where each {hl-from} is + a |highlight-groups| item to be overridden by {hl-to} group in + the window. + + Note: highlight namespaces take precedence over 'winhighlight'. + See |nvim_win_set_hl_ns()| and |nvim_set_hl()|. + + Highlights of vertical separators are determined by the window to the + left of the separator. The 'tabline' highlight of a tabpage is + decided by the last-focused window of the tabpage. Highlights of + the popupmenu are determined by the current window. Highlights in the + message area cannot be overridden. + ''; + extraHelp = [ + "group-name" + "highlight-groups" + "nvim_win_set_hl_ns()" + "nvim_set_hl" + ]; + }; + + winfixheight = { + type = bool; + vimDefault = false; + description = '' + Keep the window height when windows are opened or closed and + 'equalalways' is set. Also for |CTRL-W_=|. Set by default for the + |preview-window| and |quickfix-window|. + The height may be changed anyway when running out of room. + ''; + extraHelp = [ "equalalways" "CTRL-W_=" "preview-window" "quickfix-window" ]; + }; + + winfixwidth = { + type = bool; + vimDefault = false; + description = '' + Keep the window width when windows are opened or closed and + 'equalalways' is set. Also for |CTRL-W_=|. + The width may be changed anyway when running out of room. + ''; + extraHelp = [ "equalalways" "CTRL-W_=" ]; + }; + + wrap = { + type = bool; + vimDefault = true; + description = '' + This option changes how text is displayed. It doesn't change the text + in the buffer, see 'textwidth' for that. + When on, lines longer than the width of the window will wrap and + displaying continues on the next line. When off lines will not wrap + and only part of long lines will be displayed. When the cursor is + moved to a part that is not shown, the screen will scroll + horizontally. + The line will be broken in the middle of a word if necessary. See + 'linebreak' to get the break at a word boundary. + ''; + extraHelp = [ "textwidth" "linebreak" ]; + }; + }; + + buffer = with lib.types; sharedGlobalOrBuffer // { + autoindent = { + type = bool; + vimDefault = true; + description = '' + Copy indent from current line when starting a new line (typing + 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. + ''; + }; + + binary = { + type = bool; + vimDefault = false; + description = '' + This option should be set before editing a binary file. You can also + use the |-b| Vim argument. + ''; + }; + + bomb = { + type = bool; + vimDefault = false; + description = '' + When writing a file and the following conditions are met, a BOM (Byte + Order Mark) is prepended to the file: + - this option is on + - the 'binary' option is off + - 'fileencoding' is "utf-8", "ucs-2", "ucs-4" or one of the little/big + endian variants. + ''; + }; + + bufhidden = { + type = (enum [ "" "hide" "unload" "delete" "wipe" ]); + vimDefault = ""; + description = '' + This option specifies what happens when a buffer is no longer + displayed in a window + ''; + }; + + buflisted = { + type = bool; + vimDefault = true; + description = '' + When this option is set, the buffer shows up in the buffer list. + ''; + }; + + buftype = { + type = (enum [ "" "acwrite" "help" "nofile" "nowrite" "quickfix" "terminal" "prompt" ]); + vimDefault = ""; + description = '' + This option is used together with 'bufhidden' and 'swapfile' to + specify special kinds of buffers. + ''; + extraHelp = [ "special-buffers" ]; + }; + + cindent = { + type = bool; + vimDefault = false; + description = '' + Enables automatic C program indenting. + ''; + }; + + cinkeys = { + type = str; + vimDefault = "0{,0},0),0],:,0#,!^F,o,O,e"; + description = '' + A list of keys that, when typed in Insert mode, cause reindenting of + the current line. + ''; + }; + + cinoptions = { + type = str; + vimDefault = ""; + description = '' + The 'cinoptions' affect the way 'cindent' reindents lines in a C + program. + ''; + extraHelp = [ "cinoptions-values" ]; + }; + + cinwords = { + type = commas; + vimDefault = [ "if" "else" "while" "do" "for" "switch" ]; + description = '' + 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" ]; + description = '' + 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" + ''; + }; + + comments = { + type = commas; + vimDefault = '' + [ + "s1/*" + "mb:8" + "ex:*/" + "://" + "b:#" + ":%" + ":XCOMM" + "n:>" + "fb:-" + ] + ''; + description = '' + list of strs that can start a comment line. + ''; + extraHelp = [ "format-comments" ]; + }; + + commentstring = { + type = str; + vimDefault = ""; + description = '' + 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" ]; + description = '' + This option specifies how keyword completion |ins-completion| works + when CTRL-P or CTRL-N are used. + ''; + extraHelp = [ "ins-completion" ]; + }; + + completefunc = { + type = str; + vimDefault = ""; + description = '' + This option specifies a function to be used for Insert mode completion + with CTRL-X CTRL-U. + ''; + extraHelp = [ + "complete-functions" + "i_CTRL-X_CTRL-U" + ]; + }; + + copyindent = { + type = bool; + vimDefault = false; + description = '' + Copy the structure of the existing lines indent when autoindenting a + new line. Normally the new indent is reconstructed by a series of + tabs followed by spaces as required (unless |'expandtab'| is enabled, + 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" + "preverseindent" + ]; + }; + + 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; + description = '' + In Insert mode: Use the appropriate number of spaces to insert a + . Spaces are used in indents with the '>' and '<' commands and + when 'autoindent' is on. To insert a real tab when 'expandtab' is + on, use CTRL-V. See also |:retab| and |ins-expandtab|. + ''; + }; + + fileencoding = { + type = str; + vimDefault = ""; + description = '' + File-content encoding for the current buffer. Conversion is done with + iconv() or as specified with 'charconvert'. + + When 'fileencoding' is not UTF-8, conversion will be done when + 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). + ''; + }; + + fileformat = { + type = (enum [ "dos" "unix" "mac" ]); + vimDefault = '' + Windows default: "dos", + Unix default: "unix" + ''; + description = '' + This gives the of the current buffer, which is used for + reading/writing the buffer from/to a file: + - dos + - unix + - mac + When "dos" is used, CTRL-Z at the end of a file is ignored. + ''; + }; + + filetype = { + type = str; + vimDefault = ""; + description = '' + When this option is set, the FileType autocommand event is triggered. + + Otherwise this option does not always reflect the current file type. + This option is normally set when the file type is detected. To enable + this use the ":filetype on" command. |:filetype| + + When a dot appears in the value then this separates two filetype names. + ''; + extraHelp = [ ":filetype" ]; + }; + + fixendofline = { + type = bool; + vimDefault = true; + description = '' + When writing a file and this option is on, at the end of file + will be restored if missing. Turn this option off if you want to + preserve the situation from the original file. + When the 'binary' option is set the value of this option doesn't + matter. + ''; + extraHelp = [ + "binary" + "endofline" + "eol-and-eof" + ]; + }; + + formatexpr = { + type = str; + vimDefault = ""; + description = '' + 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. + ''; + }; + + formatlistpat = { + type = str; + vimDefault = ''^\s*\d\+[\]:.)}\t ]\s*''; + description = '' + A pattern that is used to recognize a list header. This is used for + the "n" flag in 'formatoptions'. + + The default recognizes a number, followed by an optional punctuation + ''; + extraHelp = [ "formatoptions" ]; + }; + + formatoptions = { + type = str; + vimDefault = "tcqj"; + description = '' + This is a sequence of letters which describes how automatic + formatting is to be done. + ''; + extraHelp = [ "fo-table" ]; + }; + + iminsert = { + type = number; + vimDefault = 0; + description = '' + Specifies whether :lmap or an Input Method (IM) is to be used in + Insert mode. Valid values: + - 0 :lmap is off and IM is off + - 1 :lmap is ON and IM is off + - 2 :lmap is off and IM is ON + ''; + }; + + imsearch = { + type = number; + vimDefault = -1; + description = '' + Specifies whether :lmap or an Input Method (IM) is to be used when + entering a search pattern. Valid values: + - -1 the value of 'iminsert' is used, makes it look like + 'iminsert' is also used when typing a search pattern + - 0 :lmap is off and IM is off + - 1 :lmap is ON and IM is off + - 2 :lmap is off and IM is ON + ''; + }; + + includexpr = { + type = str; + vimDefault = ""; + description = '' + Expression to be used to transform the str found with the 'include' + option to a file name. + ''; + }; + + indentexpr = { + type = str; + vimDefault = ""; + description = '' + 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. + ''; + }; + + indentkeys = { + type = str; + vimDefault = "0{,0},0),0],:,0#,!^F,o,O,e"; + description = '' + A list of keys that, when typed in Insert mode, cause reindenting of + the current line. + ''; + }; + + infercase = { + type = bool; + vimDefault = false; + description = '' + When doing keyword completion in insert mode |ins-completion|, and + 'ignorecase' is also on, the case of the match is adjusted depending + 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. + ''; + }; + + iskeyward = { + type = str; + vimDefault = "@,48-57,_,192-255"; + 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" ]; + }; + + keymap = { + type = str; + vimDefault = ""; + description = '' + Name of a keyboard mapping. + ''; + extraHelp = [ "mbyte-keymap" ]; + }; + + lisp = { + type = bool; + vimDefault = false; + description = '' + 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". + ''; + }; + + lispoptions = { + type = listOf str; + vimDefault = [ ]; + description = '' + list of items that influence the Lisp indenting when + enabled with the |'lisp'| option. Currently only one item is + supported: + + - expr:1 use 'indentexpr' for Lisp indenting when it is set + - expr:0 do not use 'indentexpr' for Lisp indenting (default) + ''; + 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" ]; + }; + + scrollback = { + type = number; + vimDefault = 10000; + description = '' + Maximum number of lines kept beyond the visible screen. Lines at the + top are deleted if new lines exceed this limit. + Minimum is 1, maximum is 100000. + Only in |terminal| buffers. + ''; + 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 counts for while performing editing + operations, like inserting a or using . It "feels" like + s are being inserted, while in fact a mix of spaces and 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. + ''; + }; + + suffixesadd = { + type = commas; + vimDefault = [ ]; + description = '' + list of suffixes, which are used when searching for a + file for the "gf", "[I", etc. commands. + ''; + }; + + swapfile = { + type = bool; + vimDefault = true; + description = '' + Use a swapfile for the buffer. This option can be reset when a + swapfile is not wanted for a specific buffer. For example, with + confidential information that even root must not be able to access. + Careful: All text will be in memory: + - Don't use this for big files. + - Recovery will be impossible! + A swapfile will only be present when |'updatecount'| is non-zero and + 'swapfile' is set. + When 'swapfile' is reset, the swap file for the current buffer is + immediately deleted. When 'swapfile' is set, and 'updatecount' is + non-zero, a swap file is immediately created. + ''; + extraHelp = [ "updatecount" "swap-file" "dictionary" ]; + }; + + synmaxcol = { + type = number; + vimDefault = 3000; + description = '' + Maximum column in which to search for syntax items. In long lines the + text after this column is not highlighted and following lines may not + be highlighted correctly, because the syntax state is cleared. + This helps to avoid very slow redrawing for an XML file that is one + long line. + Set to zero to remove the limit. + ''; + }; + + syntax = { + type = str; + vimDefault = ""; + description = '' + When this option is set, the syntax with this name is loaded, unless + syntax highlighting has been switched off with ":syntax off". + + Otherwise this option does not always reflect the current syntax (the + b:current_syntax variable does). + This option is most useful in a modeline, for a file which syntax is + not automatically recognized. + ''; + extraHelp = [ "modeline" ]; + }; + + tabstop = { + type = number; + vimDefault = 8; + description = '' + Number of spaces that a in the file counts for. Also see + the |:retab| command, and the 'softtabstop' option. + + Note: Setting 'tabstop' to any other value than 8 can make your file + appear wrong in many places. + The value must be more than 0 and less than 10000. + ''; + extraHelp = [ ":retab" "softtabstop" ]; + }; + + tagfunc = { + type = str; + vimDefault = ""; + description = '' + This option specifies a function to be used to perform tag searches. + The function gets the tag pattern and should return a List of matching + tags. See |tag-function| for an explanation of how to write the + function and an example. + ''; + extraHelp = [ "tag-function" ]; + }; + + textwidth = { + type = number; + vimDefault = 0; + description = '' + Maximum width of text that is being inserted. A longer line will be + broken after white space to get this width. A zero value disables + this. + When 'textwidth' is zero, 'wrapmargin' may be used. See also + 'formatoptions' and |ins-textwidth|. + When 'formatexpr' is set it will be used to break the line. + ''; + extraHelp = [ "wrapmargin" "formatoptions" "formatexpr" "ins-textwidth" ]; + }; + + undofile = { + type = bool; + vimDefault = false; + description = '' + When on, Vim automatically saves undo history to an undo file when + writing a buffer to a file, and restores undo history from the same + file on buffer read. + The directory where the undo file is stored is specified by 'undodir'. + For more information about this feature see |undo-persistence|. + The undo file is not read when 'undoreload' causes the buffer from + before a reload to be saved for undo. + When 'undofile' is turned off the undo file is NOT deleted. + ''; + extraHelp = [ "undo-persistence" "undodir" "undoreload" ]; + }; + + varsofttabstop = { + type = str; + vimDefault = ""; + description = '' + A list of the number of spaces that a counts for while editing, + such as inserting a or using . It "feels" like variable- + width s are being inserted, while in fact a mixture of spaces + and s is used. Tab widths are separated with commas, with the + final value applying to all subsequent tabs. + + Note that the value of |'softtabstop'| will be ignored while + 'varsofttabstop' is set. + ''; + extraHelp = [ "softtabstop" ]; + }; + + vartabstop = { + type = str; + vimDefault = ""; + description = '' + A list of the number of spaces that a in the file counts for, + separated by commas. Each value corresponds to one tab, with the + final value applying to all subsequent tabs. + + Note that the value of |'tabstop'| will be ignored while 'vartabstop' + is set. + ''; + extraHelp = [ "tabstop" ]; + }; + + wrapmargin = { + type = bool; + vimDefault = true; + description = '' + Number of characters from the right window border where wrapping + starts. When typing text beyond this limit, an will be inserted + and inserting continues on the next line. + Options that add a margin, such as 'number' and 'foldcolumn', cause + the text width to be further reduced. + When 'textwidth' is non-zero, this option is not used. + See also 'formatoptions' and |ins-textwidth|. + ''; + extraHelp = [ "number" "foldcolumn" "textwidth" "formatoptions" "ins-textwidth" ]; + }; + }; + + opts = mapAttrs (_: mapAttrs (k: v: mkVimOptOption (builtins.trace k k) v)) { + inherit global window buffer; + }; +in +opts // { all = opts.global // opts.window // opts.buffer; } diff --git a/modules/vim/opts.nix b/modules/vim/opts.nix index f2ea2fd..34aca32 100644 --- a/modules/vim/opts.nix +++ b/modules/vim/opts.nix @@ -1,22 +1,13 @@ { config, lib, ... }: +let options = import ./options.nix { inherit lib; }; in { options.vim = with lib; with types; { g = mkOption { type = attrsOf (oneOf [ str bool number ]); default = { }; }; - opt = mkOption { - type = attrsOf anything; - default = { }; - description = '' - A special interface |vim.opt| exists for conveniently interacting with list- - and map-style option from Lua: It allows accessing them as Lua tables and - offers object-oriented method for adding and removing entries. - - `:help vim.opt` - ''; - }; + opt = options.all; # TODO: think more about vim.cmd namedCmd = mkOption { -- 2.46.1