0

Today when I open my computer and enter vi, strange things happened: backspace not working(solved), and Tab brings up keyword completion in insert mode, which is what I'm worrying about. Before, I can use Tab in insert mode to insert 4 spaces as expandtab is set. But now, when I press Tab, a long list of words show up just like when you hit CtrlN.

I thought that was a problem in my .vimrc and other plugins, but after disabling all the plugins and checking my .vimrc, I found no problem. I also tried to do researches in the help files, but still found nothing. I've also tried to recompile my vim, but still got nothing. Can anyone help?

EDIT: The situation also occurs in normal text files, where pressing Tab will just bring up all the words in the text file.

EDIT2: My .vimrc file:

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/bundle/vundle/
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Plugin 'vim-scripts/android.vim'
Plugin 'davidhalter/jedi-vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'tpope/vim-fugitive'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'scrooloose/nerdtree'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
execute pathogen#infect()
syntax on
set laststatus=2
set shiftwidth=4
set expandtab
set hlsearch
set incsearch
set tabstop=4
set scrolloff=3
set number
set showcmd
set lines=24 columns=80
set splitright
set backspace=indent,eol,start
colorscheme slate
map Y y$

" Jedi displays function call signatures in insert mode in real-time
" highlighting the current argument. The call signatures can be displayed as
" a pop-up in the buffer (set to 1, the default), which has the advantage of
" being easier to refer to, or in Vim's command line aligned with
" the function call (set to 2), which can improve the integrity of Vim's
" undo history.
let g:jedi#show_call_signatures = "1"
let g:jedi#show_call_signatures_delay = "0"
let g:jedi#goto_command = "<leader>g"
let g:jedi#goto_assignments_command = ""
let g:jedi#goto_definitions_command = ""
let g:jedi#documentation_command = "K"
let g:jedi#usages_command = "<leader>u"
let g:jedi#completions_command = "<C-Space>"
let g:jedi#rename_command = "<leader>r"
let g:jedi#completions_enabled = "1"

" YouCompleteMe settings
let g:ycm_confirm_extra_conf = 0
let g:ycm_server_log_level = 'warning'
let g:ycm_server_use_vim_stdout = 0
let g:ycm_server_keep_logfiles = 1
let g:ycm_path_to_python_interpreter = '/usr/bin/python3'
let g:ycm_enable_diagnostic_signs = 0
let g:ycm_enable_diagnostic_highlighting = 0
let g:ycm_key_list_select_completion = ['<Down>']
let g:ycm_key_list_previous_completion = ['<Up>']
" let g:ycm_show_diagnostics_ui = 0

" NERDTree
let NERDTreeIgnore = ['\.o', '\~$']

" hy
let g:hy_enable_conceal = 1
setlocal concealcursor=n

" avoid mispress of <SHIFT> when writing and quiting
com -nargs=0 Q q
com -nargs=0 W w
com -nargs=0 Wq wq
com -nargs=0 Wqa wqa

" copy every thing in the file into clipboard
com -nargs=0 CpAll :norm ggVG"+y

" Clear done items in TODO
com -nargs=0 TODOClear :g/\[x\]/ norm dd
com -nargs=0 TODODown :g/\[x\]/ norm ddGp

" Remove trailing space
com -nargs=0 Rmspace :%s/\s*$// | norm 

" mksession command
com -nargs=1 Mks :mksession! ~/.vim/<args>.vim
com -nargs=1 Delsession :!rm ~/.vim/<args>.vim

" edit this file command
com -nargs=0 Vimrc :split ~/.vimrc

" Goto the TODO file
com -nargs=0 TODO :split ~/Desktop/TODO

" ConqueTerm shortened
com -nargs=0 Shell :ConqueTerm bash
com -nargs=0 Python :ConqueTerm python3

" Jedi command
com -nargs=0 Jedi :call Jedi()

autocmd BufRead * call Answer()
autocmd BufRead TODO set syntax=TODO
autocmd BufRead *.ss set filetype=ss
autocmd FileType python call Jedi()

function Jedi()
    set omnifunc=jedi#completions
    set completefunc=jedi#completions
endfunction

function Answer()
    if getline(1) =~? '.*answer.*'
        " || expand("%:t") =~? '.*answer[^.]*\>'
        set syntax=answer
    endif
endfunction
6
  • This very probably comes from your vimrc. Have you run vim -u NONE and reproduced the behavior? Have you read how do i debug my vimrc?
    – statox
    Commented Jan 15, 2017 at 17:52
  • @statox It does helps. If I start vi using that command, pressing Tab will insert a literally tab of 8 spaces wide. But I cannot even found commands related to Tab in my vimrc.
    – Chromium
    Commented Jan 16, 2017 at 5:10
  • you may have a auto complete plugin. I have FuzzyWordCompletion as auto complete plugin. Try giving :set completefunc, if yoy have any it will show in status bar. You can disable them.
    – SibiCoder
    Commented Jan 18, 2017 at 13:28
  • @SibiCoder Yes, and it is YouCompleteMe. But I've tried to disable every plugin in my .vimrc, but it still doesn't work. Also, when I tab Tab, what is shown on the status bar is -- Keyword Completion (^N^P), which is vim-builtin and not related to any plugins.
    – Chromium
    Commented Jan 18, 2017 at 14:01
  • As far as I know, every plugin under .vim directory is automatically sourced when you open vim. I don't think you disabled it. Can I know how you disables the plugin, through vimrc? What was the command you gave to disable it? Please paste the relevant commands here, or the entire vimrc could help.
    – SibiCoder
    Commented Jan 19, 2017 at 14:50

1 Answer 1

0

Thanks to @SibiCoder's hints, I now know where the problem is. After changing the directories name under my ~/.vim directory, I finally tracked down to which plugin directory is doing the job, which is in the after/plugin directory in which the snipMate.vim has mapped Tab in a quite strange way:

ino <silent> <tab> <c-r>=TriggerSnippet()<cr>
snor <silent> <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>
ino <silent> <s-tab> <c-r>=BackwardsSnippet()<cr>
snor <silent> <s-tab> <esc>i<right><c-r>=BackwardsSnippet()<cr>
ino <silent> <c-r><tab> <c-r>=ShowAvailableSnips()<cr>

But anyway, the ultimate solution to this kind of problem is just to look one by one and experiment the problem, which in my case is Tab, to find the problem. My method to check is to change the directories name one by one, for example append a _ to it and delete it. Hope this can help others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.