Skip to content

Commit

Permalink
Merge pull request #9 from itmecho/add-stylua
Browse files Browse the repository at this point in the history
Add stylua
  • Loading branch information
itmecho authored Sep 26, 2024
2 parents 7ef5dec + fb703f0 commit 7d2d9b9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Checks

on:
pull_request: {}
push:
branches:
- main

jobs:
stylua:
name: Formatting
runs-on: ubuntu-latest
steps:
- name: Fetch code
uses: actions/checkout@v4
- name: Check formatting
uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .
22 changes: 11 additions & 11 deletions lua/neoterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ local state = {

local config = {
clear_on_run = true,
position = "right", -- Default position is right
position = "right", -- Default position is right
noinsert = false,
width = 0.5, -- Default width is 50%
height = 1, -- Default height is 100%
width = 0.5, -- Default width is 50%
height = 1, -- Default height is 100%
}

-- Returns a bool to show if the neoterm window exists
Expand Down Expand Up @@ -141,7 +141,7 @@ function neoterm.open(opts)

-- If no height is provided and position is 'top', 'bottom', or 'center', set default height
if config.height == 1 then
if position == 'top' or position == 'bottom' or position == 'center' then
if position == "top" or position == "bottom" or position == "center" then
height = 0.5
else
height = config.height
Expand All @@ -154,32 +154,32 @@ function neoterm.open(opts)
border = "single",
}

if position == 0 then -- fullscreen
if position == 0 then -- fullscreen
winopts.width = ui.width
winopts.height = ui.height - vim.o.cmdheight - 3
winopts.row = 0
winopts.col = 0
elseif position == 1 then -- top
elseif position == 1 then -- top
winopts.width = ui.width
winopts.height = math.floor(ui.height * height) - vim.o.cmdheight - 3
winopts.row = 0
winopts.col = 0
elseif position == 2 then -- right
elseif position == 2 then -- right
winopts.width = math.floor(ui.width * width)
winopts.height = ui.height - vim.o.cmdheight - 3
winopts.row = 0
winopts.col = ui.width - winopts.width
elseif position == 3 then -- bottom
elseif position == 3 then -- bottom
winopts.width = ui.width
winopts.height = math.floor(ui.height * height) - vim.o.cmdheight - 3
winopts.row = ui.height - winopts.height - vim.o.cmdheight - 3
winopts.col = 0
elseif position == 4 then -- left
elseif position == 4 then -- left
winopts.width = math.floor(ui.width * width)
winopts.height = ui.height - vim.o.cmdheight - 3
winopts.row = 0
winopts.col = 0
elseif position == 5 then -- center
elseif position == 5 then -- center
winopts.width = math.floor(ui.width * width)
winopts.height = math.floor(ui.height * height) - vim.o.cmdheight - 3
winopts.row = math.floor((ui.height - winopts.height) / 2)
Expand Down Expand Up @@ -302,4 +302,4 @@ function neoterm.rerun()
neoterm.run(state.last_command)
end

return neoterm
return neoterm
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 = 2
quote_style = 'AutoPreferDouble'

0 comments on commit 7d2d9b9

Please sign in to comment.