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
35
votes
1answer
11k views

Setting a vim option from the command line?

How does one set a vim option when launching from bash or another shell?
26
votes
2answers
4k 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?
22
votes
3answers
10k 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/ ...
21
votes
2answers
7k views

How do I check the value of a Vim option in Vimscript?

In Vimscript, how can I check the current value of a Vim option? To elaborate, I want to make a command to switch from Full-GUI Mode ( guioptions=+tM) to Hacker Mode (guioptions=-tM). However, I can'...
21
votes
3answers
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 ...
20
votes
4answers
3k 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 <(...
19
votes
2answers
1k views

Can I use Vi or Vim with screen readers and/or Braille devices?

Can I use Vi or Vim with screen readers and/or Braille devices? If so, how would I go about it? Does it require any special setup?
18
votes
4answers
870 views

Set the paste option, but for one insertion only

I want to have a quick way of setting the Vim 'paste' option, inserting some text, and reverting to the previous value of 'paste'. A typical use case insert the OS clipboard content literally, ...
12
votes
3answers
426 views

UI to personalize a vimrc without writing one from scratch

Vim is so infinitely configurable. However, devising a vimrc is a daunting task for novices and intermediate users. Basically, you're expected to develop one from a blank slate by reading the ...
12
votes
2answers
7k views

Showing command history with showcmd

When using set showcmd Vim shows partial commands in the last line of the screen. For example, in Normal mode when typing the command dt. the last line shows dt and then, when you hit . the command is ...
11
votes
2answers
4k views

`set` option with variables

I am trying to rewrite adding a string to option with variable. The original string is set rtp+=~/.vim/bundle/Vundle.vim The following is the working let way: let MYVIMDIR='/home/loom/foo' let &...
11
votes
4answers
2k views

How to save and restore the result of the command 'set'?

From :h :set we know that :se[t] Show all options that differ from their default value. In a vimscript I'd like to save all these options which have been modified by the user, modify them and ...
11
votes
2answers
2k views

How to list the available options of a plugin?

I recently found out that YouCompleteMe has an g:ycm_autoclose_preview_window_after_insertion option that automatically hides the documentation preview window after exiting insert mode, and I also ...
9
votes
1answer
2k 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: :...
8
votes
1answer
585 views

What controls indentation of lines following an open square bracket when using cindent?

I am trying to build my own indent file for JavaScript. The default indent file for JavaScript turns cindent on, with minimal modifications, and I am using that as a base. On Vim 7.3 for OSX El ...
7
votes
3answers
306 views

Is there a way to set an option to the value of another option?

For example, I'd like to set set tabstop=4 set shiftwidth=4 Is there a way to do something like set tabstop=4 set shiftwidth=tabstop so I can set both values by only changing a single number?
7
votes
1answer
938 views

How to show trailing spaces, while leaving tabs as they are?

I like the ability to show trailing whitespaces, so I have this setting. set list listchars=tab:\ \ ,trail:· I never use tabs (although I don't think tabs are bad, it's just a convention), but ...
7
votes
1answer
77 views

Why are tabs adjacent to concealed tabs displayed wider than a single tabstop?

I just wrote the following code in an answer to another question: syntax match HideTwoIndents /\v^\t(\t)?/ conceal set conceallevel=2 This works great if 'list' is set and if 'listchars' does not ...
6
votes
7answers
1k views

Is there a vim command line option to edit last edited file?

Is there a way to run vim from command line to edit the last edited file? Let say I first edit file giorgio.sh: $ vi giorgio.sh Afterwards, I exit back to terminal $ do something... $ do something ...
6
votes
1answer
218 views

How do I exclude the → from file name characters?

I have several files that prefix file names with a → character, for example In →path/to/some/file, there is a foo, in →path/to/other/file, there is a bar. etc. When the cursor is over such a path, I'...
6
votes
2answers
1k views

Is it possible to change the message display location?

If editing a buffer in the right side window when using two vertical split windows in a big display screen, we have to move our eyes all across the screen to the bottom left corner to see any messages ...
6
votes
0answers
221 views

What is the default "effective" titlestring?

Is the effective default value for titlestring documented somewhere? By effective, I mean the one that displays $(basename) ($(dirname)) (m of n) - GVIM1 or ... ((m) of n), even though titlestring is ...
5
votes
3answers
555 views

Is there a trick to set 'ignorecase' locally

ignorecase is a global option, so it's not possible to locally set ic :setlocal ic This is a bit unfortunate, since I work on buffers in which I need to search case insensitively and other buffers ...
5
votes
1answer
3k views

Can I set multiple 'options' with a single `:set` command spread over multiple lines?

Is there any way to set options typed on multiple lines with a single :set command? Here is a part of my vimrc: se nu se sm se hls And as you see, I have se on every line in which I set an option. ...
5
votes
1answer
127 views

Are spaces OK in set statements?

Is it OK to use spaces for better readability in a .vimrc? For example, right now I have: set number| "show line numbers set history=1000 Would it be OK to write instead: set number | "show line ...
5
votes
2answers
1k views

In VIM, Change the number that relative lines numbers start from

I've turned on vim's relative line numbers, it starts from 0 but doing somthing like 10dd means I only get up to line 9, leaving the last one behind (becuase it's 10 including the current line). Yes, ...
5
votes
1answer
195 views

cpoptions and parenthesis text objects

Haskell has a literal syntax for anonymous functions of \pattern0 pattern1 [...] patternN -> expression which interacts oddly with vim's parenthesis text objects when pattern0 starts with a (. ...
4
votes
1answer
90 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 ...
4
votes
5answers
355 views

Can I define something in .vimrc to speed up pasting of large amounts of data?

Occasionally, I paste large amounts of data into vim, using Ctrl+v in my terminal emulator (in Linux). This takes several seconds before vim is responsive again. I have tried two other methods, which ...
4
votes
2answers
233 views

Change the looks of the character limit ruler

I wonder if there is a way to have a ruler displayed between the 80th and the 81th character in vim. I know that one can highlight the 81th column, but that actually looks as ugly as something from ...
4
votes
1answer
203 views

Strange interaction of set hidden, shortmess and the status line

My .vimrc contains set hidden set shortmess=fotx I start Vim 7.3 with vim a b I modify a (optional), then I save it and switch to the next file with :wn. Then I use :prev to return to the previous ...
4
votes
1answer
649 views

Vimscript insert after cursor

I am aware of the startinsert command which switch to insert mode as if the i key was pressed. With the ! it behaves like A. Do you know if there is some kind of option to go to insert mode like we ...
3
votes
2answers
281 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 ...
3
votes
2answers
920 views

Why are ^ and $ still magic in nomagic mode?

In 'nomagic' mode, ^ and $ have a special meaning and no others do. Why were these selected, rather than making people type \^ and \$ just as they do for \. and \*? EDIT: I have been able to confirm ...
3
votes
1answer
4k views

Differences between local & global

From :h 'ar': ...If this option has a local value, use this command to switch back to using the global value: :set autoread< What do local & global value exactly mean? I ...
3
votes
1answer
76 views

How do I set an option only if there are multiple windows?

Sometimes when I load several buffers at once into multiple windows I might get confused with the position of the cursor, I get lost when I change from buffer to buffer. Therefore I'd like to trigger ...
3
votes
1answer
168 views

Does each indention option override the previous one?

From :h indent.txt: ...each one overrides the previous if it is enabled... Now if I set 'cin' after 'ai', Does 'cin' disable the effect of 'ai'?. If no, so what is the purpose of "override" ...
3
votes
1answer
135 views

How to not display a certain error

My situation is, I have set nowrapscan, however now, when I hit the end of a file, it will display E385: search hit BOTTOM without match for: \v^[^=]*(… How can I avoid that from displaying? I used ...
3
votes
1answer
64 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 ...
3
votes
1answer
2k views

How to display invoked keystrokes and commands in normal mode? [duplicate]

How I can activate option which will display my pressed keystrokes or executed commands in normal mode on the screen? Especially it would be good, if it would give a slight info what specific ...
2
votes
2answers
590 views

set formatprg dynamically based on textwidth?

I've set formatprg in my vimrc to use the par text formatter when I type gq. setg formatprg=par\ -w90 When I'm in a buffer whose textwidth has been set (e.g. the gitcommit filetype sets textwidth=72)...
2
votes
1answer
34 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, ...
2
votes
2answers
404 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 ...
2
votes
2answers
549 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 ...
2
votes
1answer
106 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 ...
2
votes
1answer
192 views

Sourcing vimrc changes vimrc's formatoptions

I do vim .vimrc and my vimrc opens with formatoptions=jcroql. Then I do :source .vimrc and check the formatoptions again; they changed to tcq. As far as I know there's nothing in my file that ...
2
votes
1answer
300 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 ...
2
votes
1answer
118 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 ...
2
votes
1answer
785 views

Problem converting the string "0.5" to a number

I'm currently reading Learn Vimscript the Hard Way. I did the following experiments as an exercise in the book. :let &wrap="1.5" :let &wrap="0.5" :let &wrap=str2nr("0.5",8) The first one ...
2
votes
1answer
228 views

How to disable extends/precedes charaters in nowrap

I want to view a big blob of text (ascii-graphics), but when I use :set nowrap some < and > symbols appears at the left and right borders of the buffer window. They are kinda annoying and I ...