1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 11:30:29 +01:00

Plugins update, PySmell remove, some cosmetic changes in vimrc.

This commit is contained in:
2010-06-27 20:14:22 +02:00
parent ea245563e7
commit 711eaed286
21 changed files with 2247 additions and 1196 deletions

View File

@@ -37,7 +37,7 @@ class Assignment(Binding):
pass
class FunctionDefinition(Binding):
pass
_property_decorator = False
class Scope(dict):
@@ -167,7 +167,16 @@ class Checker(ast.NodeVisitor):
decorators = node.decorators
self.visit_nodes(decorators)
self.add_binding(node, FunctionDefinition(node.name, node))
# Check for property decorator
func_def = FunctionDefinition(node.name, node)
for decorator in decorators:
if getattr(decorator, 'attr', None) in ('setter', 'deleter'):
func_def._property_decorator = True
self.add_binding(node, func_def)
self.visit_Lambda(node)
def visit_Lambda(self, node):
@@ -300,6 +309,14 @@ class Checker(ast.NodeVisitor):
scope.globals.update(dict.fromkeys(node.names))
def visit_ClassDef(self, node):
try:
decorators = node.decorator_list
except AttributeError:
# Use .decorators for Python 2.5 compatibility
decorators = getattr(node, 'decorators', [])
self.visit_nodes(decorators)
self.add_binding(node, Assignment(node.name, node))
self.visit_nodes(node.bases)
@@ -344,7 +361,9 @@ class Checker(ast.NodeVisitor):
# Check for a redefined function
func = scope.get(name)
if (isinstance(func, FunctionDefinition) and isinstance(value, FunctionDefinition)):
self.report(messages.RedefinedFunction, line, name, func.source.lineno)
# Property-decorated functions (@x.setter) should have duplicate names
if not value._property_decorator:
self.report(messages.RedefinedFunction, line, name, func.source.lineno)
# Check for redefining an unused import
if report_redef and not isinstance(scope, ClassScope):

View File

@@ -1,3 +1,4 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki filetype plugin file
" Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/
@@ -41,6 +42,19 @@ inoremap <buffer> <expr> <CR> vimwiki_lst#insertCR()
nnoremap <buffer> o :call vimwiki_lst#insertOo('o')<CR>a
nnoremap <buffer> O :call vimwiki_lst#insertOo('O')<CR>a
if !empty(&langmap)
" Valid only if langmap is a comma separated pairs of chars
let l_o = matchstr(&langmap, '\C,\zs.\zeo,')
if l_o
exe 'nnoremap <buffer> '.l_o.' :call vimwiki_lst#insertOo("o")<CR>a'
endif
let l_O = matchstr(&langmap, '\C,\zs.\zeO,')
if l_O
exe 'nnoremap <buffer> '.l_O.' :call vimwiki_lst#insertOo("O")<CR>a'
endif
endif
" COMMENTS }}}
" FOLDING for headers and list items using expr fold method. {{{
@@ -205,6 +219,8 @@ command! -buffer VimwikiVSplitWord call vimwiki#WikiFollowWord('vsplit')
command! -buffer -range VimwikiToggleListItem call vimwiki_lst#ToggleListItem(<line1>, <line2>)
command! -buffer VimwikiGenerateLinks call vimwiki#generate_links()
exe 'command! -buffer -nargs=* VimwikiSearch vimgrep <args> '.
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
@@ -215,6 +231,8 @@ exe 'command! -buffer -nargs=* VWS vimgrep <args> '.
command! -buffer -nargs=* VimwikiTable call vimwiki_tbl#create(<f-args>)
command! -buffer VimwikiTableAlignQ call vimwiki_tbl#align_or_cmd('gqq')
command! -buffer VimwikiTableAlignW call vimwiki_tbl#align_or_cmd('gww')
command! -buffer VimwikiTableMoveColumnLeft call vimwiki_tbl#move_column_left()
command! -buffer VimwikiTableMoveColumnRight call vimwiki_tbl#move_column_right()
" COMMANDS }}}
@@ -291,21 +309,39 @@ noremap <silent><script><buffer>
if g:vimwiki_table_auto_fmt
inoremap <expr> <buffer> <CR> vimwiki_tbl#kbd_cr()
inoremap <expr> <buffer> <Tab> vimwiki_tbl#kbd_tab()
inoremap <expr> <buffer> <S-Tab> vimwiki_tbl#kbd_shift_tab()
endif
nnoremap <buffer> gqq :VimwikiTableAlignQ<CR>
nnoremap <buffer> gww :VimwikiTableAlignW<CR>
nnoremap <buffer> <A-Left> :VimwikiTableMoveColumnLeft<CR>
nnoremap <buffer> <A-Right> :VimwikiTableMoveColumnRight<CR>
" Misc mappings
inoremap <buffer> <S-CR> <br /><CR>
" Text objects {{{
omap <silent><buffer> ah :<C-U>call vimwiki#TO_header(0, 0)<CR>
vmap <silent><buffer> ah :<C-U>call vimwiki#TO_header(0, 1)<CR>
onoremap <silent><buffer> ah :<C-U>call vimwiki#TO_header(0, 0)<CR>
vnoremap <silent><buffer> ah :<C-U>call vimwiki#TO_header(0, 1)<CR>
omap <silent><buffer> ih :<C-U>call vimwiki#TO_header(1, 0)<CR>
vmap <silent><buffer> ih :<C-U>call vimwiki#TO_header(1, 1)<CR>
onoremap <silent><buffer> ih :<C-U>call vimwiki#TO_header(1, 0)<CR>
vnoremap <silent><buffer> ih :<C-U>call vimwiki#TO_header(1, 1)<CR>
nmap <silent><buffer> = :call vimwiki#AddHeaderLevel()<CR>
nmap <silent><buffer> - :call vimwiki#RemoveHeaderLevel()<CR>
onoremap <silent><buffer> a\ :<C-U>call vimwiki#TO_table_cell(0, 0)<CR>
vnoremap <silent><buffer> a\ :<C-U>call vimwiki#TO_table_cell(0, 1)<CR>
onoremap <silent><buffer> i\ :<C-U>call vimwiki#TO_table_cell(1, 0)<CR>
vnoremap <silent><buffer> i\ :<C-U>call vimwiki#TO_table_cell(1, 1)<CR>
onoremap <silent><buffer> ac :<C-U>call vimwiki#TO_table_col(0, 0)<CR>
vnoremap <silent><buffer> ac :<C-U>call vimwiki#TO_table_col(0, 1)<CR>
onoremap <silent><buffer> ic :<C-U>call vimwiki#TO_table_col(1, 0)<CR>
vnoremap <silent><buffer> ic :<C-U>call vimwiki#TO_table_col(1, 1)<CR>
noremap <silent><buffer> = :call vimwiki#AddHeaderLevel()<CR>
noremap <silent><buffer> - :call vimwiki#RemoveHeaderLevel()<CR>
" }}}