# Native Auto Wrapper Configuration ## ๐ŸŽฏ **Overview** Your Neovim is now configured with native auto wrapper functionality using built-in Neovim features - no additional packages required! ## โœจ **Features** ### **Automatic Text Wrapping** - **Text files**: Auto-wrap at 80 characters - **Code files**: Auto-wrap comments at 100 characters - **Documentation**: Auto-wrap at 78 characters - **Configuration files**: Auto-wrap comments at 80 characters ### **Smart Formatting** - **Break at word boundaries**: Lines break at natural word boundaries - **Preserve indentation**: Wrapped lines maintain proper indentation - **Visual indicators**: Shows break indicators (โ†ช) for wrapped lines - **Color column**: Visual guide at specified text width ## ๐ŸŽฎ **Keymaps** ### **Text Wrapping Controls** | Keymap | Description | |--------|-------------| | `tw` | Toggle line wrapping | | `tl` | Toggle line break | | `tc` | Show 80 character column guide | | `tC` | Hide column guide | ### **Text Formatting** | Keymap | Description | |--------|-------------| | `tf` | Format current paragraph | | `tF` | Format entire file | | `tf` (visual) | Format selected text | ### **Text Width Settings** | Keymap | Description | |--------|-------------| | `t80` | Set text width to 80 characters | | `t100` | Set text width to 100 characters | | `t120` | Set text width to 120 characters | | `t0` | Disable text width (no wrapping) | ### **Auto-wrap Controls** | Keymap | Description | |--------|-------------| | `ta` | Enable auto-wrap text | | `tA` | Disable auto-wrap text | | `tc` | Enable auto-wrap comments | | `tC` | Disable auto-wrap comments | ### **Indentation and Display** | Keymap | Description | |--------|-------------| | `ti` | Toggle break indent | | `ts` | Show break indicator (โ†ช) | | `tS` | Hide break indicator | ## ๐Ÿ“ **File Type Specific Settings** ### **Text and Documentation Files** - **File types**: `text`, `markdown`, `gitcommit`, `mail` - **Text width**: 80 characters - **Auto-wrap**: Enabled for all text - **Line break**: At word boundaries ### **Code Files** - **File types**: `lua`, `javascript`, `typescript`, `python`, `java`, `cpp`, `c`, `rust`, `go` - **Text width**: 100 characters - **Auto-wrap**: Comments only - **Format options**: Smart comment wrapping ### **Documentation Files** - **File types**: `help`, `man` - **Text width**: 78 characters - **Auto-wrap**: Enabled for all text - **Line break**: At word boundaries ### **Configuration Files** - **File types**: `conf`, `config`, `ini`, `toml`, `yaml`, `json` - **Text width**: 80 characters - **Auto-wrap**: Comments only ## ๐Ÿ”ง **Native Neovim Settings** ### **Core Settings** ```lua -- Text wrapping opt.wrap = true -- Enable line wrapping opt.linebreak = true -- Break at word boundaries opt.breakindent = true -- Preserve indentation opt.showbreak = "โ†ช " -- Break indicator opt.breakindentopt = "shift:2" -- Indent wrapped lines -- Text width opt.textwidth = 80 -- Default text width opt.colorcolumn = "80" -- Visual column guide ``` ### **Format Options** ```lua opt.formatoptions = "jcroqlnt" -- Format options -- j: Remove comment leader when joining lines -- c: Auto-wrap comments using textwidth -- r: Auto-wrap comments when pressing Enter -- o: Auto-wrap comments when pressing 'o' or 'O' -- q: Allow formatting of comments with 'gq' -- l: Long lines are not broken in insert mode -- n: Recognize numbered lists -- t: Auto-wrap text using textwidth ``` ## ๐Ÿ“ **Usage Examples** ### **1. Writing Documentation** ```markdown # This is a long title that will automatically wrap at 80 characters when you type it This is a long paragraph that will automatically wrap at word boundaries when it reaches 80 characters, making your documentation more readable and properly formatted. ``` ### **2. Writing Code Comments** ```lua -- This is a very long comment that will automatically wrap at 100 characters when you press Enter or 'o', making your code more readable and maintaining proper indentation local function example() -- This comment will also wrap automatically return "example" end ``` ### **3. Writing Git Commit Messages** ```bash # This commit message will automatically wrap at 80 characters git commit -m "This is a very long commit message that describes the changes made to the codebase in detail" ``` ## ๐ŸŽจ **Visual Features** ### **Break Indicators** - **Symbol**: `โ†ช` shows where lines are wrapped - **Toggle**: Use `ts` to show/hide ### **Color Column** - **Guide**: Visual line at text width - **Toggle**: Use `tc` to show/hide ### **Indentation** - **Preserved**: Wrapped lines maintain indentation - **Smart**: Proper indentation for code blocks ## ๐Ÿ” **Troubleshooting** ### **Text Not Wrapping** 1. Check if wrapping is enabled: `:set wrap?` 2. Verify text width: `:set textwidth?` 3. Check format options: `:set formatoptions?` ### **Comments Not Wrapping** 1. Ensure format option 'c' is set: `:set formatoptions+=c` 2. Check file type: `:set filetype?` 3. Verify text width is set: `:set textwidth?` ### **Indentation Issues** 1. Enable break indent: `:set breakindent` 2. Check break indent options: `:set breakindentopt?` 3. Verify smart indent: `:set smartindent?` ## ๐Ÿš€ **Advanced Configuration** ### **Custom File Type Settings** Add to your configuration: ```lua vim.api.nvim_create_autocmd("FileType", { pattern = { "your_filetype" }, callback = function() vim.opt_local.textwidth = 120 vim.opt_local.formatoptions:append("c") end, }) ``` ### **Custom Break Indicator** ```lua vim.opt.showbreak = "โคท " -- Custom break indicator ``` ### **Custom Color Column** ```lua vim.opt.colorcolumn = "80,100,120" -- Multiple column guides ``` ## โœ… **Benefits of Native Configuration** - **No additional packages**: Uses built-in Neovim features - **Fast and lightweight**: No external dependencies - **Consistent behavior**: Works the same across all Neovim installations - **Easy to customize**: Simple Lua configuration - **Reliable**: No plugin conflicts or compatibility issues Your native auto wrapper is now fully configured and ready to use! ๐ŸŽ‰