vim高手进

foxavideo 2010-11-05 05:17:21


大家帮我看看左边的这个土黄色的部分怎么回事,怎么去掉。我估计是vim的配置文件导致的,但不知道具体是哪个。请高人指点。
...全文
136 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
foxavideo 2010-11-05
  • 打赏
  • 举报
回复
非常感谢steptodream和lujun1985,结帖,散分
foxavideo 2010-11-05
  • 打赏
  • 举报
回复
非常感谢lujun1985,问题解决了。下面解释下怎么回事:
我之前可能搜索了什么东西,然后因为配置文件(vimrc)中配置搜索结果高亮,因此那些部分全部以高亮的方式显示。要解决这个问题就是在命令行模式数据 noh或者nohl,两者都可以。他的意思是:
stop highlighting the word that was searched for ...
就是将高亮部分去掉。

说到这里我们插一句,奇怪的是,vim在退出然后重新进入的情况下,上次搜索高亮的部分仍然处于高亮,这点让我误以为是我曾经修改vimrc导致。

当然我们知道了怎么去除高亮部分,也应该知道加上高亮部分。加上高亮部分:
set hlsearch

这是通过在命令行模式更改这一选项,我们也可以直接在配置文件里取消或者加上这一特性。配置文件vimrc我已经在上面列出了,大看可以找到set hlsearch这一行吧,不要这一特性,那就注释掉,注释就是在这行的前面加", 这样就变成:
" set hlsearch。
lujun1985 2010-11-05
  • 打赏
  • 举报
回复
应该是上一次搜索后匹配到的结果
可以试一下:nohl
steptodream 2010-11-05
  • 打赏
  • 举报
回复
先按esc退出编辑状态
然后按 :noh

应该就没了
foxavideo 2010-11-05
  • 打赏
  • 举报
回复
以下是vimrc的内容:
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=ucs-bom,utf-8,latin1
endif

set nocompatible " Use Vim defaults (much better!)
set bs=indent,eol,start " allow backspacing over everything in insert mode
"set ai " always set autoindenting on
"set backup " keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time

" Only do this part when compiled with support for autocommands
if has("autocmd")
augroup fedora
autocmd!
" In text files, always limit the width of text to 78 characters
" autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
" don't write swapfile on most commonly used directories for NFS mounts or USB sticks
autocmd BufNewFile,BufReadPre /media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp
" start with spec file template
autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec
augroup END
endif

if has("cscope") && filereadable("/usr/bin/cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif

filetype plugin on

if &term=="xterm"
set t_Co=8
set t_Sb=[4%dm
set t_Sf=[3%dm
endif

" Don't wake up system with blinking cursor:
" http://www.linuxpowertop.org/known.php
let &guicursor = &guicursor . ",a:blinkon0"
"set tabstop=4
"set shiftwidth=4
"set autoindent
"set smartindent
"set showmatch
"color my_morning
点墨 2010-11-05
  • 打赏
  • 举报
回复
贴配置文件...
freetstar 2010-11-05
  • 打赏
  • 举报
回复
貌似是“v”这个选项。。不太确定。。

23,120

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