怎样在Ubuntu里设置vim加亮显示c语言函数名?

或者用其它的编辑器实现也行……... 或者用其它的编辑器实现也行…… 展开
 我来答
kuling729
2012-07-27 · 超过26用户采纳过TA的回答
知道答主
回答量:63
采纳率:0%
帮助的人:50.8万
展开全部
在~/.vimrc中加入syntax on就行了。下面是我的配置文件,可以直接用,我也是在网上拼凑的

" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.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/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.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 available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.

"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
func SetTitle()
"如果文件类型为.sh文件
if &filetype == 'sh'
call setline(1,"\#########################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: Leo ")
call append(line(".")+2, "\# mail: kuling729@gmail.com")
call append(line(".")+3, "\# Created Time: ".strftime("%c"))
call append(line(".")+4, "\#########################################################################")
call append(line(".")+5, "\#!/bin/bash")
call append(line(".")+6, "")
else
call setline(1, "/*************************************************************************")
call append(line("."), " > File Name: ".expand("%"))
call append(line(".")+1, " > Author: Leo")
call append(line(".")+2, " > Mail: kuling729@gmail.com")
call append(line(".")+3, " > Created Time: ".strftime("%c"))
call append(line(".")+4, " ************************************************************************/")
call append(line(".")+5, "")
endif
if &filetype == 'cpp'
call append(line(".")+6, "#include<iostream>")
call append(line(".")+7, "using namespace std;")
call append(line(".")+8, "")
endif
if &filetype == 'c'
call append(line(".")+6, "#include<stdio.h>")
call append(line(".")+7, "")
endif
"新建文件后,自动定位到文件末尾
autocmd BufNewFile * normal G
endfunc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("syntax")
syntax on
endif
set number
set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set cindent
colorscheme evening
let g:indent_guides_guide_size=1
set tags=tags;
set autochdir
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" filetype plugin indent on
"endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
灵蛇1989
2012-07-23 · 超过13用户采纳过TA的回答
知道答主
回答量:92
采纳率:0%
帮助的人:46.1万
展开全部
用gedit打开编辑,初学者,用vim会不习惯
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
shaanlan
2012-07-27 · 超过10用户采纳过TA的回答
知道答主
回答量:47
采纳率:0%
帮助的人:21.7万
展开全部
vim ~/.vimrc
syntax on
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
乜懋任玉兰
2020-03-14 · TA获得超过4073个赞
知道小有建树答主
回答量:3050
采纳率:35%
帮助的人:412万
展开全部
自己建一个c.vim的文件嘛,然后把这个文件丢到~/.vim/syntax的目录下面就可以了。以此类推还可以把c++、java等等,做成*.vim的语法标示文件。
建议你用“vim
ide
吴垠”做关键字去百度一下,吴垠有一篇图文并貌的文章就是专门写怎么把vim建成一个IDE,是篇非常不错的文章。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
尔芝纳喇娇洁
2019-02-03 · TA获得超过1084个赞
知道小有建树答主
回答量:1794
采纳率:100%
帮助的人:13万
展开全部
:set
syntax=c:set
syntex=html就可设置当前的语法高亮类型,其他类型的语言,也类似。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(3)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式