首页 > 其他分享 >VimScript Note

VimScript Note

时间:2023-01-09 23:34:09浏览次数:53  
标签:脚本 插件 作用域 Vim Note 全局变量 VimScript

初创建于: 2022-02-16 21:19

VimScript

要想写vim插件, 学习vimscript还真是不能省的啊.

暂定vim插件的学习路线为: vimscript \(\rightarrow\) lua \(\rightarrow\) typescript

将网络上已经有的东西重新写一遍是没有什么意义的, 这里只列出一些比较重要的东西, 其余内容贴上链接.

Vim 变量

vim存在三种变量: 全局变量(g), 局部变量(l)和脚本变量(s).

let g:helloworld = 1  " 这是一个全局变量, g: 前缀未省略
let helloworld = 1    " 这也是一个全局变量,在函数外部,默认的作用域是全局的

function! HelloWorld()
  let g:helloworld = 1    " 这是函数内部全局变量
  let helloworld = 1      " 这是一个函数内部的局部变量,在函数内部,默认的作用域为局部变量
endfunction
前缀 描述
g: 全局变量
l: 局部变量,只可在函数内部使用
s: 脚本变量,只可以在当前脚本函数内使用
v: Vim 特殊变量
b: 作用域限定在某一个缓冲区内
w: 作用域限定在窗口内部
t: 作用域限定在标签内部

Vim插件的目录结构

目录 内容
autoload/ 自动载入脚本
colors/ 颜色主题
plugin/ 在 Vim 启动时将被载入的脚本
ftdetect/ 文件类型识别脚本
syntax/ 语法高亮文件
ftplugin/ 文件类型相关插件
compiler/ 编译器
indent/ 语法对齐

详见 Vim插件开发指南

参考资料

标签:脚本,插件,作用域,Vim,Note,全局变量,VimScript
From: https://www.cnblogs.com/Corona09/p/17038881.html

相关文章

  • note_2023年1月9日22点46分
    D:\code_gitee\python_socket\agvServer.tsimport{createServer}from"net";constserver=createServer();server.listen(19204,"localhost");server.on("conn......
  • 01notepad++如何比较两个文件内容
    下面介绍,通过在NotePad中下载安装Compare插件,可以比较两个文件内容。(推荐学习:notepad++)打开NotePad,点击工具栏上的【插件】–》PluginManager—》ShowPluginManage......
  • 解决jupyter-notebook启动缺少模块No module named 'ipyparallel'
    1、启动jupyter-notebook启动缺少模块Nomodulenamed'ipyparallel',具体:Errorloadingserverextensionipyparallel.nbextensionTraceback(mostrecentcalll......
  • Jupyter notebook如何打印多个结果
    Jupyternotebook如何打印多个结果fromIPython.core.interactiveshellimportInteractiveShellInteractiveShell.ast_node_interactivity='all'InteractiveShell.ast......
  • GoodNotes 5 for Mac(笔记软件) 5.8.13中文版
    GoodNotes是一款实用的笔记记录软件,goodnotes不仅仅能够识别pdf文件和图片,而且还支持手写编辑文件功能,goodnotes电脑版能够将手写内容转换为文本,软件能够让用户在导入的PDF......
  • Jupyter notebook
     JupyterNotebook工作空间/默认路径的设置方式​​ Jupyternotebook查看Markdown.md文件​​JupyterNotebook介绍、安装及使用教程 https://www.jianshu.com/p/......
  • 用hardhat 做ERC20转帐时报了 Nonce too high. Expected nonce to be 6 but got 11. N
    https://github.com/scaffold-eth/scaffold-eth/issues/476InMetamask,ensureyouareonyourdev/testaccountthen:clickontheavatarcircletoprightInthe......
  • Notepad++下载避坑
    是免费的编辑器NOTEPAD++,今天下载时竟然发现了假冒网站,安装还要收费。新手千万不要上当,真是良心叫狗吃了。官网地址:https://notepad-plus.en.softonic.com/ 第一个程序......
  • Jupyter Notebook入门指南
    作者:京东科技隐私计算产品部孙晓军1.JupyterNotebook介绍图1Jupter项目整体架构[​​https://docs.jupyter.org/en/latest/projects/architecture/content-architecture......
  • Jupyter Notebook入门指南
    作者:京东科技隐私计算产品部孙晓军1.JupyterNotebook介绍图1Jupter项目整体架构[https://docs.jupyter.org/en/latest/projects/architecture/content-architect......