Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim 它不起作用了_Vim_Macvim - Fatal编程技术网

Vim 它不起作用了

Vim 它不起作用了,vim,macvim,Vim,Macvim,我正在使用Macvim 7.3快照57。我似乎无法让matchit在我的任何文件中工作 我在开始标签上按了%。它不带我到结束标签 我的vimrc文件: " Pathogen settings call pathogen#runtime_append_all_bundles() call pathogen#helptags() set nocompatible set number set ruler set cursorline syntax on " Disable all blinki

我正在使用Macvim 7.3快照57。我似乎无法让matchit在我的任何文件中工作

我在开始标签上按了%。它不带我到结束标签

我的vimrc文件:

" Pathogen settings
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()

set nocompatible

set number
set ruler
set cursorline
syntax on

" Disable all blinking
set guicursor+=a:blinkon0

" Whitespace stuff
set nowrap
set tabstop=2
set shiftwidth=2
set expandtab
set cindent
set smartindent
set autoindent
set list listchars=tab:\ \ ,trail:·

" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase

" Status bar
set laststatus=2

" Start without the toolbar
set guioptions-=T

" Default gui color scheme
" "color default
" color molokai
color railscasts+

" Command-/ to toggle comments
map <D-/> :TComment<CR>j

" Remember last location in file
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
    \| exe "normal g'\"" | endif
endif

" Thorfile, Rakefile and Gemfile are Ruby
au BufRead,BufNewFile {Gemfile,Rakefile,Thorfile,config.ru} set ft=ruby

" Open split buffers below instead of above current buffer
set splitbelow

" Session options
let g:session_autoload = 1
let g:session_autosave = 1

" Buffer navigation
map <C-K> <C-W><C-K>
map <C-J> <C-W><C-W>
map <C-H> <C-W><C-H>
map <C-L> <C-W><C-L>

" Rails navigation options
nmap <leader>rc :Rcontroller 
nmap <leader>rv :Rview 
nmap <leader>rm :Rmodel 

" Tab completion
" Also needed for better Rails navigation auto-completion
set wildmode=list:longest,list:full

" Open up side panel left (NERDTree) and right(Tagbar)
" nmap <leader>\ :NERDTreeToggle<CR> :TagbarToggle<CR>
nmap <leader>\ :call ToggleNERDTreeAndTagbar()<CR>

" Allow single click for NERDTree
let NERDTreeMouseMode = 3
let g:NERDTreeWinSize = 30
" autocmd VimEnter * NERDTree

" Tagbar options
let tagbar_singleclick = 1
let g:tagbar_sort = 0
let g:tagbar_width = 30
" autocmd VimEnter * nested TagbarOpen

" The Janus plugin sets this to noequalalways for the Zoominfo plugin
" However, we want to set this to equalalways instead, since we want to
" have equal window height when a new window is opened. i.e. via ctrl+w+s
set equalalways

" Matchit already installed in newer versions of vim.
" Don't need to add this onto pathogen bundle folder. We only need
" to configure it.
" Configure matchit so that it goes from opening tag to closing tag
au FileType html,eruby,rb,css,js,xml runtime! macros/matchit.vim

" Set backup and swp dir. Don't forget to clear tmp dir out once in a while
set backupdir=~/.vim/tmp/backup
set directory=~/.vim/tmp/swp

" Detect if a tab was closed, and ensure that height of main window fills the screen (100% height)
au TabEnter * let &lines = 100

" <leader>\ to open or close NERDTree and Tagbar, under the following conditions:
" 1) Only close both if NERDTree and Tagbar are both opened
" 2) Open both if NERDTree and Tagbar are closed OR if one is already opened
function! ToggleNERDTreeAndTagbar()
  let w:jumpbacktohere = 1

  " Detect which plugins are open
  if exists('t:NERDTreeBufName')
      let nerdtree_open = bufwinnr(t:NERDTreeBufName) != -1
  else
      let nerdtree_open = 0
  endif
  let tagbar_open = bufwinnr('__Tagbar__') != -1

  " Perform the appropriate action
  if nerdtree_open && tagbar_open
      NERDTreeClose
      TagbarClose
  elseif nerdtree_open
      TagbarOpen
  elseif tagbar_open
      NERDTree
  else
      NERDTree
      TagbarOpen
  endif

  " Jump back to the original window
  for window in range(1, winnr('$'))
    execute window . 'wincmd w'
    if exists('w:jumpbacktohere')
      unlet w:jumpbacktohere
      break
    endif
  endfor
endfunction
病原体设置 调用病原体#运行时_追加_所有_捆绑包() 调用病原体#helptags() 兼容模式 设定数 定尺 设置光标线 语法高亮 “禁用所有闪烁 设置guicursor+=a:blinkon0 “空白的东西 立即停止 设置tabstop=2 设置shiftwidth=2 设置扩展选项卡 集渣 智能对齐 自动缩进 设置列表listchars=tab:\\,轨迹:· “搜索 高亮显示 在搜索中设置 置之不理 设置smartcase “状态栏 设置laststatus=2 “不使用工具栏启动 设置guioptions-=T “默认gui颜色方案 “”默认颜色 “颜色莫洛凯 彩色铁轨+ “命令-/切换注释 地图:TCommentj “还记得文件中的最后一个位置吗 如果有(“自动MD”) 如果行(“\”)>0和行(“\”)这行

