为什么在我设置 python-mode indent=1 之后,我在编码 python 时仍然无法让我的代码自动缩进
Why after I set python-mode indent=1 I still can't get my code indented automatically when I am coding python
所以最近我看了一个关于 "using vim as a python editor" 的 youtube 视频,我决定使用它。这是我第一次使用 Vim。我的系统是 OS X 10.9.5,我使用的是 MacVim。所以我在我的 gvimrc 文件中添加了以下代码。
" Setting for python-mode"
map <Leader> g :call RopeGotoDefinition() <CR>
let ropevim_enable_shortcuts = 1
let g:pymode_rope_goto_def_newwin = "vnew"
let g:pymode_rope_extended_complete = 1
let g:pymode_breakpoint = 0
let g:pymode_syntax = 1
let g:pymode_syntax_builtin_objs = 0
let g:pymode_syntax_builtin_funcs = 0
let g:pymode_indent = 1
map <Leader> b Oimport ipdb; ipdb.set_trace() #BREAKPOINT<C-c>
" ???set completeopt = longest,menuone"
function! OmniPopup(action)
if pumvisible()
if a:action == 'j'
return "\<C-N>"
elseif a:action == 'k'
return "<\C-P>"
endif
endif
return a:action
endfunction
inoremap <silent><C-j> <C-R>=OmniPopup('j')<CR>
inoremap <silent><C-k> <C-R>=OmniPopup('k')<CR>
set nofoldenable
所以我实际上应该使用以下代码调用关于 python 的缩进:let g:pymode_indent = 1
。但是当我创建一个新的 Python 文件并用它来编码 Python 时。我仍然无法使用缩进。
我对如何设置 gvimrc 文件一无所知,我只是从那个视频中复制代码。什么地方出了错?谢谢!
您的 vimrc
中可能缺少 filetype plugin on
。这将使 vim 能够识别您正在编辑的文件类型,并相应地识别 运行 插件(可能还有一些额外的东西)。
您可以阅读 here 关于文件类型检测和插件的更多信息,或者使用 :help filetype
。
所以最近我看了一个关于 "using vim as a python editor" 的 youtube 视频,我决定使用它。这是我第一次使用 Vim。我的系统是 OS X 10.9.5,我使用的是 MacVim。所以我在我的 gvimrc 文件中添加了以下代码。
" Setting for python-mode"
map <Leader> g :call RopeGotoDefinition() <CR>
let ropevim_enable_shortcuts = 1
let g:pymode_rope_goto_def_newwin = "vnew"
let g:pymode_rope_extended_complete = 1
let g:pymode_breakpoint = 0
let g:pymode_syntax = 1
let g:pymode_syntax_builtin_objs = 0
let g:pymode_syntax_builtin_funcs = 0
let g:pymode_indent = 1
map <Leader> b Oimport ipdb; ipdb.set_trace() #BREAKPOINT<C-c>
" ???set completeopt = longest,menuone"
function! OmniPopup(action)
if pumvisible()
if a:action == 'j'
return "\<C-N>"
elseif a:action == 'k'
return "<\C-P>"
endif
endif
return a:action
endfunction
inoremap <silent><C-j> <C-R>=OmniPopup('j')<CR>
inoremap <silent><C-k> <C-R>=OmniPopup('k')<CR>
set nofoldenable
所以我实际上应该使用以下代码调用关于 python 的缩进:let g:pymode_indent = 1
。但是当我创建一个新的 Python 文件并用它来编码 Python 时。我仍然无法使用缩进。
我对如何设置 gvimrc 文件一无所知,我只是从那个视频中复制代码。什么地方出了错?谢谢!
您的 vimrc
中可能缺少 filetype plugin on
。这将使 vim 能够识别您正在编辑的文件类型,并相应地识别 运行 插件(可能还有一些额外的东西)。
您可以阅读 here 关于文件类型检测和插件的更多信息,或者使用 :help filetype
。