Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't .vimrc get executed?

When I try to use . .vimrc it gives and error:

bash: runtime! command not found
bash: syntax: command not found
bash: filetype: command not found
bash: filetype: command not found

It just randomly stopped working for no reason, all other dotfiles seem to work fine. The .vimrc contains this:

runtime! archlinux.vim
set number
set noswapfile
set nobackup
syntax on
set autoindent
set smartindent
set smarttab
filetype plugin on
filetype indent on
set incsearch
set hlsearch

It also gave an error inside a comment when it was there.

like image 490
visu Avatar asked May 30 '16 13:05

visu


1 Answers

The . (or source) command is a bash command which reads a file (which should be a valid bash script) in the context of the current shell instance.

The .vimrc file is not a bash script, it's something that's read and processed by vim rather than bash.

It's no different to trying to compile C code with a Pascal compiler. The file content is not suitable for what you're trying to do with it. The .vimrc file should be automatically picked up next time you run a vim instance.

like image 80
paxdiablo Avatar answered Oct 11 '22 22:10

paxdiablo