Skip to content

Commit 5ad57de

Browse files
committed
Collapse small functions when formatting
This would allow to write more concise and easy to understands keybinds in the following commit
1 parent 3338d39 commit 5ad57de

File tree

4 files changed

+29
-85
lines changed

4 files changed

+29
-85
lines changed

.stylua.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ indent_type = "Spaces"
44
indent_width = 2
55
quote_style = "AutoPreferSingle"
66
call_parentheses = "None"
7+
collapse_simple_statement = "FunctionOnly"

init.lua

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ vim.o.showmode = false
114114
-- Schedule the setting after `UiEnter` because it can increase startup-time.
115115
-- Remove this option if you want your OS clipboard to remain independent.
116116
-- See `:help 'clipboard'`
117-
vim.schedule(function()
118-
vim.o.clipboard = 'unnamedplus'
119-
end)
117+
vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)
120118

121119
-- Enable break indent
122120
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
214212
vim.api.nvim_create_autocmd('TextYankPost', {
215213
desc = 'Highlight when yanking (copying) text',
216214
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
217-
callback = function()
218-
vim.hl.on_yank()
219-
end,
215+
callback = function() vim.hl.on_yank() end,
220216
})
221217

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

373369
-- `cond` is a condition used to determine whether this plugin should be
374370
-- installed and loaded.
375-
cond = function()
376-
return vim.fn.executable 'make' == 1
377-
end,
371+
cond = function() return vim.fn.executable 'make' == 1 end,
378372
},
379373
{ 'nvim-telescope/telescope-ui-select.nvim' },
380374

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

449443
-- It's also possible to pass additional configuration options.
450444
-- See `:help telescope.builtin.live_grep()` for information about particular keys
451-
vim.keymap.set('n', '<leader>s/', function()
452-
builtin.live_grep {
453-
grep_open_files = true,
454-
prompt_title = 'Live Grep in Open Files',
455-
}
456-
end, { desc = '[S]earch [/] in Open Files' })
445+
vim.keymap.set(
446+
'n',
447+
'<leader>s/',
448+
function()
449+
builtin.live_grep {
450+
grep_open_files = true,
451+
prompt_title = 'Live Grep in Open Files',
452+
}
453+
end,
454+
{ desc = '[S]earch [/] in Open Files' }
455+
)
457456

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

@@ -619,9 +616,7 @@ require('lazy').setup({
619616
--
620617
-- This may be unwanted, since they displace some of your code
621618
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
622-
map('<leader>th', function()
623-
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
624-
end, '[T]oggle Inlay [H]ints')
619+
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')
625620
end
626621
end,
627622
})
@@ -743,9 +738,7 @@ require('lazy').setup({
743738
keys = {
744739
{
745740
'<leader>f',
746-
function()
747-
require('conform').format { async = true, lsp_format = 'fallback' }
748-
end,
741+
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
749742
mode = '',
750743
desc = '[F]ormat buffer',
751744
},
@@ -930,9 +923,7 @@ require('lazy').setup({
930923
-- default behavior. For example, here we set the section for
931924
-- cursor location to LINE:COLUMN
932925
---@diagnostic disable-next-line: duplicate-set-field
933-
statusline.section_location = function()
934-
return '%2l:%-2v'
935-
end
926+
statusline.section_location = function() return '%2l:%-2v' end
936927

937928
-- ... and there is more!
938929
-- Check out: https://github.com/echasnovski/mini.nvim

lua/kickstart/plugins/debug.lua

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -26,56 +26,14 @@ return {
2626
},
2727
keys = {
2828
-- Basic debugging keymaps, feel free to change to your liking!
29-
{
30-
'<F5>',
31-
function()
32-
require('dap').continue()
33-
end,
34-
desc = 'Debug: Start/Continue',
35-
},
36-
{
37-
'<F1>',
38-
function()
39-
require('dap').step_into()
40-
end,
41-
desc = 'Debug: Step Into',
42-
},
43-
{
44-
'<F2>',
45-
function()
46-
require('dap').step_over()
47-
end,
48-
desc = 'Debug: Step Over',
49-
},
50-
{
51-
'<F3>',
52-
function()
53-
require('dap').step_out()
54-
end,
55-
desc = 'Debug: Step Out',
56-
},
57-
{
58-
'<leader>b',
59-
function()
60-
require('dap').toggle_breakpoint()
61-
end,
62-
desc = 'Debug: Toggle Breakpoint',
63-
},
64-
{
65-
'<leader>B',
66-
function()
67-
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
68-
end,
69-
desc = 'Debug: Set Breakpoint',
70-
},
29+
{ '<F5>', function() require('dap').continue() end, desc = 'Debug: Start/Continue' },
30+
{ '<F1>', function() require('dap').step_into() end, desc = 'Debug: Step Into' },
31+
{ '<F2>', function() require('dap').step_over() end, desc = 'Debug: Step Over' },
32+
{ '<F3>', function() require('dap').step_out() end, desc = 'Debug: Step Out' },
33+
{ '<leader>b', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' },
34+
{ '<leader>B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, desc = 'Debug: Set Breakpoint' },
7135
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
72-
{
73-
'<F7>',
74-
function()
75-
require('dapui').toggle()
76-
end,
77-
desc = 'Debug: See last session result.',
78-
},
36+
{ '<F7>', function() require('dapui').toggle() end, desc = 'Debug: See last session result.' },
7937
},
8038
config = function()
8139
local dap = require 'dap'

lua/kickstart/plugins/gitsigns.lua

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ return {
3434

3535
-- Actions
3636
-- visual mode
37-
map('v', '<leader>hs', function()
38-
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
39-
end, { desc = 'git [s]tage hunk' })
40-
map('v', '<leader>hr', function()
41-
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
42-
end, { desc = 'git [r]eset hunk' })
37+
map('v', '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' })
38+
map('v', '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' })
4339
-- normal mode
4440
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
4541
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
@@ -49,9 +45,7 @@ return {
4945
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
5046
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
5147
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
52-
map('n', '<leader>hD', function()
53-
gitsigns.diffthis '@'
54-
end, { desc = 'git [D]iff against last commit' })
48+
map('n', '<leader>hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
5549
-- Toggles
5650
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
5751
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })

0 commit comments

Comments
 (0)