diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fd347d..a2b8d23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,22 @@ # Changelog -## Unreleased +## 2024-03-03 - v1.1.0 - Add `opts` table to telescope extension to be able to customize the picker - Minor changes related to typing and linting - Add `.luacheckrc`, `.neoconf.json` and `.stylua.toml` +- Add more builin commands: + - PowerShell escape characters to Unix + - Change single quotes to double quotes + - Change double quotes to single quotes + - snake_case to CamelCase (python) + - CamelCase to snake_case (python) + - snake_case to kebab-case (python) + - kebab-case to snake_case (python) + - To UPPER case (python) + - To lower case (python) + - Base32 Encode (python) + - Base32 Decode (python) ## 2024-01-17 - v1.0.1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d8b49e2..c334a5b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,6 @@ Here is a list of ideas for builtin commands: - Count characters (view only) - Count words (view only) - Shuffle lines -- Change cURL format from Windows to Unix - JSON to Query String - JSON to YAML - Lorem ipsum @@ -23,13 +22,6 @@ Here is a list of ideas for builtin commands: - RGB to HEX - JSON to CSV - CSV to JSON -- Lower Case -- Camel Case -- Snake Case -- Upper Case -- Kebab Case -- Replace single quotes with double quotes -- Replace double quotes with single quotes - Wrap with single quotes - Wrap with double quotes diff --git a/README.md b/README.md index 4e6eb05..b1f73b2 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,16 @@ Here is a demo: [![asciicast](https://asciinema.org/a/wsJSeLEqNaHT8f3V6JH4NQRFr.svg)](https://asciinema.org/a/wsJSeLEqNaHT8f3V6JH4NQRFr) +Here is what this plugin can do: + +- Encode and decode base64, base32, url params, html +- Format and minify json +- Hashing (md5, sha1, sha256, sha512) +- Common strings manipulation (rever, remove whitespace, case change) +- Large files manipulation (join lines, wrap each line with single and double quotes, remove duplicate lines) +- Encryption (ansible vaule) +- and more (see [`builtin.lua`](./lua/whop/builtin.lua)) + ## Installation - install `biozz/whop.nvim` with your favourite package manager diff --git a/doc/whop.txt b/doc/whop.txt index f2a05c7..ac7b002 100644 --- a/doc/whop.txt +++ b/doc/whop.txt @@ -1,8 +1,8 @@ ================================================================================ WHOP *whop* -This is a NeoVim tribute to the amazing Mac app - Boop -(https://boop.okat.best/). +This is a NeoVim tribute to the amazing Mac app - +[Boop](https://boop.okat.best/). This plugin uses [Telescope](https://github.com/nvim-telescope/telescope.nvim) or `vim.ui.select()` to pick commands. Then it uses entire buffer content as an diff --git a/lua/whop/builtin.lua b/lua/whop/builtin.lua index de6adf6..1cd004a 100644 --- a/lua/whop/builtin.lua +++ b/lua/whop/builtin.lua @@ -15,6 +15,14 @@ M.commands = { name = "[builtin] Base64 Decode (base64)", cmd = [[%!base64 -d]], }, + { + name = "[builtin] Base32 Encode (python)", + cmd = [[%!python -c 'import sys; import base64; print(base64.b32encode(sys.stdin.read()[:-1].encode()).decode())']], + }, + { + name = "[builtin] Base32 Decode (python)", + cmd = [[%!python -c 'import sys; import base64; print(base64.b32decode(sys.stdin.read()[:-1]).decode())']], + }, { name = "[builtin] Format JSON (jq)", cmd = [[%!jq]], @@ -131,6 +139,45 @@ M.commands = { name = "[builtin] Ansible Vault Decrypt (ansible-vault)", cmd = [[%!ansible-vault decrypt]], }, + { + name = "[builtin] PowerShell escape characters to Unix", + cmd = function() + vim.cmd([[%s/\^$/\\/]]) + vim.cmd([[%s/\^\\\^/\\/g]]) + end, + }, + { + name = "[builtin] Change single quotes to double quotes", + cmd = [[%s/'/"/g]], + }, + { + name = "[builtin] Change double quotes to single quotes", + cmd = [[%s/"/'/g]], + }, + { + name = "[builtin] snake_case to CamelCase (python)", + cmd = [[%!python -c 'import sys; print("".join(map(lambda x: x[0].upper() + x[1:], sys.stdin.read()[:-1].split("_"))))']], + }, + { + name = "[builtin] CamelCase to snake_case (python)", + cmd = [[%!python -c 'import sys; print("".join(map(lambda y: f"_{y.lower()}" if y.isupper() else y, [ z for z in sys.stdin.read()[:-1] ]))[1:])']], + }, + { + name = "[builtin] snake_case to kebab-case (python)", + cmd = [[%!python -c 'import sys; print(sys.stdin.read()[:-1].replace("_", "-"))']], + }, + { + name = "[builtin] kebab-case to snake_case (python)", + cmd = [[%!python -c 'import sys; print(sys.stdin.read()[:-1].replace("-", "_"))']], + }, + { + name = "[builtin] To UPPER case (python)", + cmd = [[%!python -c 'import sys; print(sys.stdin.read()[:-1].upper())']], + }, + { + name = "[builtin] To lower case (python)", + cmd = [[%!python -c 'import sys; print(sys.stdin.read()[:-1].lower())']], + }, } return M