Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Snyssfx/goerr-nvim
fold go `if err != nil` and show other lines
https://github.com/Snyssfx/goerr-nvim
folding go neovim neovim-plugin
Last synced: 3 days ago
JSON representation
fold go `if err != nil` and show other lines
- Host: GitHub
- URL: https://github.com/Snyssfx/goerr-nvim
- Owner: Snyssfx
- License: mit
- Created: 2021-09-11T11:33:48.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-18T11:10:31.000Z (about 3 years ago)
- Last Synced: 2024-08-02T13:34:11.199Z (3 months ago)
- Topics: folding, go, neovim, neovim-plugin
- Language: Lua
- Homepage:
- Size: 292 KB
- Stars: 24
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# goerr-nvim
The plugin folds Go's `if err != nil` and shows other lines like in Goland, it greatly reduces code length and doesn't affect readability.The plugin converts popular words that is used in handling errors to just Greek letters.
Also it folds errors on buffer enter, and remove dots in folding.__Before:__
__After:__
## Installation
1. Install it with your favorite plugin manager
2. Make sure you set `syntax on` and `set foldmethod=syntax`, since this plugin closes folds based on syntax.
- Or you can use any other foldmethod that creates folds on error handling, e.g. treesitter's one;
- If you know the better way of creating and closing folds, make me know in an issue or PR :)
3. The plugin uses `softtabstop` setting under the cover. If the indentation level isn't right, you can adjust the setting accordingly or contribute to the plugin development :)
4. If you don't use folds much and just want this plugin to work, you can set `foldnestmax` and `foldlevel` settings to high numbers (e.g. 10 and 9 respectively).
- It enables folding, but all your folds would be open by default (except `if err != nil` ones)## Features
- Auto close `if err != nil` blocks of code, show inner lines;
- Remove distracted dots via `'fillchars'`;
- Truncate long inner lines;
- Change `return` to 1 Unicode symbol (arrows);
- Change `log` and `logger` to lambda;
- Change `can't`, `cannot`, `can not` to just `c'`;
- Change `fmt` and `errors` to phi and epsilon respectively.## TODO
- Add parameters for this stuff;
- Handle long `if`'s.