Questions tagged [vimrc]

Vim reads initialization commands from a file called vimrc on startup. This can be used to set settings, define functions, execute autocommands, and more.

The vimrc file lives in $HOME/.vimrc or $HOME/.vim/vimrc on UNIX systems, and in $HOME/_vimrc or $HOME/_vimfiles/vimrc on MS Windows systems.

Neovim uses another configuration file located in ~/.config/nvim/init.vim or ~\AppData\Local\nvim\init.vimif you're using Windows 10.

You can see the currently used vimrc file with the $MYVIMRC variable, i.e. :echo $MYVIMRC.

There are many pre-made vimrc files on the internet. Popular ones are:

  • vim-sensible: Think of sensible.vim as one step above 'nocompatible' mode: a universal set of defaults that (hopefully) everyone can agree on.

  • spf13-vim: It is a good starting point for anyone intending to use VIM for development.

  • Janus: designed to provide minimal working environment using the most popular plug-ins and the most common mappings.

1822 questions
111
votes
8 answers

How do I debug my vimrc file?

I have a problem in Vim, and I think it may be in my vimrc file (or have been told it could be my vimrc file). How do I verify this? If it is my vimrc file, how do I know where exactly the problem lies?
Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
60
votes
3 answers

How do I reload my vimrc without leaving Vim?

When I do a change in my .vimrc, I usually exit Vim and open it again. Is there an easier way to reload the new .vimrc changes?
thameera
  • 17,434
  • 16
  • 40
  • 42
21
votes
2 answers

How to define a custom popup / menu in vimrc?

Assigning every useful function to a key works well for frequently used tools, but there are some operations I use so rarely, that I would prefer to assign them to some popup menu defined in my vimrc. I've seen plugins like CtrlP open a popup list…
ideasman42
  • 3,733
  • 3
  • 27
  • 34
20
votes
5 answers

How can put .vimrc and viminfo into .vim directory?

All the vim related files installed on /usr/share/vim/vim74. cd /home/debian8/ ls .vim* .viminfo .vimrc To create .vim directory to install some plugin for customization. mkdir .vim mkdir .vim/plugin mkdir .vim/autoload If .viminfo and…
showkey
  • 1,130
  • 2
  • 11
  • 30
16
votes
1 answer

What is command! -bang -nargs=* in a vimrc file?

I read a document about vim and the author suggest a line of code that should be put in .vimrc but I totally have no idea what it is. command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings…
Tuyen Pham
  • 1,306
  • 1
  • 13
  • 26
14
votes
2 answers

Display CR and LF rather than "EOL" in ':set list'

Rather than choosing one character to be displayed as the EOL character, I'd like one to display for both CR and LF separately and regardless of if the file is unix or dos. Is this possible?
Captain Man
  • 475
  • 1
  • 5
  • 9
13
votes
4 answers

Same vimrc, customized per machine

I use the same versioned .vimrc on several machines. Is there a way of customise that file to enable/disable a plugin based on machine name or something like that? As example, I have something like that in my .bash_profile: # common things ... if…
jherran
  • 285
  • 2
  • 12
13
votes
1 answer

Why is set exrc dangerous?

I've seen set exrc mentioned in various places for using per-directory .vimrc files, but every time it's been mentioned it's been with strong admonition not to actually use it because it's dangerous. I've also come across set secure which is…
SnoringFrog
  • 957
  • 6
  • 13
13
votes
1 answer

How to record my keyboard input to do statistics on it?

I would like to find out what are the most common patterns I'm using during coding. So I'm looking for a way to record all my keyboard input while I'm in Vim, preferably with timestamps. Then I could do some analysis on the most recent used…
6D65
  • 413
  • 3
  • 7
12
votes
4 answers

Environment Variable for Personal Runtime Path? (~/.vim on *nix, ~/vimfiles on win32)

I'm trying to move my .viminfo file into my .vim/ folder for cleaner syncing across multiple machines. (I have my .vim stored on Dropbox, and then create symlinks to it from my home directory.) So this morning, I found this answer on how to do just…
Ryan Lue
  • 891
  • 1
  • 6
  • 18
11
votes
2 answers

How do I make Vim wait indefinitely after leader key has been pressed?

I'm trying to make Vim wait after the leader key indefinitely without messing with the timeoutlen of other keys. Currently I have this lines in my vimrc: let mapleader=" " set timeoutlen=2000 ttimeoutlen=0 Setting ttimeoutlen make commands such as…
tjbrn
  • 563
  • 3
  • 12
11
votes
2 answers

Getting gx to open a url

I have gx which works with opening files. However, when I try and open a url, it always tries using wget: [No write since last change] dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib Referenced from: /usr/local/bin/wget …
David542
  • 2,445
  • 14
  • 50
11
votes
2 answers

How to make vimrc settings applicable for a directory tree only

Is there a way to make certain vimrc configuration valid only for files under a defined directory tree? Or alternatively, is there a way to have a .vimrc file in a directory, and make its setting override all $HOME/.vimrc for that directory and…
guido
  • 1,757
  • 1
  • 20
  • 25
11
votes
3 answers

What does "set iskeyword+=@-@" do?

I'm looking at a file that has this in the .vimrc file: set iskeyword+=@-@ I assumed it would let me delete a word with a hypen surrounded by two letters such as this-word with a dw command but it doesn't seem to work.
StevieD
  • 1,492
  • 1
  • 16
  • 24
10
votes
3 answers

Convert a search to a command in Vim

Often I will do a search to find things in Vim, such as: /-some-regex-here And after seeing what if grabs and iterating through a few of the results, I want to do a find-replace. Is there a way to convert the / to a : command? Or do I have to esc…
David542
  • 2,445
  • 14
  • 50
1
2 3
22 23