Where is my .vimrc file on Linux server

vim
centos7
linux

#1

I don’t see any .vimrc file in my $HOME directory i.e. /home/username/.vimrc. How do I find out location of ~/.vimrc file on Linux system? I need to add some useful config that I found on github but I can’t seems to locate the file on Linux server. Please help.


#2

You can use the following command to locate the .vimrc file:

find $HOME -name .vimrc
find ~ -name .vimrc

If you do not see ~/.vimrc, just create it using a text editor:

vim ~/.vimrc

OR

nano ~/.vimrc

Here is a sample ~/.vimrc from my system:

set nocompatible
" Use Vim settings, rather than Vi settings
set softtabstop=2
" Indent by 2 spaces when hitting tab
set shiftwidth=4
" Indent by 4 spaces when auto-indenting
set tabstop=4
" Show existing tab with 4 spaces width
syntax on
" Enable syntax highlighting
filetype indent plugin on
" Enable indenting for files
set autoindent
" Enable line numbers
set number
set nobackup
set laststatus=2
"show status line
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)
set wildmenu

See