Skip to main content

Questions tagged [options]

For questions about runtime settings that modify the behavior of the editor. When applicable, tag the version of the editor.

Filter by
Sorted by
Tagged with
0 votes
1 answer
28 views

What does this command do?

In vim fandom wiki I found this command: nnoremap \z :setlocal foldexpr=(getline(v:lnum)=~@/)?0:(getline(v:lnum-1)=~@/)\\|\\|(getline(v:lnum+1)=~@/)?1:2 foldmethod=expr foldlevel=0 foldcolumn=2<CR&...
Antonio's user avatar
  • 289
-1 votes
2 answers
36 views

What options shall be set for loading ftplugins? [duplicate]

Consider the following script: vim9script filetype plugin indent on import "./plugin/myplugin.vim" exe $"edit testfile.py" MyCommand In the specific case, ...
Barzi2001's user avatar
  • 640
1 vote
3 answers
130 views

Is it possible to set the local value of showbreak to "nothing"?

When working with markdown files, I want the Neovim/Vim editor to not show anything when a line is wrapped. The desired behavior can be achieved using these settings in.vimrc: set wrap set showbreak= ...
Ярослав Рахматуллин's user avatar
0 votes
1 answer
50 views

Is there any difference between set some_option=something and &some_option = something?

I may be wrong, but it feels like that set some_option = ... is a sort of old way for setting options, whereas &some_option = ... seems newer and it appears more powerful. In-fact, the latter ...
Barzi2001's user avatar
  • 640
1 vote
3 answers
72 views

Is there an option that can be set for programs such as start/xdg-open/open/... to open files?

I am wondering about the existence of an option 'startprg' that is set by default depending on the OS that indicate what program to use when using a possible, hypothetical start command. For example, ...
Barzi2001's user avatar
  • 640
0 votes
2 answers
75 views

How to escape spaces when setting options in vimscript?

I am trying to set an option in my init.vim or .vimrc. Specifically, it is the path variable, and I need to set it to a value that contains spaces; for example, this could be because several of the ...
Tom Warner's user avatar
0 votes
2 answers
51 views

How to enforce settings on debian Vim?

I have some settings in my debian (in /etc/vim/vimrc.local), which are overwritten by some plugins. Exactly which ones, at the moment is it hard to say, however I find it quite an annoying one. I ...
peterh's user avatar
  • 1,161
2 votes
1 answer
128 views

How to set the value of 'foldexpr' to be a lua function?

I have read the documentation on foldexpr, and I have read through Possible to set `foldexpr` using a function reference?. I have tried this: vim.o.foldexpr = function() return "1" end ...
Ari Sweedler's user avatar
2 votes
1 answer
50 views

Setting an option to a string containing control characters

I'm trying to configure Vim to be able to properly determine the background color when run inside GNU Screen. I know I need to set the option t_RB to the string \eP\e]11;?\x03\e\\ (where \e is the ...
jwodder's user avatar
  • 123
1 vote
1 answer
139 views

Toggling the `spell` option with Lua does not redraw the screen until an additional command is entered

While porting my init.vim to init.lua, I noticed some strange behaviour. In vimscript, one can toggle spell in the following way: noremap <Leader>ss :setlocal spell!<CR> Observe that this ...
Phro's user avatar
  • 121
1 vote
1 answer
148 views

List Vim arguments options

Is there a way to list the command line arguments showed by vim -h or vim --help from within Vim? Besides :r!vim -h which seems to be a workaround to achieve this.
ranemirusG's user avatar
1 vote
2 answers
591 views

Why is Vim ignoring my `expandtab` setting?

In my vimrc, I have set expandtab. When I edit a Tex file, however, Vim inserts tab characters , instead of spaces , when I press tab. I figured noexpandtab must be set by the TeX ftplugin for some ...
Wil's user avatar
  • 21
0 votes
2 answers
510 views

How to display runtimepath value in echo or echomsg?

I have modified the 'runtimepath' in my .vimrc file. As I am having problems of not found files, I would like to display the runtimepath value in an :echo or :echomsg I already know about the ...
aturegano's user avatar
  • 189
0 votes
2 answers
45 views

Can I copy options (everything shown when I run `:set` with no arguments) between active windows

I have two windows opened in the same terminal. These are actual vim windows within the same vim instance. The first window is a .py file which has many options set by default, plus additional options ...
Z4-tier's user avatar
  • 153
3 votes
2 answers
313 views

Statusline vs Rulerformat - What is the Difference?

What is the purpose of the ruler? I have recently learned about the statusline and the rulerformat, and was wondering what the difference between them is. Why does the ruler exist? Why can't you only ...
Bog's user avatar
  • 489
1 vote
1 answer
97 views

Specify sorting in wildmenu list?

EDIT per accepted answer below, I have the following: function! MySortDirEnts(ent1, ent2) if a:ent1[strchars(a:ent1)-1] == '/' && a:ent2[strchars(a:ent2)-1] != '/' return -1 elseif a:...
Aaron Parisi's user avatar
1 vote
1 answer
27 views

Inconsistent string handling [duplicate]

I've been assembling strings in vimscript using a . as the join command. But when I try and use the same command to join a string when setting an option, such as: :setlocal foldtext=v:folddashes . &...
markling's user avatar
  • 389
-1 votes
1 answer
111 views

Specific filetype files should end with new line

my work project requires a newline at the end of a file. If I add a new line and save, it gets automatically removed. I work in Golang but the same behavior is observed in Lua, Rust and probably ...
Nikola-Milovic's user avatar
0 votes
1 answer
35 views

How do I move the cursor feely past the EOLs?

I vaguely remember I've read about this option and also tried it out, but I can't remember the name... It allows using l to move past the EOL, even though $ still brings you to the EOL, not to the ...
Enlico's user avatar
  • 2,224
2 votes
1 answer
1k views

How to set keywordprg to call a lua function in neovim?

A plugin unidentified is setting the keywordprg option to :Man but I want it to be LSP based. So I attempted set keywordprg=:lua\ vim.lsp.buf.signature_help() but it gives me the following error and ...
muppi090909's user avatar
2 votes
1 answer
1k views

How to configure options in :terminal (NeoVim)

I've read the help section for term, terminal, termopen, buftype, and I've read several stack questions, but I haven't been able to find a solution for settings options in terminal mode. I know about ...
jeffrey.d.m's user avatar
0 votes
0 answers
758 views

Mouse navigation not working in VIM

I started using VIM today and I found out that we could use the mouse pointer to go to a line in vim using set mouse=a But unfortunately, it is not working here is the config file https://pastebin.com/...
GN Vageesh's user avatar
2 votes
2 answers
209 views

Choose template option for newfiles in Vim?

I have different templates in this directory ~/Documents/Library/ like: Template.cpp, normal.cpp, advanced.cpp Normally I use this: autocmd BufNewFile *.cpp 0r ~/Documents/Library/Template.cpp I ...
Mega Bang's user avatar
  • 309
4 votes
2 answers
378 views

Change 'lastline' display character (@@@)

You can set display to lastline to see "@@@" at the end of the last line when it doesn't fit the screen. I'd prefer to use a different character for that purpose, such as ... or ---. Is ...
Luiz Martins's user avatar
0 votes
0 answers
160 views

Does vim have support for processing its comma-separated options?

Vim has comma-separated dictionary options like 'comments' and 'listchars': :set comments? comments=s:--[[,m: ,e:]],:-- :set listchars? listchars=tab:⇥ ,trail:␣,extends:⇉,precedes:⇇,nbsp:⚭ Commas ...
idbrii's user avatar
  • 661
6 votes
1 answer
347 views

remove from comma-separated option (listchars)?

I don't do tabs, so usually my listchars=tab:▸ ,nbsp:␠,trail:·,precedes:«,extends:» But it gets annoying with some sources. I'd like to subtract tab: from lcs in some filetypes. I've tried setlocal ...
usretc's user avatar
  • 374
2 votes
1 answer
398 views

Obscure Vim feature: +footer?

Inspecting some of Vim's features listed by vim --version I have noticed some obscure ones, for example, balloon_eval, balloon_eval_term and footer. There is an example in the documentation to test ...
Quasímodo's user avatar
  • 2,466
2 votes
1 answer
160 views

Options readonly vs nowrite

Apologies if this is duplicate. I have searched and haven't found any related questions. What is the difference between the options readonly and nowrite? The reference manual says: readonly: If on, ...
mgarort's user avatar
  • 275
0 votes
1 answer
49 views

How to copy the current value of a `set` option into the clipboard?

I sometimes need to copy the current value of a set option, e.g. set statusline, into the clipboard (+) to paste its value here. I know how to show the current value of a set option, e.g. set ...
Shuzheng's user avatar
  • 1,275
1 vote
0 answers
38 views

Can't redefine tabstop, softtabstop and softwidth after syntax detection

I've a vim: VIM - Vi IMproved 8.2 (2019 Dec 12, собрано Apr 8 2020 14:10:43) and I tried to redefine tabstop, softtabstop and softwidth values for a file after detection of its syntax. I.e. I have a ...
Малъ Скрылевъ's user avatar
2 votes
1 answer
59 views

Freeze after File No Longer Available Message

When I go to a buffer where the file was deleted Vim shows: E211: File "foo" no longer available Vim freezes for about a second before it resumes. Where can I change/disable this delay or ...
laktak's user avatar
  • 2,953
1 vote
1 answer
36 views

Is there a reason why the short for `'modifiable'` is `'ma'` and not `'mo'`?

Is there a reason why the short for 'modifiable' is 'ma' and not 'mo'? I've entered :h 'mo' and I got E149, so there doesn't seem to be any clash...
Enlico's user avatar
  • 2,224
0 votes
2 answers
120 views

How can I make a mapping to toggle cursorbind?

I know that adding a ! to the end of an option works for some commands, but it doesn't work for cursorbind. How can I toggle between cursorbind and nocursorbind with a keybinding?
twlscnds's user avatar
  • 103
1 vote
1 answer
566 views

Difference between buffer-local and global-local options

