{"id":16586969,"url":"https://github.com/tjdevries/conf.vim","last_synced_at":"2026-02-25T22:31:19.481Z","repository":{"id":96938733,"uuid":"99624939","full_name":"tjdevries/conf.vim","owner":"tjdevries","description":"A meta plugin for configuring your own plugins","archived":false,"fork":false,"pushed_at":"2017-10-09T11:41:15.000Z","size":36,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-06T08:16:39.069Z","etag":null,"topics":[],"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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tjdevries.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-08-07T22:11:22.000Z","updated_at":"2025-01-14T12:25:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"78de1371-9fa8-443b-a56a-1ff8e2c660a0","html_url":"https://github.com/tjdevries/conf.vim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tjdevries/conf.vim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjdevries%2Fconf.vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjdevries%2Fconf.vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjdevries%2Fconf.vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjdevries%2Fconf.vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tjdevries","download_url":"https://codeload.github.com/tjdevries/conf.vim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tjdevries%2Fconf.vim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29843393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T21:18:31.832Z","status":"ssl_error","status_checked_at":"2026-02-25T21:18:29.265Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-11T22:52:59.987Z","updated_at":"2026-02-25T22:31:19.466Z","avatar_url":"https://github.com/tjdevries.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Conf.vim\n\n_A plugin for making good configuration for your plugins_\n\nAre you sick of doing something like this:\n\n```\n:let g:really_long_plugin_option_name_\u003ctab\u003e\n```\n\nand then this shows up:\n\n```\n-------------------------------------------------------------------------------\ng:really_long_plugin_option_name_this_another_thign\ng:really_long_plugin_option_name_wow\ng:really_long_plugin_option_name_asdf\ng:really_long_plugin_option_name_lol\ng:really_long_plugin_option_name_foobar\ng:really_long_plugin_option_name_that\ng:really_long_plugin_option_name_another\ng:really_long_plugin_option_name_tijasdfk\n\n:let g:really_long_plugin_option_name_\n-------------------------------------------------------------------------------\n```\n\nOr even worse, you go to configure a plugin in your vimrc and you spend an hour debuggin... but you just spelled the option wrong :cry:\n\nThis plugin is here to fix all these problems and _so much more_.\n\n## Install\n\n```vim\n\ncall plug#begin()\n\n\" Required\nPlug 'tjdevries/standard.vim'\n\" Optional: Used to make nice menus\nPlug 'skywind3000/quickmenu.vim'\n\n\" Required: The plugin you're using so... you probably want it :)\nPlug 'tjdevries/conf.vim'\n\ncall plug#end()\n\n```\n\n## Asciinema example\n\nHere's a quick overview of what the plugin can do:\n\n[![asciinema](https://asciinema.org/a/xbQmRxj0kXtrVn6zM18IKb0Kz.png)](https://asciinema.org/a/xbQmRxj0kXtrVn6zM18IKb0Kz?autoplay=1)\n\n- In ./plugin/example_plugin.vim\n  - Show old way of configuration\n  - Move to ./autoload/example_plugin/conf.vim\n- Show adding a generation of the file\n  - Paste in the configuration I've already made\n- Show adding areas and settings\n- Move to ./user/init.vim\n  - Show the errors from bad configuration\n  - Show setting good values\n  - Show a menu\n    - Show a failure entry\n    - Show a good entry\n  - Show the docs\n    - (make sure to do `:set ft=help`)\n\n## Overview\n\nThis plugin is designed to be used by plugin developers to ensure \"strong configuration\" for your plugins. You should wrap the basic functions in this plugin in your own autoload functions for your plugin. I recommend using the script-local dictionary (`s:`) as your configuration dictionary because it fully encapsulates your plugin's configuration.\n\nThe process is as follows:\n\n```vim\ncall conf#set_name(s:, 'my_example_plugin')\n```\n\nNow whenever there is a configuration problem, it will use the name `my_example_plugin`.\n\nThen you will add a configuration \"area\" to your plugin. Consider this as a grouping of several settings together.\n\n```vim\ncall conf#add_area(s:, 'mappings')\ncall conf#add_area(s:, 'defaults')\n```\n\nAfter adding areas, you can add settings to each area.\n\n```vim\ncall conf#add_setting(s:, 'mappings', 'my_plug_action', {\n  \\ 'type': v:t_string,\n  \\ 'default': '\u003cleader\u003el',\n  \\ })\n\ncall conf#add_setting(s:, 'defaults', 'window_height', {\n  \\ 'type': v:t_number,\n  \\ 'default': 40,\n  \\ 'validator': { val -\u003e val \u003c 200 },\n  \\ })\n```\n\nAfter setting up the wrapper functions for your plugin (let's assume \"example\" is the plugin name), your users will use your configuration functions to set values. For example:\n\n```vim\n\" This will work, and set the value to '\u003cleader\u003e\u003cleader\u003el'\ncall example#configuration#set('mappings', 'my_plug_action', '\u003cleader\u003e\u003cleader\u003el')\n\necho example#configuration#get('mappings', 'my_plug_action')\n\" ==\u003e \u003cleader\u003e\u003cleader\u003el\n\n\n\" Works just fine! :)\ncall example#configuration#set('defaults', 'window_height', 50)\n\necho example#configuration#get('defaults', 'window_height')\n\" ==\u003e 50\n\n\" This will not work, because if fails the \"validator\" key\n\" You can find more information in the \"## validation\" sectoin\ncall example#configuration#set('defaults', 'window_height', 250)\n\" ==\u003e throws an error [CONF][my_example_plugin] ...\n\n```\n\n## Configuration and Setup\n\nHere's an example of a set up from another plugin of mine. It shows more of the wrapper functions:\n\n```vim\n\" in plugin \"putty.vim\"\n\" file: plugin/putty.vim\n\n\"\"\n\" Name of the plugin to be used in error messages\ncall conf#set_name(s:, 'Putty')\n\n\"\"\n\" Configuration options for PUTTY\ncall conf#add_area(s:, 'defaults')\ncall conf#add_setting(s:, 'defaults', 'plink_location', {\n        \\ 'type': v:t_string,\n        \\ 'default': 'C:\\Program Files (x86)\\PuTTY\\plink.exe',\n        \\ 'description': 'Full path with executable name and extension',\n        \\ 'validator': {val -\u003e executable(val) },\n        \\ })\ncall conf#add_setting(s:, 'defaults', 'window_options', {\n        \\ 'type': v:t_dict,\n        \\ 'default': {'filetype': 'lookitt', 'concealcursor': 'n'},\n        \\ 'description': 'The window options associated with the putty window',\n        \\ })\ncall conf#add_setting(s:, 'defaults', 'wait_time', {\n        \\ 'type': v:t_string,\n        \\ 'default': '10m',\n        \\ 'description': 'Wait time after sending a message through putty',\n        \\ })\n\n\" in plugin: \"putty.vim\"\n\" file: autoload/putty/configuration.vim\nfunction! putty#configuration#get(area, setting) abort\n  call conf#get_setting(s:, a:area, a:setting)\nendfunction\n\nfunction! putty#configuration#set(area, setting, value) abort\n  call conf#set_setting(s:, a:area, a:setting, a:value)\nendfunction\n\nfunction! putty#configuration#view() abort\n  return conf#view(s:)\nendfunction\n\nfunction! putty#configuration#menu() abort\n  return conf#menu(s:, expand('\u003csfile\u003e'))\nendfunction\n```\n\nThe user can interact with these settings by calling this:\n\n```vim\ncall putty#configuration#set('defaults', 'wait_time', '100m')\n```\n\nWhich will update the value (you would get the value in your plugin by doing `putty#configuration#get('defaults', 'wait_time')`). However, if the user had a typo and did something like this:\n\n```vim\n\" Note that it is \"default\", not \"defaults\" as originally specified\ncall putty#configuration#set('default', 'wait_time', '100m')\n```\n\nThey would get the error like:\n\n```\nautoload\\conf.vim|180| conf#set_setting[2]\n|| E605: Exception not caught: [CONF][Putty] Setting area named: 'default' does not exist\n```\n\nNow they can't mess up your configuration!\n\n## Validation\n\nYou can even add validation to your settings, to reduce the amount of bad configuration possible. For example:\n\n```vim\n\" ===== Set up configuration options =====\n\" Set the name of this plugin\ncall conf#set_name(s:, 'Example Plugin')\n\n\" Add an area fo default configuration\ncall conf#add_area(s:, 'minimum')\n\n\" ===== Add some settings =====\n\n\" Add a setting for minimum value, it should be greater than 25\ncall conf#add_setting(s:, 'minimum', 'min_25', {\n            \\ 'type': v:t_number,\n            \\ 'default': 35,\n            \\ 'validator': { val -\u003e val \u003e 25 },\n            \\ })\n\n\" ... define autoload functions here for example#configuration ...\n\n\" Now if the user tried to something like this:\ncall example#configuaration#set('minimum', 'min_25', 20)\n\n\" They would get an error like:\n\" [CONF][Example Plugin][set.VALIDATOR] Setting 'minimum.min_25' failed\n```\n\nThis `validator` can be any function that takes one input (a value) and returns a boolean.\n\n## Menus\n\nIt also makes menus for you! Thanks to `skywind3000/quickmenu.vim`. Here's an example:\n\n![image](https://user-images.githubusercontent.com/4466899/29073343-ec903fe6-7c10-11e7-83b1-627c233faa09.png)\n\nYou can add custom prompts, configuration and validation for each item. And when you change it in one place, all your menus will update! :smile:\n\n## Documentation\n\nOh, and by the way... it can generate documentation. This is the output for my putty plugin. Just run `conf#docs#generate(s:)`.\n\n```\n================================================================================\nConfiguration Options:                                           *Putty-options*\n\ndefaults........................................................*Putty.defaults*\n\n\ndefaults.wait_time                                    *Putty.defaults.wait_time*\n\n  Type: |String|\n  Default: `10m`\n\n  Wait time after sending a message through putty\n\n  To configure:\n    `call putty#configuration#set(\"defaults\", \"wait_time\", \u003cvalue\u003e)`\n\n  To view:\n    `echo putty#configuration#get(\"defaults\", \"wait_time\")`\n\n\ndefaults.plink_location                          *Putty.defaults.plink_location*\n\n  Type: |String|\n  Default: `C:\\Program Files (x86)\\PuTTY\\plink.exe`\n\n  Full path with executable name and extension\n\n  Validator:\n\u003e\n       function \u003clambda\u003e14(val, ...)\n    1  return executable(val)-\n       endfunction\n\u003c\n\n  To configure:\n    `call putty#configuration#set(\"defaults\", \"plink_location\", \u003cvalue\u003e)`\n\n  To view:\n    `echo putty#configuration#get(\"defaults\", \"plink_location\")`\n\n\ndefaults.window_options                          *Putty.defaults.window_options*\n\n  Type: |Dict|\n  Default: `{'concealcursor': 'n', 'filetype': 'lookitt'}`\n\n  The window options associated with the putty window\n\n  To configure:\n    `call putty#configuration#set(\"defaults\", \"window_options\", \u003cvalue\u003e)`\n\n  To view:\n    `echo putty#configuration#get(\"defaults\", \"window_options\")`\n\n```\n\n\n### TODO:\n\n- More compelling README? :smile:\n- Generate wrapper functions automatically\n- More options for inputting items\n- Better errors for type problems\n- Better errors for function problems\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftjdevries%2Fconf.vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftjdevries%2Fconf.vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftjdevries%2Fconf.vim/lists"}