Fault description
Modify the ~/.vimrc configuration file to run the py script with one click. The
content of the vimrc configuration file is as follows
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec '!g++ % -o %<'
exec '!time ./%<'
elseif &filetype == 'cpp'
exec '!g++ % -o %<'
exec '!time ./%<'
elseif &filetype == 'python'
exec '!time python %'
elseif &filetype == 'sh'
:!time bash %
endif
endfunc
vim a.py press F5 as follows
Use script
" <f5> run python programmer
map <f5> :w<cr>:!python %<cr>
Can run normally
In other words, the contents of the function body cannot be executed.
The cause of the fault
was resolved on December 23, 2020. The cause of the /etc/profile
alias alias vim='/usr/bin/vi
, there is an alias in the file , that is, the vim command actually uses vi
Solution
to /etc/profile
file alias vim='/usr/bin/vi
change alias vim='/usr/bin/vim
can be.
Here are the solutions to other problems
. The VI in Centos only installs vim-minimal-7.x by default. No matter you enter vi or vim to view the file, the syntax function cannot be enabled normally. Therefore, two other components need to be installed with yum: vim-common-7.x and vim-enhanced-7.x.
#View vim components
[root@client1 ~]# rpm -qa | grep vim
vim-enhanced-7.4.629-7.el7.x86_64
vim-filesystem-7.4.629-7.el7.x86_64
vim-X11-7.4.629-7.el7.x86_64
vim-common-7.4.629-7.el7.x86_64
vim-minimal-7.4.629-7.el7.x86_64
#install vim
yum -y install vim*
Read More:
- Linux: How to Solve vim ~/.bashrc Execute Error
- How to Solve C++ Error: “no matching function for call to ‘atoi/atof’”
- How to Solve Roscore Run error [Install ROS]
- How to Solve NPM Error 426 Upgrade Required
- How to Solve Error: “Hdaudio hdaudioc0d2: unable to bind codec”
- How to Solve Oracle startup monitoring error
- Linux: How to Solve sudo operate Error
- How to Solve Xmind Install Error in Ubuntu System
- How to Solve NPM Error: listen EADDRINUSE 127.0.0.1:8080
- Linux: How to Solve Rabbitmq Plug-in Install Error
- How to Solve Android Linux5.10 Kernel do_gettimeofday Function Error
- How to Solve Ubuntu “Failed to fetch” Error
- How to Solve labelme Install Error in Ubuntu
- How to Solve “Error: source file could not be loaded“ [Ubuntu Use LibreOffice]
- Linux: How to Solve pyperclip Module Error
- How to Solve A-LOAM Ceres Version Error
- Ffmpeg: How to Solve error initializing filter ‘gltransition’
- CentOS: How to Solve Python File Run Error
- How to Solve insufficent privileges error: Ora-01031
- How to Solve Git Filename too long Error