简体   繁体   English

如何在Vim中禁用制表符完成功能?

[英]How to disable tab completion in vim?

From this morning I'm searching for a solution without any lucks. 从今天早上开始,我正在寻找没有任何困难的解决方案。 Can you please tell me how to disable this thing who appears when I press TAB? 您能告诉我如何禁用按TAB键时出现的此东西吗?

在此处输入图片说明

This is my .vimrc file: 这是我的.vimrc文件:

set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" This is the Vundle package, which can be found on GitHub.
" For GitHub repos, you specify plugins using the
" 'user/repository' format
Plugin 'gmarik/vundle'

" We could also add repositories with a ".git" extension
Plugin 'scrooloose/nerdtree.git'

" To get plugins from Vim Scripts, you can reference the plugin
" by name as it appears on the site
Plugin 'Buffergator'

" Syntax hihgler
Plugin 'scrooloose/syntastic'


" Pluginper gli snippet
Plugin 'msanders/snipmate.vim'

" Plugin per la gestione delle parentesi, per maggiori informazioni: https://github.com/jiangmiao/auto-pairs
 Plugin 'jiangmiao/auto-pairs'


" Now we can turn our filetype functionality back on
filetype plugin indent on

" Enable syntax high.
syntax on

" Set the default charset
set encoding=utf-8 nobomb

" Enable line number
set number

" Highligth cursor line
set cursorline

" Set tab as 2 white space
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab


" Enable mouse in all mode
set mouse=a

" Show the cursor position
set ruler

" Show the filename inside the titlebar
set title


" Strip trailing whitespace (,ss)
function! StripWhitespace()
    let save_cursor = getpos(".")
    let old_query = getreg('/')
    :%s/\s\+$//e
    call setpos('.', save_cursor)
    call setreg('/', old_query)
endfunction



" Map CTRL+n to toggle nerdtree
map <C-n> :NERDTreeToggle<CR>

"  close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif

filetype plugin on


" More Common Settings.
 set scrolloff=3
 set autoindent
 set showmode
 set hidden
 set visualbell

It seems you have typed CTRL N CTRL P as mentioned at the bottom of your screenshot. 好像您已按屏幕快照底部所述键入CTRL N CTRL P。

This is the default key for keyword completion. 这是关键字完成的默认键。 You might try to find out why and where TAB was remaped to completion with :verbose imap <Tab> it will show you the last place where it has been redefined. 您可以尝试使用:verbose imap <Tab>来找出TAB重新映射到完成的原因和位置,它将向您显示重新定义它的最后一个位置。

I would have suspected something like SuperTab which use TAB for every kind of completion but I don't see it in your .vimrc. 我可能会怀疑像SuperTab这样的东西,它会使用TAB进行各种补全 ,但是我在您的.vimrc中看不到它。

Completion can be stopped via <cy> to stop and accept the current completion or via <ce> which stops completion and restores the text as it was before the completion. 可以通过<cy>停止完成并接受当前完成,或者通过<ce>停止完成,并停止完成并恢复完成前的文本。 However the most common way to stop completing is to type a non-keyword character like space or a symbol. 但是,停止完成的最常见方法是键入非关键字字符,例如空格或符号。

It should be noted that Vim does not complete on <tab> in insert mode by default. 应该注意的是,默认情况下,Vim在插入模式下不会在<tab>上完成。 Instead it uses <cn> and <cp> . 相反,它使用<cn><cp> If completion is happening on <tab> then you may want to track down the mapping via :verbose imap <tab> as @FDinoff suggested. 如果在<tab>上完成操作,那么您可能需要按照@FDinoff的建议通过:verbose imap <tab>来跟踪映射。

For more help see: 有关更多帮助,请参见:

:h ins-completion

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM