vim 显示问题
- astolia
- 论坛版主
- 帖子: 6514
- 注册时间: 2008-09-18 13:11
Re: vim 显示问题
图没贴上来
-
- 帖子: 7
- 注册时间: 2014-04-24 16:40
- 系统: Ubuntu 14.10
- 联系:
Re: vim 显示问题
尼玛图挂了astolia 写了:图没贴上来
简单描述一下吧 就是我写个c程序 用的是while函数 然后一键编译运行后 显示的结果只有后几十个 前面的显示不出
- astolia
- 论坛版主
- 帖子: 6514
- 注册时间: 2008-09-18 13:11
Re: vim 显示问题
直接在ex mode下输出?你为什么不用less呢?
:!./yourprogram | less
:!./yourprogram | less
-
- 帖子: 7
- 注册时间: 2014-04-24 16:40
- 系统: Ubuntu 14.10
- 联系:
Re: vim 显示问题
提示 warning: terminal is not fully functionalastolia 写了:直接在ex mode下输出?你为什么不用less呢?
:!./yourprogram | less
另外我用的一键编译运行设置,帮看看怎么改, 谢谢.
代码: 全选
"单个文件编译
map <F5> :call Do_OneFileMake()<CR>
imap <F5> <ESC> call Do_OneFileMake()<CR>
function Do_OneFileMake()
if expand("%:p:h")!=getcwd()
echohl WarningMsg | echo "Fail to make! This file is not in the current dir! Press <F7> to redirect to the dir of this file." | echohl None
return
endif
let sourcefileename=expand("%:t")
if (sourcefileename=="" || (&filetype!="cpp" && &filetype!="c"))
echohl WarningMsg | echo "Fail to make! Please select the right file!" | echohl None
return
endif
let deletedspacefilename=substitute(sourcefileename,' ','','g')
if strlen(deletedspacefilename)!=strlen(sourcefileename)
echohl WarningMsg | echo "Fail to make! Please delete the spaces in the filename!" | echohl None
return
endif
exe ":ccl"
exe ":update"
if &filetype=="c"
if g:iswindows==1
set makeprg=gcc\ -g\ -o\ %<.exe\ %
else
set makeprg=gcc\ -g\ -o\ %<\ %
endif
elseif &filetype=="cpp"
if g:iswindows==1
set makeprg=g++\ -g\ -o\ %<.exe\ %
else
set makeprg=g++\ -g\ -o\ %<\ %
endif
"elseif &filetype=="cs"
"set makeprg=csc\ \/nologo\ \/out:%<.exe\ %
endif
if(g:iswindows==1)
let outfilename=substitute(sourcefileename,'\(\.[^.]*\)' ,'.exe','g')
let toexename=outfilename
else
let outfilename=substitute(sourcefileename,'\(\.[^.]*\)' ,'','g')
let toexename=outfilename
endif
if filereadable(outfilename)
if(g:iswindows==1)
let outdeletedsuccess=delete(getcwd()."\\".outfilename)
else
let outdeletedsuccess=delete("./".outfilename)
endif
if(outdeletedsuccess!=0)
set makeprg=make
echohl WarningMsg | echo "Fail to make! I cannot delete the ".outfilename | echohl None
return
endif
endif
execute "silent make"
set makeprg=make
execute "normal :"
if filereadable(outfilename)
if(g:iswindows==1)
execute "!".toexename
else
execute "!./".toexename
endif
endif
execute "copen"
endfunction
"进行make的设置
map <F6> :call Do_make()<CR>
map <c-F6> :silent make clean<CR>
function Do_make()
set makeprg=make
execute "silent make"
execute "copen"
endfunction
- astolia
- 论坛版主
- 帖子: 6514
- 注册时间: 2008-09-18 13:11
Re: vim 显示问题
你是在什么系统环境下用的vim?你用的终端vim不支持。
没兴趣看那么长一段脚本,写makefile才是正途
没兴趣看那么长一段脚本,写makefile才是正途
-
- 帖子: 7
- 注册时间: 2014-04-24 16:40
- 系统: Ubuntu 14.10
- 联系:
Re: vim 显示问题
ubuntu14.10astolia 写了:你是在什么系统环境下用的vim?你用的终端vim不支持。
没兴趣看那么长一段脚本,写makefile才是正途