mirror of
https://github.com/gryf/pythonhelper.git
synced 2025-12-19 04:20:20 +01:00
Version 0.81: - fixed a small bug in indent level recognition
This commit is contained in:
committed by
Able Scraper
parent
f5b70c33bb
commit
ab9d0e5e69
@@ -1,7 +1,7 @@
|
|||||||
" File: pythonhelper.vim
|
" File: pythonhelper.vim
|
||||||
" Author: Michal Vitecek <fuf-at-mageo-dot-cz>
|
" Author: Michal Vitecek <fuf-at-mageo-dot-cz>
|
||||||
" Version: 0.80
|
" Version: 0.81
|
||||||
" Last Modified: Oct 19, 2002
|
" Last Modified: Oct 24, 2002
|
||||||
"
|
"
|
||||||
" Overview
|
" Overview
|
||||||
" --------
|
" --------
|
||||||
@@ -71,6 +71,7 @@ class PythonTag(object):
|
|||||||
TAGTYPE_FUNCTION : "function",
|
TAGTYPE_FUNCTION : "function",
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
@@ -121,7 +122,7 @@ class PythonTag(object):
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
# SimplePythonTagsParser() {{{
|
# class SimplePythonTagsParser() {{{
|
||||||
class SimplePythonTagsParser(object):
|
class SimplePythonTagsParser(object):
|
||||||
# DOC {{{
|
# DOC {{{
|
||||||
"""Provides a simple python tag parser. Returns list of PythonTag()
|
"""Provides a simple python tag parser. Returns list of PythonTag()
|
||||||
@@ -131,6 +132,7 @@ class SimplePythonTagsParser(object):
|
|||||||
|
|
||||||
|
|
||||||
# STATIC VARIABLES {{{
|
# STATIC VARIABLES {{{
|
||||||
|
|
||||||
# how many chars a single tab represents (visually)
|
# how many chars a single tab represents (visually)
|
||||||
TABSIZE = 8
|
TABSIZE = 8
|
||||||
|
|
||||||
@@ -140,6 +142,7 @@ class SimplePythonTagsParser(object):
|
|||||||
classRE = re.compile('class[ \t]+([^(:]+).*')
|
classRE = re.compile('class[ \t]+([^(:]+).*')
|
||||||
# regexp used to get method or function name
|
# regexp used to get method or function name
|
||||||
methodRE = re.compile('def[ \t]+([^(]+).*')
|
methodRE = re.compile('def[ \t]+([^(]+).*')
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
@@ -170,6 +173,9 @@ class SimplePythonTagsParser(object):
|
|||||||
|
|
||||||
def getTags(self):
|
def getTags(self):
|
||||||
# DOC {{{
|
# DOC {{{
|
||||||
|
"""Determines all the tags for the buffer. Returns tuple in format
|
||||||
|
(tagLineNumbers, tags,).
|
||||||
|
"""
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# CODE {{{
|
# CODE {{{
|
||||||
@@ -512,8 +518,8 @@ def findTag(bufferNumber, changedTick):
|
|||||||
continue
|
continue
|
||||||
# }}}
|
# }}}
|
||||||
# }}}
|
# }}}
|
||||||
# if the line's indentation starts before the nearest tag's one, the tag is wrong {{{
|
# if the line's indentation starts before or at the nearest tag's one, the tag is wrong {{{
|
||||||
if (lineStart < tags[nearestLineNumber].indentLevel):
|
if (lineStart <= tags[nearestLineNumber].indentLevel):
|
||||||
nearestLineNumber = -1
|
nearestLineNumber = -1
|
||||||
break
|
break
|
||||||
# }}}
|
# }}}
|
||||||
@@ -569,6 +575,7 @@ def deleteTags(bufferNumber):
|
|||||||
|
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
|
" VIM functions {{{
|
||||||
|
|
||||||
function! PHCursorHold()
|
function! PHCursorHold()
|
||||||
" only python is supported {{{
|
" only python is supported {{{
|
||||||
@@ -602,8 +609,11 @@ function! TagInStatusLine()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
|
||||||
|
" event binding, vim customizing {{{
|
||||||
|
|
||||||
" autocommands binding
|
" autocommands binding
|
||||||
autocmd CursorHold * call PHCursorHold()
|
autocmd CursorHold * call PHCursorHold()
|
||||||
autocmd BufDelete * silent call PHBufferDelete()
|
autocmd BufDelete * silent call PHBufferDelete()
|
||||||
@@ -621,5 +631,6 @@ set laststatus=2
|
|||||||
" set the status line to display some useful information
|
" set the status line to display some useful information
|
||||||
set stl=%-f%r\ %2*%m%*\ \ \ \ %1*%{TagInStatusLine()}%*%=[%l:%c]\ \ \ \ [buf\ %n]
|
set stl=%-f%r\ %2*%m%*\ \ \ \ %1*%{TagInStatusLine()}%*%=[%l:%c]\ \ \ \ [buf\ %n]
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
" vim:foldmethod=marker
|
" vim:foldmethod=marker
|
||||||
|
|||||||
Reference in New Issue
Block a user