Fixing Vim Macros for Python in .exrc File

  • Context: Python 
  • Thread starter Thread starter GreenLRan
  • Start date Start date
  • Tags Tags
    Python
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 5K views
GreenLRan
Messages
59
Reaction score
0
Hi, I am trying set a macro in vim's .exrc file such that when I type # in normal mode, vim will call python3 to run my code. I edited the first line of the .exrc file (which is all i need to do i believe), however when i try to open my .py code in vim I get this message:

ubuntu@ubuntu:~$ vim programs/name.py
Error detected while processing /home/ubuntu/.exrc:
line 1:
E518: Unknown option: #
Press ENTER or type command to continue

Thanks in advance!
Nick





.exrc CODE:

set # :!clear;python3 %

syntax enable
set nocompatible " use vim extensions

" Bells
set visualbell t_vb= " turn off error beep/flash
set novisualbell " turn off visual bell

" Editing info
"set number "[same as nu] show line numbers
set ruler "[same as ru] show cursor position
set showmode "[same as smd] show when in insert mode

" Search
set hlsearch " highlight searches
"set incsearch " do incremental searching

" Auxilary files
set nobackup " do not keep a backup file (ending in ~)
set noswapfile " do not write a swap file

" Smart editing
set showmatch "[same as sm] highlight matching (), {}, etc.
set nowrap " do not wrap lines

" Tabs and Indenting
set autoindent "[same as ai] always set autoindenting on
set shiftwidth=4 "[same as sw] number of spaces to (auto)indent
set tabstop=4 "[same as ts] number of spaces per tab
set expandtab "[same as et] use spaces instead of a tab
set softtabstop=4 "[same as sts] number of spaces to use instead of a tab
set smarttab "[same as sta] <BS> deletes shiftwidth spaces from the start of a line

" Syntax highlighting
syntax enable
 
Physics news on Phys.org
I get the same error when I try @. That can't be it.
 
FIXED! should have been map instead of set