I have a vimrc file that does auto indent and ect. but if doesn't seem to be doing what I want it to do. When I do vim ~/.vimrc then it shows that file is empty.

But if I go to my etc directory and do nano vimrc then following shows

  GNU nano 4.4                                 vimrc                                           
" All system-wide defaults are set in $VIMRUNTIME/archlinux.vim (usually just
" /usr/share/vim/vimfiles/archlinux.vim) and sourced by the call to :runtime
" you can find below.  If you wish to change any of those settings, you should
" do it in this file (/etc/vimrc), since archlinux.vim will be overwritten
" everytime an upgrade of the vim packages is performed.  It is recommended to
" make changes after sourcing archlinux.vim since it alters the value of the
" 'compatible' option.

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages.
runtime! archlinux.vim

" If you prefer the old-style vim functionalty, add 'runtime! vimrc_example.vim'
" Or better yet, read /usr/share/vim/vim80/vimrc_example.vim or the vim manual
" and configure vim to your own liking!

" do not load defaults if ~/.vimrc is missing
"let skip_defaults_vim=1

set tabstop=4 softtabstop=0 expandtab shiftwidth=4
set clipboard=unnamedplus

set ignorecase
set autoindent
syntax on

I'm not sure why...

  • What do you mean by "When I do ~/.vimrc"? What is your etc directory? The Vim initialisation file should either be ~/.vimrc or ~/.vim/vimrc. – Kusalananda Oct 3 '19 at 16:03
  • I did vim ~/.vimrc to open my vimrc file on my terminal – bb2 Oct 3 '19 at 16:04
  • Ok, and it was empty? Then you did what to open the file in nano? You say that you "went to your etc directory". If you keep the vimrc file in any other location than the ones I mentioned in my previous comment, vim would not find it when it starts. – Kusalananda Oct 3 '19 at 16:10
  • 2
    Ah, I think I understand now. What you call "your etc directory" is /etc, right? It's better to make changes to your personal ~/.vimrc file and to leave the files under /etc alone. There is seldom any point in making changes to /etc/vimrc that could be done in ~/.vimrc. – Kusalananda Oct 3 '19 at 16:11
  • I was in root/etc/ directory and vimrc was there. So when I edit this vimrc file and have errors in my settings syntax, when I open vim it says my vimrc have error in specific line. Then I fixed it and open the vim but tab would still not work. I'm trying to edit my Makefile so tab need to work... – bb2 Oct 3 '19 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.