mirror of
https://github.com/chenasraf/text-transform.nvim.git
synced 2026-05-18 01:48:57 +00:00
docs: update README.md
This commit is contained in:
73
README.md
73
README.md
@@ -3,7 +3,7 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
> A catch phrase that describes your plugin.
|
||||
Common text transformers for nvim - switch between camelCase, PascalCase, snake_case, and more!
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
@@ -14,7 +14,17 @@
|
||||
|
||||
## ⚡️ Features
|
||||
|
||||
> Transform the current word or selection between multiple case types. Need to easily replace myVar with my_var or vice versa? This plugin is for you!
|
||||
> Transform the current word or selection between multiple case types. Need to easily replace myVar
|
||||
> with my_var or vice versa? This plugin is for you!
|
||||
|
||||
| Transformation | Example Inputs | Output |
|
||||
| -------------- | --------------------------- | -------- |
|
||||
| `camelCase` | `my_var`, `my-var`, `MyVar` | `myVar` |
|
||||
| `PascalCase` | `my_var`, `my-var`, `myVar` | `MyVar` |
|
||||
| `snake_case` | `myVar`, `my-var`, `MyVar` | `my_var` |
|
||||
| `kebab-case` | `my_var`, `myVar`, `MyVar` | `my-var` |
|
||||
| `dot.case` | `my_var`, `my-var`, `MyVar` | `my.var` |
|
||||
| `Title Case` | `my_var`, `my-var`, `MyVar` | `My Var` |
|
||||
|
||||
## 📋 Installation
|
||||
|
||||
@@ -84,12 +94,25 @@ require("lazy").setup({ "chenasraf/text-transform.nvim" })
|
||||
|
||||
## ☄ Getting started
|
||||
|
||||
> Describe how to use the plugin the simplest way
|
||||
To get started, [install](#-installation) the plugin via your favorite package manager.
|
||||
|
||||
1. Use the following code to setup in any loaded `.lua` file
|
||||
|
||||
```lua
|
||||
require('text-transform').setup({
|
||||
-- custom settings
|
||||
})
|
||||
```
|
||||
|
||||
1. Either make a selection using Visual mode, or just have your cursor stand on a desired word.
|
||||
|
||||
Then, use the mapped key (default: <kbd><Leader>~</kbd>) to open the transform options in a
|
||||
popup.
|
||||
|
||||
1. Select the desired transform and you're done!
|
||||
|
||||
## ⚙ Configuration
|
||||
|
||||
> The configuration list sometimes become cumbersome, making it folded by default reduce the noise of the README file.
|
||||
|
||||
<details>
|
||||
<summary>Click to unfold the full list of options with their default values</summary>
|
||||
|
||||
@@ -97,7 +120,15 @@ require("lazy").setup({ "chenasraf/text-transform.nvim" })
|
||||
|
||||
```lua
|
||||
require("text-transform").setup({
|
||||
-- you can copy the full list from lua/text-transform/config.lua
|
||||
-- Prints useful logs about what event are triggered, and reasons actions are executed.
|
||||
debug = false,
|
||||
-- Keymap to trigger the transform.
|
||||
keymap = {
|
||||
-- Normal mode keymap.
|
||||
["n"] = "<Leader>~",
|
||||
-- Visual mode keymap.
|
||||
["v"] = "<Leader>~",
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
@@ -105,18 +136,30 @@ require("text-transform").setup({
|
||||
|
||||
## 🧰 Commands
|
||||
|
||||
| Command | Description |
|
||||
|-------------|----------------------------|
|
||||
| `:Toggle` | Enables the plugin. |
|
||||
Use the following as example, you can mix & match the different replacement functions with the
|
||||
desired transform function.
|
||||
|
||||
Normally you wouldn't need to call this, as you would just use the keymap you used in `setup()`.
|
||||
|
||||
| Command | Description |
|
||||
| ---------------------------------------------------------------- | -------------------------------------------------- |
|
||||
| `:lua TextTransform.replace_word(TextTransform.camel_case)` | Replaces selected word with camelCase version. |
|
||||
| `:lua TextTransform.replace_selection(TextTransform.snake_case)` | Replaces visual selection with snake_case version. |
|
||||
|
||||
## ⌨ Contributing
|
||||
|
||||
PRs and issues are always welcome. Make sure to provide as much context as possible when opening one.
|
||||
I am developing this package on my free time, so any support, whether code, issues, or just stars is
|
||||
very helpful to sustaining its life. If you are feeling incredibly generous and would like to donate
|
||||
just a small amount to help sustain this project, I would be very very thankful!
|
||||
|
||||
## 🗞 Wiki
|
||||
<a href='https://ko-fi.com/casraf' target='_blank'>
|
||||
<img height='36' style='border:0px;height:36px;'
|
||||
src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3'
|
||||
alt='Buy Me a Coffee at ko-fi.com' />
|
||||
</a>
|
||||
|
||||
You can find guides and showcase of the plugin on [the Wiki](https://github.com/chenasraf/text-transform.nvim/wiki)
|
||||
I welcome any issues or pull requests on GitHub. If you find a bug, or would like a new feature,
|
||||
don't hesitate to open an appropriate issue and I will do my best to reply promptly.
|
||||
|
||||
## 🎭 Motivations
|
||||
|
||||
> If alternatives of your plugin exist, you can provide some pros/cons of using yours over the others.
|
||||
If you are a developer and want to contribute code, feel free to fork this repository and make some
|
||||
changes to create a PR, I will do my best to merge your code if it is appropriate.
|
||||
|
||||
Reference in New Issue
Block a user