品易云推流 关闭
文章详情页
文章 > Python基础教程 > python vim中有哪些对象

python vim中有哪些对象

Python vim

头像

小妮浅浅

2021-06-09 09:35:412252浏览 · 0收藏 · 0评论

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、实例

: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电脑。

关注

关注公众号,随时随地在线学习

本教程部分素材来源于网络,版权问题联系站长!

底部广告图