关闭 Jedi-Vim 中的所有自动代码完成
Turn Off All automatic code complete in Jedi-Vim
我正在尝试在 vim 中使用 python-jedi,但目前它完全无法使用,因为它试图在奇怪的时间完成代码。
我添加了以下行:
let g:jedi#popup_on_dot = 0
到我的 vimrc 文件,它确实停止了对“.”的自动完成。但是当我尝试在逗号后添加空格到以下代码时:
upper_blue = np.array([130,255,255])
自动补全一直弹出,好像是我在方括号里的时候,但是跟数组没有关系。
我也安装了 pymode,但我确实关闭了绳索功能...我承认我不知道如何完全关闭 pymode。
VimRC:
" Better command-line completion
set wildmenu
" Show partial commands in the last line of the screen
set showcmd
" Highlight searches (use <C-L> to temporarily turn off highlighting; see the
" mapping of <C-L> below)
set hlsearch
" Modelines have historically been a source of security vulnerabilities. As
" such, it may be a good idea to disable them and use the securemodelines
" script, <http://www.vim.org/scripts/script.php?script_id=1876>.
" set nomodeline
"------------------------------------------------------------
" Usability options {{{1
"
" These are options that users frequently set in their .vimrc. Some of them
" change Vim's behaviour in ways which deviate from the true Vi way, but
" which are considered to add usability. Which, if any, of these options to
" use is very much a personal preference, but they are harmless.
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start
" When opening a new line and no filetype-specific indenting is enabled, keep
" the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent
" Stop certain movements from always going to the first character of a line.
" While this behaviour deviates from that of Vi, it does what most users
" coming from other editors would expect.
set nostartofline
" Display the cursor position on the last line of the screen or in the status
" line of a window
set ruler
" Always display the status line, even if only one window is displayed
set laststatus=2
" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm
" Use visual bell instead of beeping when doing something wrong
set visualbell
" And reset the terminal code for the visual bell. If visualbell is set, and
" this line is also included, vim will neither flash nor beep. If visualbell
" is unset, this does nothing.
set t_vb=
" Enable use of the mouse for all modes
set mouse=a
" Set the command window height to 2 lines, to avoid many cases of having to
" "press <Enter> to continue"
set cmdheight=2
" Display line numbers on the left
set number
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F11>
"------------------------------------------------------------
" Indentation options {{{1
"
" Indentation settings according to personal preference.
" Indentation settings for using 2 spaces instead of tabs.
" Do not change 'tabstop' from its default value of 8 with this setup.
set shiftwidth=2
set softtabstop=2
set expandtab
" Indentation settings for using hard tabs for indent. Display tabs as
" two characters wide.
"set shiftwidth=2
"set tabstop=2
"------------------------------------------------------------
" Mappings {{{1
"
" Useful mappings
" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
" which is the default
map Y y$
map <F2> :NERDTreeToggle<CR>
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>
execute pathogen#infect()
au FileType html compiler html
au QuickFixCmdPost make cwindow
"------------------------------------------------------------
"----Python Vim---"
"let g:pymode_rope = 0
" Documentation
"let g:pymode_doc = 1
"let g:pymode_doc_key = 'K'
"
" "Linting
"let g:pymode_lint = 1
"let g:pymode_lint_checker = "pyflakes,pep8"
" " Auto check on save
"let g:pymode_lint_write = 1
"
" " Support virtualenv
"let g:pymode_virtualenv = 0
"
" " Enable breakpoints plugin
"let g:pymode_breakpoint = 1
"let g:pymode_breakpoint_key = '<leader>b'
"
" " syntax highlighting
"let g:pymode_syntax = 0
"let g:pymode_syntax_all = 0
"let g:pymode_syntax_indent_errors = g:pymode_syntax_all
"let g:pymode_syntax_space_errors = g:pymode_syntax_all
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'tpope/vim-fugitive'
Plugin 'scrooloose/nerdtree'
" Bundle 'klen/python-mode'
Plugin 'davidhalter/jedi-vim'
Plugin 'altercation/vim-colors-solarized'
call vundle#end() " required
filetype plugin indent on " required
"jedi"
let g:jedi#popup_on_dot = 0
let g:jedi#auto_initialization = 1
"---PowerLine--"
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 9
set laststatus=2
"--Look and feel--"
if has('gui_running')
set background=light
else
set background=dark
endif
很确定 jedi-vim 唯一启动自动完成的时间是 .
。其他一切都可能是另一个插件的错误(可能 supertab
或类似 autocomplpop
的东西)。
jedi-vim 还包裹了 CtrlSpace。但这应该不会引起任何问题(除非你使用的正是那个命令。
使用这个:
let g:jedi#completions_enabled = 0
如 jedi-vim readme 中所述,当有一个点时禁用自动完成应该就足够了。我看到 OP 在他的 ~/.vimrc
中已经有了这个(在问题中):
let g:jedi#popup_on_dot = 0
to a similar question mentions the auto-complete
manual 它有几种策略可以关闭自动完成功能,并有多种组合键可以重新打开它。
更新:这部分答案与启用 jedi-vim 时如何复制粘贴的问题更相关。
此外,Jedi-vimissue 211 suggests using vim's pastetoggle
mode. Vimwiki's page on paste with autoindent mentions how to set shortcuts for pastetoggle
. There is even a plugin called vim-bracketed-paste在"xterm-compatible terminal emulator that supports bracketed paste mode".
中自动检测粘贴
我正在尝试在 vim 中使用 python-jedi,但目前它完全无法使用,因为它试图在奇怪的时间完成代码。
我添加了以下行:
let g:jedi#popup_on_dot = 0
到我的 vimrc 文件,它确实停止了对“.”的自动完成。但是当我尝试在逗号后添加空格到以下代码时:
upper_blue = np.array([130,255,255])
自动补全一直弹出,好像是我在方括号里的时候,但是跟数组没有关系。
我也安装了 pymode,但我确实关闭了绳索功能...我承认我不知道如何完全关闭 pymode。
VimRC:
" Better command-line completion
set wildmenu
" Show partial commands in the last line of the screen
set showcmd
" Highlight searches (use <C-L> to temporarily turn off highlighting; see the
" mapping of <C-L> below)
set hlsearch
" Modelines have historically been a source of security vulnerabilities. As
" such, it may be a good idea to disable them and use the securemodelines
" script, <http://www.vim.org/scripts/script.php?script_id=1876>.
" set nomodeline
"------------------------------------------------------------
" Usability options {{{1
"
" These are options that users frequently set in their .vimrc. Some of them
" change Vim's behaviour in ways which deviate from the true Vi way, but
" which are considered to add usability. Which, if any, of these options to
" use is very much a personal preference, but they are harmless.
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start
" When opening a new line and no filetype-specific indenting is enabled, keep
" the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent
" Stop certain movements from always going to the first character of a line.
" While this behaviour deviates from that of Vi, it does what most users
" coming from other editors would expect.
set nostartofline
" Display the cursor position on the last line of the screen or in the status
" line of a window
set ruler
" Always display the status line, even if only one window is displayed
set laststatus=2
" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm
" Use visual bell instead of beeping when doing something wrong
set visualbell
" And reset the terminal code for the visual bell. If visualbell is set, and
" this line is also included, vim will neither flash nor beep. If visualbell
" is unset, this does nothing.
set t_vb=
" Enable use of the mouse for all modes
set mouse=a
" Set the command window height to 2 lines, to avoid many cases of having to
" "press <Enter> to continue"
set cmdheight=2
" Display line numbers on the left
set number
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F11>
"------------------------------------------------------------
" Indentation options {{{1
"
" Indentation settings according to personal preference.
" Indentation settings for using 2 spaces instead of tabs.
" Do not change 'tabstop' from its default value of 8 with this setup.
set shiftwidth=2
set softtabstop=2
set expandtab
" Indentation settings for using hard tabs for indent. Display tabs as
" two characters wide.
"set shiftwidth=2
"set tabstop=2
"------------------------------------------------------------
" Mappings {{{1
"
" Useful mappings
" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
" which is the default
map Y y$
map <F2> :NERDTreeToggle<CR>
" Map <C-L> (redraw screen) to also turn off search highlighting until the
" next search
nnoremap <C-L> :nohl<CR><C-L>
execute pathogen#infect()
au FileType html compiler html
au QuickFixCmdPost make cwindow
"------------------------------------------------------------
"----Python Vim---"
"let g:pymode_rope = 0
" Documentation
"let g:pymode_doc = 1
"let g:pymode_doc_key = 'K'
"
" "Linting
"let g:pymode_lint = 1
"let g:pymode_lint_checker = "pyflakes,pep8"
" " Auto check on save
"let g:pymode_lint_write = 1
"
" " Support virtualenv
"let g:pymode_virtualenv = 0
"
" " Enable breakpoints plugin
"let g:pymode_breakpoint = 1
"let g:pymode_breakpoint_key = '<leader>b'
"
" " syntax highlighting
"let g:pymode_syntax = 0
"let g:pymode_syntax_all = 0
"let g:pymode_syntax_indent_errors = g:pymode_syntax_all
"let g:pymode_syntax_space_errors = g:pymode_syntax_all
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'tpope/vim-fugitive'
Plugin 'scrooloose/nerdtree'
" Bundle 'klen/python-mode'
Plugin 'davidhalter/jedi-vim'
Plugin 'altercation/vim-colors-solarized'
call vundle#end() " required
filetype plugin indent on " required
"jedi"
let g:jedi#popup_on_dot = 0
let g:jedi#auto_initialization = 1
"---PowerLine--"
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 9
set laststatus=2
"--Look and feel--"
if has('gui_running')
set background=light
else
set background=dark
endif
很确定 jedi-vim 唯一启动自动完成的时间是 .
。其他一切都可能是另一个插件的错误(可能 supertab
或类似 autocomplpop
的东西)。
jedi-vim 还包裹了 CtrlSpace。但这应该不会引起任何问题(除非你使用的正是那个命令。
使用这个:
let g:jedi#completions_enabled = 0
如 jedi-vim readme 中所述,当有一个点时禁用自动完成应该就足够了。我看到 OP 在他的 ~/.vimrc
中已经有了这个(在问题中):
let g:jedi#popup_on_dot = 0
auto-complete
manual 它有几种策略可以关闭自动完成功能,并有多种组合键可以重新打开它。
更新:这部分答案与启用 jedi-vim 时如何复制粘贴的问题更相关。
此外,Jedi-vimissue 211 suggests using vim's pastetoggle
mode. Vimwiki's page on paste with autoindent mentions how to set shortcuts for pastetoggle
. There is even a plugin called vim-bracketed-paste在"xterm-compatible terminal emulator that supports bracketed paste mode".