Skip to content

Commit 7e54a4c

Browse files
committed
fix: trimming down config and updating stylua
1 parent 8c6b78c commit 7e54a4c

File tree

5 files changed

+36
-117
lines changed

5 files changed

+36
-117
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 = "Always"

init.lua

Lines changed: 24 additions & 84 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 ]]
@@ -225,9 +221,7 @@ local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
225221
if not (vim.uv or vim.loop).fs_stat(lazypath) then
226222
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
227223
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
228-
if vim.v.shell_error ~= 0 then
229-
error('Error cloning lazy.nvim:\n' .. out)
230-
end
224+
if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) end
231225
end
232226

233227
---@type vim.Option
@@ -249,13 +243,6 @@ require('lazy').setup({
249243
-- NOTE: Plugins can be added via a link or github org/name. To run setup automatically, use `opts = {}`
250244
{ 'NMAC427/guess-indent.nvim', opts = {} },
251245

252-
-- NOTE: Plugins can also be added by using a table,
253-
-- with the first argument being the link and the following
254-
-- keys can be used to configure plugin behavior/loading/etc.
255-
--
256-
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
257-
--
258-
259246
-- Alternatively, use `config = function() ... end` for full control over the configuration.
260247
-- If you prefer to call `setup` explicitly, use:
261248
-- {
@@ -300,47 +287,11 @@ require('lazy').setup({
300287

301288
{ -- Useful plugin to show you pending keybinds.
302289
'folke/which-key.nvim',
303-
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
290+
event = 'VimEnter',
304291
opts = {
305292
-- delay between pressing a key and opening which-key (milliseconds)
306-
-- this setting is independent of vim.o.timeoutlen
307293
delay = 0,
308-
icons = {
309-
-- set icon mappings to true if you have a Nerd Font
310-
mappings = vim.g.have_nerd_font,
311-
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
312-
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
313-
keys = vim.g.have_nerd_font and {} or {
314-
Up = '<Up> ',
315-
Down = '<Down> ',
316-
Left = '<Left> ',
317-
Right = '<Right> ',
318-
C = '<C-…> ',
319-
M = '<M-…> ',
320-
D = '<D-…> ',
321-
S = '<S-…> ',
322-
CR = '<CR> ',
323-
Esc = '<Esc> ',
324-
ScrollWheelDown = '<ScrollWheelDown> ',
325-
ScrollWheelUp = '<ScrollWheelUp> ',
326-
NL = '<NL> ',
327-
BS = '<BS> ',
328-
Space = '<Space> ',
329-
Tab = '<Tab> ',
330-
F1 = '<F1>',
331-
F2 = '<F2>',
332-
F3 = '<F3>',
333-
F4 = '<F4>',
334-
F5 = '<F5>',
335-
F6 = '<F6>',
336-
F7 = '<F7>',
337-
F8 = '<F8>',
338-
F9 = '<F9>',
339-
F10 = '<F10>',
340-
F11 = '<F11>',
341-
F12 = '<F12>',
342-
},
343-
},
294+
icons = { mappings = vim.g.have_nerd_font },
344295

345296
-- Document existing key chains
346297
spec = {
@@ -382,9 +333,7 @@ require('lazy').setup({
382333

383334
-- `cond` is a condition used to determine whether this plugin should be
384335
-- installed and loaded.
385-
cond = function()
386-
return vim.fn.executable 'make' == 1
387-
end,
336+
cond = function() return vim.fn.executable 'make' == 1 end,
388337
},
389338
{ 'nvim-telescope/telescope-ui-select.nvim' },
390339

@@ -497,17 +446,20 @@ require('lazy').setup({
497446

498447
-- It's also possible to pass additional configuration options.
499448
-- See `:help telescope.builtin.live_grep()` for information about particular keys
500-
vim.keymap.set('n', '<leader>s/', function()
501-
builtin.live_grep {
502-
grep_open_files = true,
503-
prompt_title = 'Live Grep in Open Files',
504-
}
505-
end, { desc = '[S]earch [/] in Open Files' })
449+
vim.keymap.set(
450+
'n',
451+
'<leader>s/',
452+
function()
453+
builtin.live_grep {
454+
grep_open_files = true,
455+
prompt_title = 'Live Grep in Open Files',
456+
}
457+
end,
458+
{ desc = '[S]earch [/] in Open Files' }
459+
)
506460

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

@@ -618,9 +570,7 @@ require('lazy').setup({
618570
--
619571
-- This may be unwanted, since they displace some of your code
620572
if client and client:supports_method('textDocument/inlayHint', event.buf) then
621-
map('<leader>th', function()
622-
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
623-
end, '[T]oggle Inlay [H]ints')
573+
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')
624574
end
625575
end,
626576
})
@@ -695,9 +645,7 @@ require('lazy').setup({
695645
on_init = function(client)
696646
if client.workspace_folders then
697647
local path = client.workspace_folders[1].name
698-
if path ~= vim.fn.stdpath 'config' and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) then
699-
return
700-
end
648+
if path ~= vim.fn.stdpath 'config' and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) then return end
701649
end
702650

703651
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
@@ -731,9 +679,7 @@ require('lazy').setup({
731679
keys = {
732680
{
733681
'<leader>f',
734-
function()
735-
require('conform').format { async = true, lsp_format = 'fallback' }
736-
end,
682+
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
737683
mode = '',
738684
desc = '[F]ormat buffer',
739685
},
@@ -778,9 +724,7 @@ require('lazy').setup({
778724
-- Build Step is needed for regex support in snippets.
779725
-- This step is not supported in many windows environments.
780726
-- Remove the below condition to re-enable on windows.
781-
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
782-
return
783-
end
727+
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then return end
784728
return 'make install_jsregexp'
785729
end)(),
786730
dependencies = {
@@ -914,9 +858,7 @@ require('lazy').setup({
914858
-- default behavior. For example, here we set the section for
915859
-- cursor location to LINE:COLUMN
916860
---@diagnostic disable-next-line: duplicate-set-field
917-
statusline.section_location = function()
918-
return '%2l:%-2v'
919-
end
861+
statusline.section_location = function() return '%2l:%-2v' end
920862

921863
-- ... and there is more!
922864
-- Check out: https://github.com/nvim-mini/mini.nvim
@@ -929,9 +871,7 @@ require('lazy').setup({
929871
require('nvim-treesitter').install(filetypes)
930872
vim.api.nvim_create_autocmd('FileType', {
931873
pattern = filetypes,
932-
callback = function()
933-
vim.treesitter.start()
934-
end,
874+
callback = function() vim.treesitter.start() end,
935875
})
936876
end,
937877
},

lua/kickstart/plugins/debug.lua

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,52 +28,38 @@ return {
2828
-- Basic debugging keymaps, feel free to change to your liking!
2929
{
3030
'<F5>',
31-
function()
32-
require('dap').continue()
33-
end,
31+
function() require('dap').continue() end,
3432
desc = 'Debug: Start/Continue',
3533
},
3634
{
3735
'<F1>',
38-
function()
39-
require('dap').step_into()
40-
end,
36+
function() require('dap').step_into() end,
4137
desc = 'Debug: Step Into',
4238
},
4339
{
4440
'<F2>',
45-
function()
46-
require('dap').step_over()
47-
end,
41+
function() require('dap').step_over() end,
4842
desc = 'Debug: Step Over',
4943
},
5044
{
5145
'<F3>',
52-
function()
53-
require('dap').step_out()
54-
end,
46+
function() require('dap').step_out() end,
5547
desc = 'Debug: Step Out',
5648
},
5749
{
5850
'<leader>b',
59-
function()
60-
require('dap').toggle_breakpoint()
61-
end,
51+
function() require('dap').toggle_breakpoint() end,
6252
desc = 'Debug: Toggle Breakpoint',
6353
},
6454
{
6555
'<leader>B',
66-
function()
67-
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
68-
end,
56+
function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end,
6957
desc = 'Debug: Set Breakpoint',
7058
},
7159
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
7260
{
7361
'<F7>',
74-
function()
75-
require('dapui').toggle()
76-
end,
62+
function() require('dapui').toggle() end,
7763
desc = 'Debug: See last session result.',
7864
},
7965
},

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' })

lua/kickstart/plugins/lint.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ return {
5050
-- Only run the linter in buffers that you can modify in order to
5151
-- avoid superfluous noise, notably within the handy LSP pop-ups that
5252
-- describe the hovered symbol using Markdown.
53-
if vim.bo.modifiable then
54-
lint.try_lint()
55-
end
53+
if vim.bo.modifiable then lint.try_lint() end
5654
end,
5755
})
5856
end,

0 commit comments

Comments
 (0)