{"id":20335565,"url":"https://github.com/mwumli/layer-vim","last_synced_at":"2025-03-04T13:30:06.014Z","repository":{"id":79624497,"uuid":"81233749","full_name":"MwumLi/layer-vim","owner":"MwumLi","description":"An elegant solution to organize vim plugins and resources","archived":false,"fork":false,"pushed_at":"2017-12-03T09:15:51.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-14T16:44:40.240Z","etag":null,"topics":["layer","layer-vim","spacemacs","vim","vim-configuration","vim-plug"],"latest_commit_sha":null,"homepage":null,"language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MwumLi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-07T17:16:25.000Z","updated_at":"2021-09-21T05:17:23.000Z","dependencies_parsed_at":"2023-05-13T22:45:45.317Z","dependency_job_id":null,"html_url":"https://github.com/MwumLi/layer-vim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MwumLi%2Flayer-vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MwumLi%2Flayer-vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MwumLi%2Flayer-vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MwumLi%2Flayer-vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MwumLi","download_url":"https://codeload.github.com/MwumLi/layer-vim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241855058,"owners_count":20031549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["layer","layer-vim","spacemacs","vim","vim-configuration","vim-plug"],"created_at":"2024-11-14T20:42:11.230Z","updated_at":"2025-03-04T13:30:05.981Z","avatar_url":"https://github.com/MwumLi.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# layer-vim\nAn elegant solution to organize vim plugins and resources  \n\n\t _                                 _\n\t| | __ _ _   _  ___ _ __    __   _(_)_ __ ___\n\t| |/ _` | | | |/ _ \\ '__|___\\ \\ / / | '_ ` _ \\\n\t| | (_| | |_| |  __/ | |_____\\ V /| | | | | | |\n\t|_|\\__,_|\\__, |\\___|_|        \\_/ |_|_| |_| |_|\n\t\t\t |___/\n\n## 快速安装\n\n    sh -c \"$(curl -fsSL https://raw.githubusercontent.com/MwumLi/layer-vim/master/install.sh)\"\n    # 或\n    sh -c \"$(wget -qO- https://raw.githubusercontent.com/MwumLi/layer-vim/master/install.sh)\"\n\n## 手动安装和更新\n\n1. 克隆到本地: `git clone git@github.com:MwumLi/layer-vim.git ~/.layer-vim`  \n2. 建立软链接: `ln -sf ~/.layer-vim/init.vim ~/.vimrc`\n3. 建立用户定制文件: `cp ~/.layer-vim/template/layervim.vim ~/.layervim`  \n4. 建立项目 vim 配置文件(如果你的项目需要定制的不同的格式和配置):  \n\n        cp ~/.layer-vim/template/project-layervim.vim yourProjectRoot/.layervim\n\n## 引入外部 layer 仓库\n\n加载外部 layer 仓库，配置环境变量 `LAYERVIM_LAYERS_PATH`:  \n\n\texport LAYERVIM_LAYERS_PATH=$HOME/.vim/layers\n\n自动安装外部 layer 仓库, 配置环境变量 `LAYERVIM_LAYERS_REPO_URI`, 比如:  \n\n\texport LAYERVIM_LAYERS_REPO_URI='https://github.com/MwumLi/ifmicro-layers.git'\n\n## 介绍\n\nlayer-vim 是一套优雅的的 vim 配置方案, 整个架构基于 Layer 的概念  \n所谓优雅, 可以理解为简约而美观, 并且易于扩展  \n\n是一套优雅的组织 vim 插件和资源的解决方案  \n如果你时常感觉 vim 配置杂乱无章, 那么你值得拥有 layer-vim  \n\n因为我本意是打造一个以 Layer 为基础的 vim 配置架子, 让大家可以良好的组织自己的 vim 配置,并不想提供任何 vim 配置  \n\n但是为了做个示例, 我特意增加了一个 Topic : `+layervim`, 用来展示一个 Topic 以及 Layer 的编写  \n这份配置也会构造一个简单,有效的 vim 的配置  \n\n## 用户配置文件\n\n用户配置文件就是 `~/.layervim`,一般情况下安装完毕会自己产生, 或者你可以 copy `~/.layer-vim/template/layervim.vim`:  \n\n    UserLayers() 函数用来启用已有 layer, 禁用部分插件\n    UserInit() 函数是插件快捷键前缀的定义, `\u003cLeader\u003e` 和 `\u003cLocalLeader\u003e` 的定义\n    UserConfig() 函数是vim 的选项配置\n\n## 项目配置文件\n\n1. 在 `~/.layervim` 的 `g:layervim_project_root` 添加你的项目根目录的路径  \n2. 项目配置文件就是项目根目录下的 `.layervim`,可以从 `~/.layer-vim/template/project-layervim.vim`复制  \n\n        ProjectLayers() 函数用来启用已有 layer, 禁用部分插件\n        ProjectConfig() 函数用来设置该项目下打开 vim 的选项配置\n\n## Layer 和 Topic\n\nlayer-vim 的基础是 Layer, layer 这个概念并没有什么高深的东西, 不过是为了让你的 vim 插件及配置井然有序, 便于管理和修改而已  \n\n每一个 layer 可以是一种功能处理的集合, 在 layer-vim 中体现为 `~/.layer-vim/layers/` 下的一个非以 `+` 开头的文件夹或者 topic 文件夹下的子文件夹(topic 就是 `~/.layer-vim /layers/` 下的一个以 `+` 开头的文件夹)  \n一个 layer 文件夹下包含三个文件:  \n\n| Layer Component | Description |\n| --------------- | ----------- |\n| README.md | 当前 layer 的介绍 |\n| packages.vim |  支持该 layer 所需的一些插件 |\n| config.vim | 当前 layer 的配置信息(包括插件的配置选项)|\n\n在 layer 的基础, 又提出 topic 的概念,即主题, 也是类似, 是更进一步的分类, 比如 `+lang/` 可以包含\n各种编程语言的处理 layer  \ntopic 是 `~/.layer-vim/layers/` 下的以 `+` 开头的文件夹, 包含多个 layer  \n\n### 启用已有 layer\n\n在 layer-vim 的用户配置文件 `~/.layervim` 的 `UserLayers()` 里启用 Layer  \n比如有 `~/.layer-vim/layers/better-defaults`, 则在 `UserLayers()` 下添加:  \n\n    Layer 'better-defaults'\n\n比如有 `~/.layer-vim/layers/+layer-vim/basic`, 这是主题下有个层, 则在 `UserLayers()` 下添加:  \n\n    Layer '+layer-vim/basic'\n\n\n\u003e 不存在的 layer 会被忽略, 所以不用担心添加了不存在的 layer\n\n### 禁用部分插件\n\n和启用 layer 一样, 在 `UserLayers()` 下添加:  \n\n    Exclude 'vim-airline/vim-airline'\n\n那么就会禁用插件 `vim-airline/vim-airline`  \n\n### 插件安装,卸载,升级\n\nlayer-vim 底层是对  vim-plug 命令的封装, 因此 vim-plug 的命令都可以使用, 具体见: [vim-plug][vim-plug]  \n\n还有封装的一些命令:  \n\n    # 查看已经启用的 Layer\n    :LayerStatus\n\n    # 安装已经增强的插件, 和 PlugInstall 一样\n    :LayerInstall\n\n    # 清理禁用的插件\n    :LayerClean\n\n## Todo\n\n- [x] support layer: add Layer in `~/.layer-vim`  \n- [x] support topic: add topic in `~/.layer-vim/layers`  \n- [x] support project configuration: `cp ~/.layer-vim/template/project-layervim.vim projectRoot/.layervim`  \n- [X] add basic layer  \n- [X] support add the whole topic: `Topic \"+layervim\"`  \n- [X] support external layer: You can maintain your own layer repository  \n\n\n## 致谢\n\n下面这些项目都使我受益, 对此表示感谢  \n\n* [liuchengxu/space-vim][liuchengxu/space-vim]  \n  我从此项目了解 Layer , 感觉非常惊喜, space-vim 提供一套 Layer 的方案以及众多 [Layers][space-vim-layer], layer-vim 就是从此项目提取并进行改进, 因此 layer 结构和 layer-vim 一样, 你可以从这里获取你想要的层或者给你构造自己的 layer 提供灵感  \n\n* [vim-plug][vim-plug]  \n  Layer 的核心实现是基于 vim-plug 之上的  \n\n* [spf13-vim](https://github.com/spf13/spf13-vim)  \n   一个星级很高的 vim 配置,之前我也是根据此配置构建自己的 vim 配置, 直到知道了 layer  \n\n* [spacemacs]: https://github.com/syl20bnr/spacemacs  \n  Emacs 基于 Layer 的配置方案, 并包括众多优秀的 Emacs 配置  \n\n* [使用脚本编写 Vim 编辑器，第 1 部分: 变量、值和表达式]: http://www.ibm.com/developerworks/cn/linux/l-vim-script-1/  \n\n[liuchengxu/space-vim]:  https://github.com/liuchengxu/space-vim\n[space-vim-layer]: https://github.com/liuchengxu/space-vim/tree/master/layers\n[spacemacs]: https://github.com/syl20bnr/spacemacs\n[vim-plug]:https://github.com/junegunn/vim-plug\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmwumli%2Flayer-vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmwumli%2Flayer-vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmwumli%2Flayer-vim/lists"}