vim - 在 vim 中使用多个游标时禁用自动配对
问题描述
我正在使用 vim 插件 vim-multiple-cursors 和 auto-pairs。例如,如果我正在编辑一段文本:
one
two
three
four
如果我用命令突出显示块
vip <ctrl-n> I "
这将在前面创建两个括号,因为自动配对处于活动状态。
""one
""two
""three
""four
当您使用 vim-multiple 游标时,有没有办法让自动配对自动关闭?
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
""""""""" PLUGIN LIST STARTS HERE """"""""""""""""""""
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/syntastic'
Plugin 'jiangmiao/auto-pairs'
Plugin 'tpope/vim-surround'
Plugin 'ervandew/supertab'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'tpope/vim-repeat'
Plugin 'scrooloose/nerdtree'
""""""""" PLUGIN LIST END HERE """"""""""""""""""""
call vundle#end() " required
filetype plugin indent on " requiredntax on
syntax on
set tabstop=4
set number
set smartindent
set shiftwidth=4
set mouse=a
set backspace=indent,eol,start
let &t_SI.="\e[5 q"
let &t_SR.="\e[4 q"
let &t_EI.="\e[1 q"
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
map <F5> :NERDTreeToggle<CR>
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
解决方案
Autopairs 有一个调用的函数AutoPairsToggle()
,您需要在进入多个光标模式之前和之后调用该函数。
vim-multiple-cursors为您提供了一种解决插件交互的方法:定义一个 pre 和 post 钩子:
function! Multiple_cursors_before()
call AutoPairsToggle()
endfun
function! Multiple_cursors_after()
call AutoPairsToggle()
endfun
把这些放在你.vimrc
的,问题应该不再发生。
推荐阅读
- javascript - react-datepicker 样式未应用于已部署的构建
- python-3.x - 如何用两个条件过滤 pandas.DataFrame
- spring - 如何向错误模板模型添加属性?
- database - Laravel 有更好的方法来编写我的数据库查询,也许是条件子句
- r - 当自变量移动一个常数时,断点相乘
- python - 从 .CSV 获取主题标签并在 Python 3 中计算它们
- angular8 - Angular8 Ivy 已启用:无法绑定到 'ngIf',因为它不是 'div' 的已知属性。”在任何文件保存时重新编译后
- python - 在相同的轴上绘制不同的 facecolor
- javascript - 使用 DOM 操作一次将鼠标悬停在一个元素上
- go - 如何在包含注释的情况下更新 AST 而不会破坏代码