Skip to content

Commit 8cc334a

Browse files
committed
chore: better readme
1 parent dfe3325 commit 8cc334a

2 files changed

Lines changed: 36 additions & 5 deletions

File tree

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,32 @@
11
# stylua.nvim
2-
Stylua for neovim
2+
3+
stylua.nvim is a simple plugin that format you Lua code using StyLua
4+
5+
## Requirements
6+
7+
- [StyLua](https://github.com/JohnnyMorganz/StyLua)
8+
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim)
9+
10+
## Installation
11+
12+
**Packer**
13+
14+
```lua
15+
use({ "wesleimp/stylua.nvim" })
16+
```
17+
18+
**Plug**
19+
20+
```vim
21+
Plug 'wesleimp/stylua.nvim'
22+
```
23+
24+
## Usage
25+
26+
```vim
27+
:lua require("stylua").format()
28+
```
29+
30+
## LICENSE
31+
32+
[MIT](./LICENSE)

lua/stylua/init.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
local Job = require("plenary.job")
22
local Path = require("plenary.path")
3-
4-
local lspconfig_util = require("lspconfig.util")
3+
local util = require("lspconfig.util")
54

65
local M = {}
7-
M._config = {}
86

9-
local root_finder = lspconfig_util.root_pattern(".git")
7+
M._config = {}
108

9+
local root_finder = util.root_pattern(".git")
1110
local function find_stylua(path)
1211
if M._config[path] == nil then
1312
local file_path = Path:new(path)
@@ -45,6 +44,8 @@ function M.format(bufnr)
4544
local stylua_toml = find_stylua(filepath)
4645

4746
local args = {}
47+
48+
-- If stylua.toml was not found, run with cli defaults
4849
if stylua_toml then
4950
args = { "--config-path", stylua_toml }
5051
end

0 commit comments

Comments
 (0)