This question already has answers here:
error while running "source .vimrc"
(2 answers)
Closed 4 years ago.
Below is my .vimrc file
set nocompatible
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tomlion/vim-solidity'
Plugin 'othreaa/yajs.vim'
call vundle#end()
filetype plugin indent on
set autoindent
set wrap
set nobackup
set ruler
syntax on
set number
set tabstop=4
colo desert
syntax on
when I type 'source .vimrc' to activate the configuration file, i got the following error message
-bash: .vimrc: line 6: syntax error near unexpected
token `('
-bash: .vimrc: line 6: `call vundle#begin()'
I cannot see what is wrong. Can I help?
Bash cannot parse that. You need to use Vim instead, to parse. Open up Vim and type :source ~/.vimrc in Normal mode.
Related
set tabstop=4
set softtabstop=4
set shiftwidth=4
set noexpandtab
set nu
set autoindent
set cindent
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
filetype plugin indent on
autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4
I added the last two lines into .vimrc but received this error message:
-bash: filetype: command not found
-bash: autocmd: command not found
I haven't used this plugin before and what's the proper way to enable it? My purpose is to avoid the error message when I edit a file with vim on a Linux machine remotely:
TabError: inconsistent use of tabs and spaces in indentation
-bash: filetype: command not found
-bash: autocmd: command not found
These errors seem to be printed by bash,
did you run something like source .vimrc?
This question already has answers here:
error while running "source .vimrc"
(2 answers)
Closed 2 years ago.
I have the following written in my .vimrc file
set number
set hlsearch
set mouse=a
map F2 :bprev CR
Getting follwoing error while sourcing .vimrc file
-bash: .vimrc: line 4: syntax error near unexpected token `newline'
-bash: .vimrc: line 4: `map <F2> :bprev <CR>'
.vimrc isn't a shell script; it's a vim script. Both programs have a set command (though each does something very different than the other), which is how you get to line 4 at all. The problem here is that the shell sees the < and > as redirection operators, and the final > is followed by a newline, not a file name; hence, the syntax error.
Am using macvim 8.2.319 (installed it by running the downloaded dmg file) on macOS Catalina (10.15.4).
Trying installing NERDTree and liteline through vim plug, but nothing seems to be working...
Using vim plug, I created the autoload dir inside:
~/.vim/autoload
And then issued the following command:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
My .gvimrc file:
set nu
syntax on
if has("gui_running")
if has("gui_gtk2")
set guifont=Inconsolata\ 12
elseif has("gui_macvim")
set guifont=JetBrains\ Mono\ Regular:h14
elseif has("gui_win32")
set guifont=Consolas:h11:cANSI
endif
endif
colorscheme pencil
set background=light
let g:airline_theme = 'pencil'
call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'preservim/nerdtree'
call plug#end()
map <C-t> :NERDTreeToggle<CR>
When I try to load it using either:
. .gvimrc
or
source .gvimrc
It outputs the following error:
-bash: .gvimrc: line 20: syntax error near unexpected token `('
-bash: .gvimrc: line 20: `call plug#begin('~/.vim/plugged')'
Also, opened up a new Terminal window and it still doesn't work...
When I run macvim by doing this:
gvim Hello.py
The line numbers are set but I can't see liteline anywhere (I did do a :PlugInstall and :PlugUpdate).
When I try to open NERDTree by clicking on control t, it states this:
E492: Not an editor command: NERDTreeToggle
By, the way, I don't have a .vimrc file created...
Why are the NERDTree and liteline plug-ins not working on macvim?
The people that answered this question actually answered via the vim_mac#googlegroups mailing list... The credit goes to an individual who responded to my post there. Will include the solution, nonetheless...
Solution was to include everything in ~/.vimrc:
set nu
set ruler
set rulerformat=%l\:%c
set autoindent
syntax on
set nocompatible
set t_Co=256
set tabstop=4
set laststatus=2
set encoding=utf-8
if has("gui_running")
if has("gui_gtk2")
set guifont=Inconsolata\ 12
elseif has("gui_macvim")
set guifont=JetBrains\ Mono\ Regular:h14
elseif has("gui_win32")
set guifont=Consolas:h11:cANSI
endif
endif
colorscheme pencil
set background=light
let g:airline_theme = 'pencil'
call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'preservim/nerdtree'
call plug#end()
map <C-t> :NERDTreeToggle<CR>
I'm using CentOS 7 and added set pastetoggle=<F2> in .vimrc to toggle the auto-indentation.
While running source .vimrc, it is throwing the below error
-bash: .vimrc: line 4: syntax error near unexpected token `newline'
-bash: .vimrc: line 4: `set pastetoggle=<F2>'
Here's my .vimrc file for reference
set ai
set tabstop=2
set expandtab
set pastetoggle=<F2>
Please help me and let me know, how to resolve the issue?
You are trying to source a vim config file in your shell, which would indeed throw an error. If you are trying to update the vim config on the go, then after updating your ~/.vimrc file(assuming you are using vim to edit the vimrc file) , from vim open the command line mode by pressing : and type in source % (where % denotes current file). Then your new config gets updated on the go.
If you're lazy like me then bind it to a key for sourcing, like so in normal mode :
nnoremap <leader>so :w<cr>:source %<cr>
If you are using some other text editor to edit ~/.vimrc, then save and exit the file, then open a new instance of vim and your changes get updated automatically.
In GVIM first let's
File ---> Color Scheme --> desert
okay now let's find out what this setting equates to by typing
:set
I see the first line that reads
background-color=dark
so let's create a file named
/root/.vimrc
and place that line in it and reload GVIM.
Here is the full error:
Error detected while processing /root/.vimrc:
line 1:
E492: Not an editor command: background=dark
You want
set background=dark
The other is an ill formed command.
You can put any ex command in your vimrc by dropping the :. So instead of typing :set background=dark on the command line you put set background=dark in your vimrc.
However this command should not be in your vimrc. It should be set by your colorscheme.
The first part of your question seems to be how do I set the colorscheme desert from the command line. Well the command is :colorscheme desert.
So if you want to restore the desert colorscheme everytime you load vim you can put
colorscheme desert
in your vimrc. (/root/.vimrc in this case)