编辑器,大家都知道,刚刚入门的童鞋,对编辑器不怎么在意,但是,当你进入到每篇程序都要100多行时,编辑器就必不可少了。
首先,大家可以直接使用编程所需的编辑器,但是,这些编辑器效率比较低,这里博主就不进行推荐。
新手肯定爱不释手的就是notepad++,这款编辑器使用简单,而且页面美观,快捷键较多,可以免除写程序时按键困难、鼠标操作麻烦。
下载博主这里有一个网址:http://rj.baidu.com/soft/detail/13478.html?ald
如果不知道如何使用,可以看看这个网址:http://shandian.biz/395.html
接下来,博主只需推荐一个叫vim的编辑器就好了。vim是编辑器之神,属于完全可以把鼠标扔了的编辑器。这个编辑器也是博主最喜欢用的编辑器。
使用vim,可以使博主的编程效率提高约四分之一,而且,免除了要把手从方向键移动的时间,直接可以使用键盘移动。还有多个模式,多种皮肤,多种快捷键,多种~~~
下载博主同样向大家提供了:http://www.cr173.com/soft/13343.html
教程网上太多了,博主推荐这篇:http://blog.csdn.net/niushuai666/article/details/7275406
还有,大家找到vim的安装位置,里面有一个名叫_vimrc的文件,打开,用下面的程序覆盖:
set nocompatible
set nobackup
set noswapfile
set tabstop=4
set softtabstop=4
set shiftwidth=4
set guifont=Consolas:h18
set backspace=start,indent,eol
syntax on
color evening
set background=light
set go=
set clipboard=unnamed
set smarttab
set autoindent
set smartindent
set cindent
set number
if(has("win32") || has("win64") || has("win95") || has("win16"))
let g:iswindows = 1
else
let g:iswindows = 0
endif
if has("gui_running")
let g:isGUI = 1
else
let g:isGUI = 0
endif
map <F9> :call Run()<CR>
imap <F9> <ESC>:call Run()<CR>
map <c-F9> :call Compile()<CR>
imap <c-F9> <ESC>:call Compile()<CR>
map <c-F10> :call Link()<CR>
imap <c-F10> <ESC>:call Link()<CR>
let s:LastShellReturn_C = 0
let s:LastShellReturn_L = 0
let s:ShowWarning = 1
let s:Obj_Extension = '.o'
let s:Exe_Extension = '.exe'
let s:Sou_Error = 0
let s:windows_CFlags = 'gcc\ -fexec-charset=gbk\ -Wall\ -g\ -O0\ -c\ %\ -o\ %<.o'
let s:linux_CFlags = 'gcc\ -Wall\ -g\ -O0\ -c\ %\ -o\ %<.o'
let s:windows_CPPFlags = 'g++\ -fexec-charset=gbk\ -Wall\ -g\ -O0\ -c\ %\ -o\ %<.o'
let s:linux_CPPFlags = 'g++\ -Wall\ -g\ -O0\ -c\ %\ -o\ %<.o'
func! Compile()
exe ":ccl"
exe ":update"
if expand("%:e") == "c" || expand("%:e") == "cpp" || expand("%:e") == "cxx"
let s:Sou_Error = 0
let s:LastShellReturn_C = 0
let Sou = expand("%:p")
let Obj = expand("%:p:r").s:Obj_Extension
let Obj_Name = expand("%:p:t:r").s:Obj_Extension
let v:statusmsg = ''
if !filereadable(Obj) || (filereadable(Obj) && (getftime(Obj) < getftime(Sou)))
redraw!
if expand("%:e") == "c"
if g:iswindows
exe ":setlocal makeprg=".s:windows_CFlags
else
exe ":setlocal makeprg=".s:linux_CFlags
endif
echohl WarningMsg | echo " compiling..."
silent make
elseif expand("%:e") == "cpp" || expand("%:e") == "cxx"
if g:iswindows
exe ":setlocal makeprg=".s:windows_CPPFlags
else
exe ":setlocal makeprg=".s:linux_CPPFlags
endif
echohl WarningMsg | echo " compiling..."
silent make
endif
redraw!
if v:shell_error != 0
let s:LastShellReturn_C = v:shell_error
endif
if g:iswindows
if s:LastShellReturn_C != 0
exe ":bo cope"
echohl WarningMsg | echo " compilation failed"
else
if s:ShowWarning
exe ":bo cw"
endif
echohl WarningMsg | echo " compilation successful"
endif
else
if empty(v:statusmsg)
echohl WarningMsg | echo " compilation successful"
else
exe ":bo cope"
endif
endif
else
echohl WarningMsg | echo ""Obj_Name"is up to date"
endif
else
let s:Sou_Error = 1
echohl WarningMsg | echo " please choose the correct source file"
endif
exe ":setlocal makeprg=make"
endfunc
func! Link()
call Compile()
if s:Sou_Error || s:LastShellReturn_C != 0
return
endif
let s:LastShellReturn_L = 0
let Sou = expand("%:p")
let Obj = expand("%:p:r").s:Obj_Extension
if g:iswindows
let Exe = expand("%:p:r").s:Exe_Extension
let Exe_Name = expand("%:p:t:r").s:Exe_Extension
else
let Exe = expand("%:p:r")
let Exe_Name = expand("%:p:t:r")
endif
let v:statusmsg = ''
if filereadable(Obj) && (getftime(Obj) >= getftime(Sou))
redraw!
if !executable(Exe) || (executable(Exe) && getftime(Exe) < getftime(Obj))
if expand("%:e") == "c"
setlocal makeprg=gcc\ -o\ %<\ %<.o
echohl WarningMsg | echo " linking..."
silent make
elseif expand("%:e") == "cpp" || expand("%:e") == "cxx"
setlocal makeprg=g++\ -o\ %<\ %<.o
echohl WarningMsg | echo " linking..."
silent make
endif
redraw!
if v:shell_error != 0
let s:LastShellReturn_L = v:shell_error
endif
if g:iswindows
if s:LastShellReturn_L != 0
exe ":bo cope"
echohl WarningMsg | echo " linking failed"
else
if s:ShowWarning
exe ":bo cw"
endif
echohl WarningMsg | echo " linking successful"
endif
else
if empty(v:statusmsg)
echohl WarningMsg | echo " linking successful"
else
exe ":bo cope"
endif
endif
else
echohl WarningMsg | echo ""Exe_Name"is up to date"
endif
endif
setlocal makeprg=make
endfunc
func! Run()
let s:ShowWarning = 0
call Link()
let s:ShowWarning = 1
if s:Sou_Error || s:LastShellReturn_C != 0 || s:LastShellReturn_L != 0
return
endif
let Sou = expand("%:p")
let Obj = expand("%:p:r").s:Obj_Extension
if g:iswindows
let Exe = expand("%:p:r").s:Exe_Extension
else
let Exe = expand("%:p:r")
endif
if executable(Exe) && getftime(Exe) >= getftime(Obj) && getftime(Obj) >= getftime(Sou)
redraw!
echohl WarningMsg | echo " running..."
if g:iswindows
exe ":!%<.exe"
else
if g:isGUI
exe ":!gnome-terminal -e ./%<"
else
exe ":!./%<"
endif
endif
redraw!
echohl WarningMsg | echo " running finish"
endif
endfunc
博主的配置更加完整,如果需要我可以发送给你,加我的QQ:2358836981,注明是vim编辑器配置需要者我就可以给你,OK?
额,就是这些,这样,vim这种编辑器之神就可以为你所用了!