runtime macros/matchit.vim
是激活matchit的标准方式,在我所有的机器上都可以使用

你打字后它还能用吗

:runtime macros/matchit.vim
在正常模式下?

显示:

确保你有一条像这样的线

:filetype plugin on
vimrc
文件中。这将启用文件类型插件,其中许多插件
matchit.vim
使用哪些匹配对。

我也遇到过类似的问题。我用vim提供的脚本尝试了运行时宏/matchit.vim,但没有成功。
因此,我从下载了1.13.2版的脚本,将其解压缩到~/vimfiles中,它就可以工作了

在我将一些vim插件更新到7.3的最新版本后,我开始出现同样的问题

但是当我跑的时候

:匹配调试


它为我解决了这个问题。

当有注释大括号时,matchit在C++/C中查找正确的匹配大括号时遇到了问题。以下步骤来自于Write by,为我解决了这个问题,也大致解释了整个过程的工作方式:

  • 创建文件夹~/.vim/plugin(如果还没有):

    mkdir ~/.vim/plugin 
    
    mkdir ~/.vim/doc
    
  • 创建一个名为 ~/.vim/plugin/matchit.vim:

    vi ~/.vim/plugin/matchit.vim 
    
    以及以下内容:

    runtime macros/matchit.vim 
    
  • 创建目录~/.vim/doc(如果还没有):

    mkdir ~/.vim/plugin 
    
    mkdir ~/.vim/doc
    
  • 将/usr/share/vim/vim73/macros/matchit.txt复制到~/.vim/doc/:

    cp /usr/share/vim/vim73/macros/matchit.txt ~/.vim/doc/
    
  • 开放vi

    vi
    
    并在其中执行以下操作:

    :helptags ~/.vim/doc 
    
  • 确保~/.vimrc包含以下内容之一:

    source $VIMRUNTIME/vimrc_example.vim 
    

  • 在vimrc中添加以下自动命令:

    " make matchit work on C-like filetypes 
    " c and cpp are already handled by their ftplugin 
    au Filetype css,javascript 
            \ let b:match_words = &matchpairs 
    
  • 重新启动Vim


  • 因为Vim附带matchit插件,所以我需要做的就是激活它:

    vim ~/.vimrc
    
    然后将以下内容添加到.vimrc中:

    set nocompatible
    filetype plugin on
    runtime macros/matchit.vim
    

    仅供参考:在vim 8
    运行时宏/matchit.vim
    中变为
    packadd!matchit

    愚蠢的问题:matchit被激活用于
    html、eruby、rb、css、js、xml
    ,您是否有可能尝试将其用于其他文件类型?请尝试
    :帮助matchit安装
    ,它是专门为插件文档编写的,但它可以帮助您。在正常模式下键入
    :runtime macros/matchit.vim
    无法立即工作,这让我很反感。您还必须执行
    :filetype detect
    来为打开的文件激活它runtime macros/matchit.vim确实有效。这是一个非常有用的内置解决方案,而且完全不明显,它是一个比ruby-matchit.vim更好的解决方案(即功能性和维护性)。是的,但维护了吗?我从2008年起就没有更新过matchit。是的,这也为我修复了它。不确定发生了什么。嗯,
    :MatchDebug
    调用
    s:Match_debug()
    ,其第一行是
    让b:Match_debug=1“保存调试信息。
    (函数的其余部分只定义了一些菜单)如果您搜索
    b:match_debug
    ,您将看到,如果设置了,那么脚本将不会使用其缓存的数据。在MacVim(77)上,我尝试了所有其他建议,这是唯一有效的建议(
    .vimrc
    中的三行)。谢谢!我的理解是,
    ~/.vimrc
    文件的存在会自动关闭Vi兼容性。因此,
    :help compatible
    “当在Vim启动时发现| vimrc |或| gvimrc |文件时,此选项将关闭。“事实上,我从
    ~/.vimrc
    文件中省略了
    set nocompatible
    行,并且仍然能够通过添加以下两行来使用
    matchit.vim
    让b:match_words=&matchpairs
    做什么呢?快速免责声明:不是原始作者(我的答案中引用的来源)这是我的解释,我接受了它,并以此作为我的解决方案。现在,这已经过时了,它搜索并匹配右括号/圆括号/etc模式。你可以在这里看到一些例子:链接不再工作了。非常感谢你让我知道。我想这就是为什么这种事情不被鼓励的原因。我已经删除了有问题的链接。对后代来说,这是:
    set nocompatible
    filetype plugin on
    runtime macros/matchit.vim