Skip to content

Commit

Permalink
Add stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
m4xshen committed Aug 12, 2023
1 parent 441749a commit c2441d4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
25 changes: 18 additions & 7 deletions lua/smartcolumn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,19 @@ end
local function exceed(buf, win, min_colorcolumn)
local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, true) -- file scope
if config.scope == "line" then
lines = vim.api.nvim_buf_get_lines(buf,
vim.fn.line(".", win)-1, vim.fn.line(".", win), true)
lines = vim.api.nvim_buf_get_lines(
buf,
vim.fn.line(".", win) - 1,
vim.fn.line(".", win),
true
)
elseif config.scope == "window" then
lines = vim.api.nvim_buf_get_lines(buf,
vim.fn.line("w0", win)-1, vim.fn.line("w$", win), true)
lines = vim.api.nvim_buf_get_lines(
buf,
vim.fn.line("w0", win) - 1,
vim.fn.line("w$", win),
true
)
end

local max_column = 0
Expand All @@ -42,7 +50,8 @@ local function update()
if type(config.custom_colorcolumn) == "function" then
colorcolumns = config.custom_colorcolumn()
else
colorcolumns = config.custom_colorcolumn[buf_filetype] or config.colorcolumn
colorcolumns = config.custom_colorcolumn[buf_filetype]
or config.colorcolumn
end

local min_colorcolumn = colorcolumns
Expand Down Expand Up @@ -83,8 +92,10 @@ function smartcolumn.setup(user_config)
config[option] = value
end

vim.api.nvim_create_autocmd({ "BufEnter", "CursorMoved", "CursorMovedI",
"WinScrolled" }, { callback = update })
vim.api.nvim_create_autocmd(
{ "BufEnter", "CursorMoved", "CursorMovedI", "WinScrolled" },
{ callback = update }
)
end

return smartcolumn
3 changes: 3 additions & 0 deletions stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 3
column_width = 80

0 comments on commit c2441d4

Please sign in to comment.