Skip to content

Commit e1b5cce

Browse files
oriori1703bfabio
authored andcommitted
Collapse small functions when formatting
This would allow to write more concise and easy to understands keybinds in the following commit
1 parent 36fb309 commit e1b5cce

4 files changed

Lines changed: 29 additions & 85 deletions

File tree

.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 ]]
@@ -381,9 +377,7 @@ require('lazy').setup({
381377

382378
-- `cond` is a condition used to determine whether this plugin should be
383379
-- installed and loaded.
384-
cond = function()
385-
return vim.fn.executable 'make' == 1
386-
end,
380+
cond = function() return vim.fn.executable 'make' == 1 end,
387381
},
388382
{ 'nvim-telescope/telescope-ui-select.nvim' },
389383

@@ -458,17 +452,20 @@ require('lazy').setup({
458452

459453
-- It's also possible to pass additional configuration options.
460454
-- See `:help telescope.builtin.live_grep()` for information about particular keys
461-
vim.keymap.set('n', '<leader>s/', function()
462-
builtin.live_grep {
463-
grep_open_files = true,
464-
prompt_title = 'Live Grep in Open Files',
465-
}
466-
end, { desc = '[S]earch [/] in Open Files' })
455+
vim.keymap.set(
456+
'n',
457+
'<leader>s/',
458+
function()
459+
builtin.live_grep {
460+
grep_open_files = true,
461+
prompt_title = 'Live Grep in Open Files',
462+
}
463+
end,
464+
{ desc = '[S]earch [/] in Open Files' }
465+
)
467466

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

@@ -643,9 +640,7 @@ require('lazy').setup({
643640
--
644641
-- This may be unwanted, since they displace some of your code
645642
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
646-
map('<leader>th', function()
647-
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
648-
end, '[T]oggle Inlay [H]ints')
643+
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')
649644
end
650645
end,
651646
})
@@ -808,9 +803,7 @@ require('lazy').setup({
808803
keys = {
809804
{
810805
'<leader>f',
811-
function()
812-
require('conform').format { async = true, lsp_format = 'fallback' }
813-
end,
806+
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
814807
mode = '',
815808
desc = '[F]ormat buffer',
816809
},
@@ -1043,9 +1036,7 @@ require('lazy').setup({
10431036
-- default behavior. For example, here we set the section for
10441037
-- cursor location to LINE:COLUMN
10451038
---@diagnostic disable-next-line: duplicate-set-field
1046-
statusline.section_location = function()
1047-
return '%2l:%-2v'
1048-
end
1039+
statusline.section_location = function() return '%2l:%-2v' end
10491040

10501041
-- ... and there is more!
10511042
-- 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
@@ -28,56 +28,14 @@ return {
2828
},
2929
keys = {
3030
-- Basic debugging keymaps, feel free to change to your liking!
31-
{
32-
'<F5>',
33-
function()
34-
require('dap').continue()
35-
end,
36-
desc = 'Debug: Start/Continue',
37-
},
38-
{
39-
'<F1>',
40-
function()
41-
require('dap').step_into()
42-
end,
43-
desc = 'Debug: Step Into',
44-
},
45-
{
46-
'<F2>',
47-
function()
48-
require('dap').step_over()
49-
end,
50-
desc = 'Debug: Step Over',
51-
},
52-
{
53-
'<F3>',
54-
function()
55-
require('dap').step_out()
56-
end,
57-
desc = 'Debug: Step Out',
58-
},
59-
{
60-
'<leader>b',
61-
function()
62-
require('dap').toggle_breakpoint()
63-
end,
64-
desc = 'Debug: Toggle Breakpoint',
65-
},
66-
{
67-
'<leader>B',
68-
function()
69-
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
70-
end,
71-
desc = 'Debug: Set Breakpoint',
72-
},
31+
{ '<F5>', function() require('dap').continue() end, desc = 'Debug: Start/Continue' },
32+
{ '<F1>', function() require('dap').step_into() end, desc = 'Debug: Step Into' },
33+
{ '<F2>', function() require('dap').step_over() end, desc = 'Debug: Step Over' },
34+
{ '<F3>', function() require('dap').step_out() end, desc = 'Debug: Step Out' },
35+
{ '<leader>b', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' },
36+
{ '<leader>B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, desc = 'Debug: Set Breakpoint' },
7337
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
74-
{
75-
'<F7>',
76-
function()
77-
require('dapui').toggle()
78-
end,
79-
desc = 'Debug: See last session result.',
80-
},
38+
{ '<F7>', function() require('dapui').toggle() end, desc = 'Debug: See last session result.' },
8139
},
8240
config = function()
8341
local dap = require 'dap'

lua/kickstart/plugins/gitsigns.lua

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

4040
-- Actions
4141
-- visual mode
42-
map('v', '<leader>hs', function()
43-
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
44-
end, { desc = 'git [s]tage hunk' })
45-
map('v', '<leader>hr', function()
46-
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
47-
end, { desc = 'git [r]eset hunk' })
42+
map('v', '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' })
43+
map('v', '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' })
4844
-- normal mode
4945
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
5046
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
@@ -54,9 +50,7 @@ return {
5450
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
5551
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
5652
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
57-
map('n', '<leader>hD', function()
58-
gitsigns.diffthis '@'
59-
end, { desc = 'git [D]iff against last commit' })
53+
map('n', '<leader>hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
6054
-- Toggles
6155
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
6256
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })

0 commit comments

Comments
 (0)