Skip to content

Commit

Permalink
chore: better readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleimp committed Feb 11, 2022
1 parent dfe3325 commit 8cc334a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# stylua.nvim
Stylua for neovim

stylua.nvim is a simple plugin that format you Lua code using StyLua

## Requirements

- [StyLua](https://github.com/JohnnyMorganz/StyLua)
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim)

## Installation

**Packer**

```lua
use({ "wesleimp/stylua.nvim" })
```

**Plug**

```vim
Plug 'wesleimp/stylua.nvim'
```

## Usage

```vim
:lua require("stylua").format()
```

## LICENSE

[MIT](./LICENSE)
9 changes: 5 additions & 4 deletions lua/stylua/init.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
local Job = require("plenary.job")
local Path = require("plenary.path")

local lspconfig_util = require("lspconfig.util")
local util = require("lspconfig.util")

local M = {}
M._config = {}

local root_finder = lspconfig_util.root_pattern(".git")
M._config = {}

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

local args = {}

-- If stylua.toml was not found, run with cli defaults
if stylua_toml then
args = { "--config-path", stylua_toml }
end
Expand Down

0 comments on commit 8cc334a

Please sign in to comment.