
1、Tabpage对象(:h python-tabpage)
一个Tabpage对象对应vim的一个Tabpage。
2、Window对象(:h python-window)
一个Window对象对应vim的一个Window。
3、Buffer对象(:h python-buffer)
一个Buffer对象对应vim的一个buffer,Buffer对象提供了一些属性和方法,可以很方便操作buffer。
4、vim.current对象(:h python-current)
vim.current对象提供了一些属性,可以方便的访问“当前”的vim对象
5、实例
1 2 3 4 5 6 7 8 9 10 11 12 13 | :py print b.name # write the buffer file name
:py b[0] = "hello!!!" # replace the top line
:py b[:] = None # delete the whole buffer
:py del b[:] # delete the whole buffer
:py b[0:0] = [ "a line" ] # add a line at the top
:py del b[2] # delete a line (the third)
:py b.append( "bottom" ) # add a line at the bottom
:py n = len(b) # number of lines
:py (row,col) = b.mark( 'a' ) # named mark
:py r = b.range(1,5) # a sub-range of the buffer
:py b.vars[ "foo" ] = "bar" # assign b:foo variable
:py b.options[ "ff" ] = "dos" # set fileformat
:py del b.options[ "ar" ] # same as :set autoread<
|
以上就是python vim中提供的对象介绍,希望对大家有所帮助。更多Python学习指路:python基础教程
本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。