Skip to content

Turn on StyLua's collapse_simple_statement #1484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/stylua.yml
Original file line number Diff line number Diff line change
@@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Stylua Check
uses: JohnnyMorganz/stylua-action@v3
uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
1 change: 1 addition & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -4,3 +4,4 @@ indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "None"
collapse_simple_statement = "FunctionOnly"
45 changes: 18 additions & 27 deletions init.lua
Original file line number Diff line number Diff line change
@@ -114,9 +114,7 @@ vim.o.showmode = false
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.schedule(function()
vim.o.clipboard = 'unnamedplus'
end)
vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)

-- Enable break indent
vim.o.breakindent = true
@@ -214,9 +212,7 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.hl.on_yank()
end,
callback = function() vim.hl.on_yank() end,
})

-- [[ Install `lazy.nvim` plugin manager ]]
@@ -372,9 +368,7 @@ require('lazy').setup({

-- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded.
cond = function()
return vim.fn.executable 'make' == 1
end,
cond = function() return vim.fn.executable 'make' == 1 end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },

@@ -448,17 +442,20 @@ require('lazy').setup({

-- It's also possible to pass additional configuration options.
-- See `:help telescope.builtin.live_grep()` for information about particular keys
vim.keymap.set('n', '<leader>s/', function()
builtin.live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end, { desc = '[S]earch [/] in Open Files' })
vim.keymap.set(
'n',
'<leader>s/',
function()
builtin.live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end,
{ desc = '[S]earch [/] in Open Files' }
)

-- Shortcut for searching your Neovim configuration files
vim.keymap.set('n', '<leader>sn', function()
builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' })
vim.keymap.set('n', '<leader>sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' })
end,
},

@@ -619,9 +616,7 @@ require('lazy').setup({
--
-- This may be unwanted, since they displace some of your code
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
end, '[T]oggle Inlay [H]ints')
map('<leader>th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints')
end
end,
})
@@ -743,9 +738,7 @@ require('lazy').setup({
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_format = 'fallback' }
end,
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
mode = '',
desc = '[F]ormat buffer',
},
@@ -930,9 +923,7 @@ require('lazy').setup({
-- default behavior. For example, here we set the section for
-- cursor location to LINE:COLUMN
---@diagnostic disable-next-line: duplicate-set-field
statusline.section_location = function()
return '%2l:%-2v'
end
statusline.section_location = function() return '%2l:%-2v' end

-- ... and there is more!
-- Check out: https://github.com/echasnovski/mini.nvim
56 changes: 7 additions & 49 deletions lua/kickstart/plugins/debug.lua
Original file line number Diff line number Diff line change
@@ -26,56 +26,14 @@ return {
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
},
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
{ '<F5>', function() require('dap').continue() end, desc = 'Debug: Start/Continue' },
{ '<F1>', function() require('dap').step_into() end, desc = 'Debug: Step Into' },
{ '<F2>', function() require('dap').step_over() end, desc = 'Debug: Step Over' },
{ '<F3>', function() require('dap').step_out() end, desc = 'Debug: Step Out' },
{ '<leader>b', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' },
{ '<leader>B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, desc = 'Debug: Set Breakpoint' },
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
{ '<F7>', function() require('dapui').toggle() end, desc = 'Debug: See last session result.' },
},
config = function()
local dap = require 'dap'
12 changes: 3 additions & 9 deletions lua/kickstart/plugins/gitsigns.lua
Original file line number Diff line number Diff line change
@@ -34,12 +34,8 @@ return {

-- Actions
-- visual mode
map('v', '<leader>hs', function()
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [s]tage hunk' })
map('v', '<leader>hr', function()
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [r]eset hunk' })
map('v', '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' })
map('v', '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' })
-- normal mode
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
@@ -49,9 +45,7 @@ return {
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hD', function()
gitsigns.diffthis '@'
end, { desc = 'git [D]iff against last commit' })
map('n', '<leader>hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
-- Toggles
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })