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&...
-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, ...
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= ...
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 ...
1 vote
3 answers
234 views

Unable to :set printoptions for :hardcopy command

Just started using :hardcopy > x.ps to generate input to ps2pdf. Result is satisfactory but I would like to change the printoptions to non-default values for header, margins and page size, e.g. set ...
2 votes
1 answer
198 views

Cypher syntax file asks about commentstring on open

I am using syntax highlighting on my Cypher scripts from https://github.com/memgraph/cypher.vim. (I would open an issue there but the project and its predecessor haven't been touched in 3 years.) ...
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 ...
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 ...
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, ...
2 votes
1 answer
38 views

How do I prevent/remove/delete temp files?

When I create .txt files using Vim the following files are also created. How do I prevent/remove/auto-delete the files ending in ~?
5 votes
1 answer
171 views

How to disable mouse scroll wheel when in normal mode?

I want to completely disable the mouse but mouse scrolling in normal mode is not disabled. I have disabled other mouse function but scrolling in normal mode is still on. To disable the mouse I have ...
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 ...
0 votes
2 answers
515 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 ...
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 ...
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 ...
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 ...
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 ...
4 votes
1 answer
118 views

How to get autocomplete for :set?

E.g. I am trying to change foldmethod to syntax: :set foldmethod=s^I^I When I press tab after typing s, I get ^I instead of auto-completing to syntax. Only possible options are manual,indent,expr,...
1 vote
1 answer
149 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.
1 vote
2 answers
601 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 ...
44 votes
1 answer
15k views

Setting a vim option from the command line?

How does one set a vim option when launching from bash or another shell?
0 votes
0 answers
25 views

how to reference variables in config [duplicate]

Let's take undodir as an example; we might have something like this in our vimrc: set undodir=$HOME/.config/nvim/undo/ In order to make config platform-agnostic one might want to use variables ...
2 votes
2 answers
339 views

How do I delete/unset a buffer local option (such as autoread)?

In a new buffer, the expression &l:autoread evaluates to the value -1, indicating that the local option autoread has not yet been set with :setl autoread or :setl noautoread. When I set the local ...
3 votes
1 answer
300 views

showcmd on first line instead of last line

From the help file for showcmd: Show (partial) command in the last line of the screen Is it possible to have the commands displayed on the first line instead? I can't find anything in the help or ...
-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 ...
34 votes
3 answers
6k views

How to apply a setting in all open tabs and windows?

Is there an option to apply a setting in all tabs and windows, e.g. apply :set number to all open tabs?
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: :...
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:...
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 ...
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 . &...
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 ...
1 vote
1 answer
370 views

What does 'set setting^=value' really mean?

There is an old question here about best practices to store swap files, and there is an answer by flemingfleming (who haven't visited the site since 2018) where he suggested the following: set ...
20 votes
4 answers
4k views

How can I suppress the "reading from STDIN" message from within Vim?

When using Vim to read from stdin, it prints a informative message: $ echo foo | vim - Vim: Reading from stdin... $ This is just an example. The actual use doesn't allow shell constructs. vim <(...
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 ...
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 ...
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 ...
0 votes
0 answers
764 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/...
3 votes
2 answers
853 views

Help understanding options hidden and nostartofline

I am writing my first vimrc. I already read help pages for hidden and nostartofline options, as well as some articles and other FAQs. However, I still can't understand what the purpose of these two ...
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 ...
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 ...
43 votes
3 answers
26k views

When to use the after/ directory?

I understand it's the place to put things that should have the final say and not be overridden by another source, but I'm unclear on how to decide when to put something in, say, ~/.vim/after/ftplugin/ ...
1 vote
1 answer
284 views

Options such as expandtab reset based on which file I edit

My ~/.vimrc contains the following: set noet set ts=8 set sw=8 When I open vim without arguments: :set et? -> noexpandtab and :set sw? -> shiftwidth=8 but when I open a file: :e somefile.py :...
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 ...
22 votes
3 answers
2k views

The simplest way to start Vim in private mode

I want to be able to easily start Vim in a private mode. Let's define a private mode as one that utilizes this set of commands: set history=0 set nobackup set nomodeline set noshelltemp set ...
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, ...