File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 )
Original file line number Diff line number Diff line change 11local Job = require (" plenary.job" )
22local Path = require (" plenary.path" )
3-
4- local lspconfig_util = require (" lspconfig.util" )
3+ local util = require (" lspconfig.util" )
54
65local 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" )
1110local 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
You can’t perform that action at this time.
0 commit comments