" Pymode core functions" DESC: Check variable and set default value if it not existsfun! pymode#default(name, default) "{{{if !exists(a:name)let {a:name} = a:defaultreturn 0endifreturn 1endfunction "}}}" DESC: Import python libsfun! pymode#init(plugin_root, paths) "{{{PymodePython import sys, vimPymodePython sys.path.insert(0, vim.eval('a:plugin_root'))PymodePython sys.path = vim.eval('a:paths') + sys.pathendfunction "}}}" DESC: Show wide messagefun! pymode#wide_message(msg) "{{{let x=&ruler | let y=&showcmdset noruler noshowcmdredrawechohl Debug | echo strpart("[Pymode] " . a:msg, 0, &columns-1) | echohl nonelet &ruler=x | let &showcmd=yendfunction "}}}" DESC: Show errorfun! pymode#error(msg) "{{{execute "normal \<Esc>"echohl ErrorMsgechomsg "[Pymode]: error: " . a:msgechohl Noneendfunction "}}}" DESC: Open quickfix windowfun! pymode#quickfix_open(onlyRecognized, maxHeight, minHeight, jumpError) "{{{let numErrors = len(filter(getqflist(), 'v:val.valid'))let numOthers = len(getqflist()) - numErrorsif numErrors > 0 || (!a:onlyRecognized && numOthers > 0)let num = winnr()botright copenexe max([min([line("$"), a:maxHeight]), a:minHeight]) . "wincmd _"if a:jumpErrorccelseif num != winnr()wincmd pendifelseccloseendifredrawif numOthers > 0call pymode#wide_message(printf('Quickfix: %d(+%d)', numErrors, numOthers))elseif numErrors > 0call pymode#wide_message(printf('Quickfix: %d', numErrors))endifendfunction "}}}" DESC: Open temp buffer.fun! pymode#tempbuffer_open(name) "{{{pcloseexe g:pymode_preview_position . " " . g:pymode_preview_height . "new " . a:namesetlocal buftype=nofile bufhidden=delete noswapfile nowrap previewwindowredrawendfunction "}}}" DESC: Remove unused whitespacesfun! pymode#trim_whitespaces() "{{{if g:pymode_trim_whitespaceslet cursor_pos = getpos('.')silent! %s/\s\+$//ecall setpos('.', cursor_pos)endifendfunction "}}}fun! pymode#save() "{{{if &modifiable && &modifiedtrynoautocmd writecatch /E212/call pymode#error("File modified and I can't save it. Please save it manually.")return 0endtryendifreturn expand('%') != ''endfunction "}}}fun! pymode#reload_buf_by_nr(nr) "{{{let cur = bufnr("")tryexe "buffer " . a:nrcatch /E86/returnendtryexe "e!"exe "buffer " . curendfunction "}}}fun! pymode#buffer_pre_write() "{{{let b:pymode_modified = &modifiedendfunction "}}}fun! pymode#buffer_post_write() "{{{if g:pymode_ropeif g:pymode_rope_regenerate_on_write && b:pymode_modifiedcall pymode#debug('regenerate')call pymode#rope#regenerate()endifendifif g:pymode_lintif g:pymode_lint_unmodified || (g:pymode_lint_on_write && b:pymode_modified)call pymode#debug('check code')call pymode#lint#check()endifendifendfunction "}}}fun! pymode#debug(msg) "{{{" Pymode's debug function." Should be called by other pymode's functions to report outputs. See" the function PymodeDebugFolding for example." TODO: why echom here creates a problem?" echom '' . a:msg + '|||||||||||'let l:info_separator = repeat('-', 79)if g:pymode_debugif ! exists('g:pymode_debug_counter')let g:pymode_debug_counter = 0endiflet g:pymode_debug_counter += 1" NOTE: Print a separator for every message except folding ones (since" they could be many).if a:msg !~ 'has folding:'echom l:info_separatorendifechom '' . 'pymode debug msg ' . g:pymode_debug_counter . ': ' . a:msgendifendfunction "}}}fun! pymode#quit() "{{{augroup pymodeau! * <buffer>augroup ENDendfunction "}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。