:h local-options says: for each buffer-local option there also is a global value, which is used for new buffers. With ":set" both the local and global value is changed. With "setlocal&...
Kvass's user avatar
  • 195
3 votes
1 answer
3k views

What are the benefits and use cases of relativenumber?

I have tried the relativenumber option several times, and I really don't get the point. People say that it's easier because they don't have to do the mental math of how many lines to go up or down ...
Thaddaeus Markle's user avatar
3 votes
0 answers
71 views

Wrong width for certain characters

Using this: https://github.com/vim/vim-win32-installer/releases/download/v8.2.1505/gvim_8.2.1505_x64.zip All of these characters (and perhaps others): ℹ ⌨ ⏏ ⏭ ⏮ ⏯ ⏱ ⏲ ⏸ ⏹ ⏺ ☀ ☁ ☂ ☃ ☄ ☎ ☑ ☝ ☠ ☠️ ☢ ☣ ☦ ☪...
Zombo's user avatar
  • 1
1 vote
0 answers
1k views

All of my Vim text is underlined

I have configured Vim and then noticed that all of my text is underlined for some reason. I am running WSL with the Hyper terminal and I also configured Vim using the Ultimate Vim Configuration. Is ...
user30800's user avatar
1 vote
0 answers
84 views

rulerformat truncated when filename included

Given the limited screen real estate on my device (27x48), I'm trying set laststatus=1 set rulerformat=%25(%<%f%M\ %=%l\|%c%) No matter the minwid prefix, or if I apply it to %() or %f, or if I ...
usretc's user avatar
  • 374
2 votes
2 answers
1k views

Typing Russian characters in vim with vim-LaTeX

Occasionally, I need to type documents in Russian in LaTeX format. To use Russian in vim I follow the guidelines from this Habr post. In short, I have the following settings in my .vimrc file: set ...
mabalenk's user avatar
  • 123
2 votes
0 answers
166 views

Tell vim to treat character as full width

I am wondering if it is possible to tell vim to treat an individial code point in the unicode plain. I am aware of the ambiwidth option, but it does not help with my current task because the relevant ...
Max Xiong's user avatar
  • 121
1 vote
2 answers
133 views

Is there a 'let' equivalent for setting an option only local to a buffer/window?

When working with options that often have complex or calculated string values (e.g. formatprg, which might have additional parameters, separated by whitespace), it's often easier to use let to set ...
Andrew Ferrier's user avatar
2 votes
0 answers
233 views

Check valid values of an option (e.g. check if completeopt+=popup is valid)

I want to know if I can use the popup option for my completeopt in the running version of vim/neovim. The example is just for clarity, I'm looking for a solution that is generic. I know I can check ...
silico-biomancer's user avatar
3 votes
1 answer
88 views

Unnamed buffer not using options from my vimrc

In my vimrc I use :setg tabstop=4 shiftwidth=4. Why aren't unnamed buffers set correctly with these values? Using VIM 8.2.460 (2019 Dec 12) I opened vim with some piped output and noticed tab width ...
Elizandro - SparcBR's user avatar
2 votes
1 answer
149 views

How to change in gvim GTK file browser the default file mask wildcard (glob)?

In gvim the command :browse confirm e launches a GTK file browser. The default file mask in this window depends on the filetype from which the browse window is invoked. I would like to change that ...
Janek_Kozicki's user avatar
4 votes
1 answer
1k views

what is the purpose of the view folder in the .vim folder?

I got an error when opening my .vimrc with vim saying ".vimrc" 138L, 3781C Error detected while processing /home/fbence/.vim/view/~=+.vimrc=: line 117: E518: Unknown option: termkey= line 118: ...
fbence's user avatar
  • 697
3 votes
2 answers
286 views

What is the proper way to allow the user of a plugin to modify settings?

So I have a plugin that I am writing which should allow the user to set whether they want to enable a feature. I want the feature to be disabled by default, and allow the user to change it by adding ...
Ryan Fredez's user avatar
12 votes
1 answer
3k views

How do I use a variable or return value in option, command, or mapping?

I have a variable foo with let foo='value', and a function F like function F() return 'value' endfunction and I want to use them in an option: :set option=foo, :set option=F(); or in a command: :...
D. Ben Knoble's user avatar
  • 26.6k
1 vote
0 answers
76 views

Is there an `edefault` in the spirit of `gdefault` for setting the appropriate flags in vim's substitution commands?

To perform a buffer-wide substitution on all occurrences of foo (and not just the 1st one in a line), we can do %s/foo/bar/g The g flag may be omitted by setting this in the vimrc as set ...
Dr Krishnakumar Gopalakrishnan's user avatar
2 votes
1 answer
1k views

NeoVim: Single-Line Comments Also Format the Next Line [duplicate]

So, I started using NeoVim a little while ago and discovered a rather annoying quirk when using C++-style single-line comments // in source code of any language. Specifically, when you create a new ...
Anadian's user avatar
  • 23
3 votes
1 answer
473 views

How to find all scripts which modified a certain vim setting?

I can figure out which script changed a vim setting the last time with :verbose set errorformat? However, sometimes a setting is modified/appended several times and I want to see all scripts who ...
Hotschke's user avatar
  • 4,790