一起围观.gvimrc藏哪里,解决GVIM初始配置!

今天改用GVIM,刚开始的时候对于字体啊颜色啊什么的都很不习惯,寻思求变

作为最强大的编辑器,GVIM当然是支持自定义以及个性化的。

再网上搜罗了一通,描述都十分简单

修改字体与字号:在.gvimrc添加 set guifont=UbuntuMono\ 15

设置缩进:在.gvimrc添加 set tabstop=4 set shiftwidth=4

添加行号:在.gvimrc添加 set number


可是,我想第一次使用的筒子都会遇到个棘手的问题,我TM哪里去找.gvimrc?!

淡定淡定。。。经过一番探索,使用whereis gvimrc在/usr/share/vim下面找到一个gvimrc,很兴奋,可是打开一看并不是我想要的。

最后发现悲剧的事实是不用找了,这玩意儿根本不存在!!!

自己动手,丰衣足食:

jimmy@MyPet:/$ cd ~
jimmy@MyPet:~$ vim .gvimrc

建立好之后,就可以往里面添加如上所述的一些set代码。最后保存退出即可。

这里提供一个比较完整的.gvimrc代码,也是我自己的设置:

" The commands in this are executed when the GUI is started.
"
" Maintainer:    Bram Moolenaar <Bram@vim.org>
" Last change:    2001 Sep 02
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.gvimrc
"          for Amiga:  s:.gvimrc
"  for MS-DOS and Win32:  $VIM\_gvimrc
"        for OpenVMS:  sys$login:.gvimrc

" Make external commands work through a pipe instead of a pseudo-tty
"set noguipty

" set the X11 font to use
" set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1

set ch=2        " Make command line two lines high 
set number
set mousehide        " Hide the mouse when typing text

" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>

" Only do this for Vim version 5.0 and later.
if version >= 500

  " I like highlighting strings inside C comments
  let c_comment_strings=1

  " Switch on syntax highlighting if it wasn't on yet.
  if !exists("syntax_on")
    syntax on
  endif

  " Switch on search pattern highlighting.
  set hlsearch
  " For Win32 version, have "K" lookup the keyword in a help file
  "if has("win32")
  "  let winhelpfile='windows.hlp'
  "  map K :execute "!start winhlp32 -k <cword> " . winhelpfile <CR>
  "endif

  " Set nice colors
  " background for normal text is light grey
  " Text below the last line is darker grey
  " Cursor is green, Cyan when ":lmap" mappings are active
  " Constants are not underlined but have a slightly lighter background
  highlight Normal guibg=grey90
  highlight Cursor guibg=Green guifg=NONE
  highlight lCursor guibg=Cyan guifg=NONE
  highlight NonText guibg=grey80
  highlight Constant gui=NONE guibg=grey95
  highlight Special gui=NONE guibg=grey95

  "add by xgm
filetype plugin on
filetype indent on

syntax on
colorscheme desert

"let bmenu_max_pathlen = 70

set lines=36 columns=125
set guifont=UbuntuMono\ 15
"set guioptions=cmrb
set wrap
set autoindent
set nobackup
"set nowritebackup
set tabstop=4
set shiftwidth=4


endif

弄好之后,打开GVIM时默认就是自己的个性化设置了!需要注意的一点是此设置仅针对本用户(此例中为jimmy),切换到其他用户时设置失效。。


  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
"-------------------------------------------------------------------------------- " 一般设定 "-------------------------------------------------------------------------------- set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 set encoding=utf-8 set termencoding=cp936 language messages zh_CN.UTF-8 "解决输出乱码 source $VIMRUNTIME/delmenu.vim "解决菜单乱码 source $VIMRUNTIME/menu.vim "解决consle输出乱码 set nocompatible " 不要使用vi的键盘模式,而是vim自己的 set history=100 " history文件中需要记录的行数 set clipboard+=unnamed " 与windows共享剪贴板 set viminfo+=! " 保存全局变量 set iskeyword+=_,$,@,%,#,- " 带有如下符号的单词不要被换行分割 syntax on " 语法高亮 set cursorline " 突出显示当前行 nnoremap c:set cursorline! cursorcolumn! "set cursorline "au! Cursorhold *exe 'match CurrentLine ^%'. line('.').'l.*/' "set ut=100 set nu! " 显示行号 set scrolloff=5 " 在光标接近底端或顶端时,自动下滚或上滚 "hi Comment ctermfg=DarkCyan "修改默认注释颜色 ":highlight OverLength ctermbg=red ctermfg=white guibg=red guifg=white ":match OverLength '\1v.*' " 高亮字符,让其不受100列限制 highlight StatusLine guifg=SlateBlue guibg=Yellow " 状态行颜色 highlight StatusLineNC guifg=Gray guibg=White " 状态行颜色 set laststatus=2 " 进入插入模式时改变状态栏颜色(仅限于Vim 7) if version >= 700 au InsertEnter * hi StatusLine guibg=#818D29 guifg=#FCFCFC gui=none au InsertLeave * hi StatusLine guibg=Yellow guifg=SlateBlue gui=none endif if has("gui_running") "au GUIEnter * simalt ~x " 窗口启动时自动最大化 "set guioptions-=m " 隐菜单栏 "set guioptions-=T " 隐工具栏 "set guioptions-=L " 隐左侧滚动条 "set guioptions-=r " 隐右侧滚动条 "set guioptions-=b " 隐底部滚动条 "set showtabline=0 " 隐Tab栏 endif "-------------------------------------------------------------------------------- " 配色方案(按照当前时间的秒数的个位数决定使用哪个方案) "-------------------------------------------------------------------------------- if (strftime("%S")-floor(strftime("%S")/1

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值