• 技术文章 >Python技术 >Python基础教程

    python vim中有哪些对象

    小妮浅浅小妮浅浅2021-06-09 09:35:41原创1705

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

    专题推荐:python vim
    品易云
    上一篇:python vim模块的函数接口 下一篇:python os怎样处理系统文件

    相关文章推荐

    • centos不支持vim怎么办• centos中的vim是什么• python初学者用vim好吗?• python在vim中怎么用• python vim插件是什么• python vim模块有哪些函数接口• python中vim插件的两种写法• python vim模块的函数接口

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网