个人工具

“老旧文章/Gvim的安装及配置”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
使用字体名为多个单词的字体
(已恢复1.202.40.80对话)的编辑至Luojie-dune的最后一个修订版本)
 
第125行: 第125行:
 
set guifont=AR\ PL\ New\ Sung\ 10
 
set guifont=AR\ PL\ New\ Sung\ 10
 
</nowiki></pre>
 
</nowiki></pre>
==参考资料==
 
[http://www.2quanxun.com VIM][http://www.xtutu.com OpenVZ][http://www.weiluoka.com XEN][http://www.anywayanyday.net BurstNet][http://www.transphone.cc Redhat][http://www.imessage.cc CentOS][http://www.onstar.cc lighttpd][http://www.ideapad.cc LVS][http://www.touchpad.cc DSN][http://www.taobaoguanwang.com XEN][http://www.7j7k.com ZEN][http://www.wanglidanni.com Maths][http://www.mashengxi.com SIS][http://www.gourideqq.com TUO][http://www.xiaogege.com AVS][http://www.iipian.com MOQ][http://www.girlfriendvid.net LQP][http://cnzynga.com RIA][http://www.aiaipian.com AIAI]
 

2013年3月23日 (六) 16:33的最新版本

本文作者:yonsan

授权许可:创作共用协议

编辑人员:rApJtR

校对人员:

适用版本:Ubuntu Linux 5.10 breezy

文章状态:整理中


以下代码只需粘贴至终端运行即可

安装程序

sudo apt-get install vim-gtk vim-doc cscope

安装完整版的Vim:

sudo apt-get install vim-full 

创建启动项

sudo cat > /usr/share/applications/gvim.desktop << "EOF"
[Desktop Entry]
Name=Gvim
Comment[zh_CN]=Gvim编辑器
Exec=gvim
Icon=/usr/share/pixmaps/gnome-word.png
Terminal=false
X-MultipleArgs=false
Type=Application
Categories=Application;Development;
Encoding=UTF-8
StartupNotify=true
EOF

配置gvim

cat > $HOME/.vimrc << "EOF"
" 项目: gvim 配置文件
" 作者: yonsan
" 安装: sudo apt-get install vim-gtk
" 用法: 将本文件(.vimrc)拷贝到$HOME/

" 使用 murphy 调色板
colo murphy
" 设置用于GUI图形用户界面的字体列表。
set guifont=SimSun\ 10
"
set nocompatible
" 设定文件浏览器目录为当前目录
set bsdir=buffer
set autochdir
" 设置编码
set enc=utf-8
" 设置文件编码
set fenc=utf-8
" 设置文件编码检测类型及支持格式
set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
" 指定菜单语言
set langmenu=zh_CN.UTF-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" 设置开启语法高亮
syntax on
" 设置语法高亮度
set syn=cpp
"显示行号
set nu!
" 查找结果高亮度显示
set hlsearch
" tab宽度
set tabstop=4
set cindent shiftwidth=4
set autoindent shiftwidth=4
" C/C++注释
set comments=://
" 修正自动C式样注释功能 <2005/07/16>
set comments=s1:/*,mb:*,ex0:/
" 增强检索功能
set tags=./tags,./../tags,./**/tags
" 保存文件格式
set fileformats=unix,dos
" 键盘操作
map <Up> gk
map <Down> gj
" 命令行高度
set cmdheight=1
" 中文帮助
if version > 603
set helplang=cn
endi
EOF

一些问题

菜单栏乱码

这有可能是你将locale设置为GBK而导致。

编辑 $HOME/.vimrc ,将其中相关内容调整为

" 指定菜单语言
set langmenu=zh_CN.GBK
set enc=chinese
set fencs=gbk,utf-8,ucs-bom,gb18030,gb2312,cp936
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim

使用字体名为多个单词的字体

如果我想使用的字体的名字是两个以上单词的,比如说Courier 10 Pitch或者是AR PL New Sung的话,应该怎么样设置guifont呢?

将 $HOME/.vimrc 中相关内容改为

set guifont=AR\ PL\ New\ Sung\ 10