diff options
author | rxi <rxi@users.noreply.github.com> | 2020-03-27 17:18:25 +0000 |
---|---|---|
committer | rxi <rxi@users.noreply.github.com> | 2020-03-27 17:18:25 +0000 |
commit | cc1aacfa755001965670420cacbd03d69884aae6 (patch) | |
tree | 6c927a3d81766b7057b0e2813e49cba1e448f874 | |
parent | 60fd0cee2118ce10cbfbeb8352b99c0bd74e3d74 (diff) | |
download | lite-xl-plugins-cc1aacfa755001965670420cacbd03d69884aae6.tar.gz lite-xl-plugins-cc1aacfa755001965670420cacbd03d69884aae6.zip |
Added titleize plugin
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | titleize.lua | 11 |
2 files changed, 13 insertions, 1 deletions
@@ -1,6 +1,6 @@ Plugins for the [lite text editor](https://github.com/rxi/lite) -*Note: if you make a pull request, the table should be kept in alphabetical order* +*Note: if you make a pull request, the table should be updated and kept in alphabetical order* --- @@ -11,5 +11,6 @@ Plugin | Description [`language_odin`](language_odin.lua?raw=1) | Syntax for the [Odin](https://github.com/odin-lang/Odin) programming language [`language_wren`](language_wren.lua?raw=1) | Syntax for the [Wren](http://wren.io/) programming language [`macmodkeys`](macmodkeys.lua?raw=1) | Remaps mac modkeys `command/option` to `ctrl/alt` +[`titleize`](titleize.lua?raw=1) | Titleizes selected string (`hello world` => `Hello World`) [`togglesnakecamel`](togglesnakecamel.lua?raw=1) | Toggles symbols between snake\_case and camelCase diff --git a/titleize.lua b/titleize.lua new file mode 100644 index 0000000..2e4b52a --- /dev/null +++ b/titleize.lua @@ -0,0 +1,11 @@ +local core = require "core" +local command = require "core.command" + +command.add("core.docview", { + ["titleize:titleize"] = function() + core.active_view.doc:replace(function(text) + return text:gsub("%f[%w](%w)", string.upper) + end) + end, +}) + |