diff --git a/.stylua.toml b/.stylua.toml index edfa5067..78c5507c 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -1,7 +1,6 @@ -column_width = 160 +column_width = 120 line_endings = "Unix" indent_type = "Spaces" indent_width = 2 quote_style = "AutoPreferSingle" call_parentheses = "None" -collapse_simple_statement = "Always" diff --git a/init.lua b/init.lua index 3593ca2e..066c7cf0 100644 --- a/init.lua +++ b/init.lua @@ -114,7 +114,9 @@ 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 @@ -227,7 +229,9 @@ vim.keymap.set('n', '', '', { 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 ]] @@ -236,7 +240,9 @@ local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } - if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) end + if vim.v.shell_error ~= 0 then + error('Error cloning lazy.nvim:\n' .. out) + end end ---@type vim.Option @@ -355,7 +361,9 @@ 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' }, @@ -442,7 +450,12 @@ require('lazy').setup({ -- Fuzzy find all the symbols in your current workspace. -- Similar to document symbols, except searches over your entire project. - vim.keymap.set('n', 'gW', builtin.lsp_dynamic_workspace_symbols, { buffer = buf, desc = 'Open Workspace Symbols' }) + vim.keymap.set( + 'n', + 'gW', + builtin.lsp_dynamic_workspace_symbols, + { buffer = buf, desc = 'Open Workspace Symbols' } + ) -- Jump to the type of the word under your cursor. -- Useful when you're not sure what type a variable is and you want to see @@ -462,20 +475,17 @@ 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', - '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', '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', 'sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' }) + vim.keymap.set('n', 'sn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) end, }, @@ -593,7 +603,9 @@ require('lazy').setup({ -- -- This may be unwanted, since they displace some of your code if client and client:supports_method('textDocument/inlayHint', event.buf) then - map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') + map('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, }) @@ -621,7 +633,12 @@ require('lazy').setup({ on_init = function(client) if client.workspace_folders then local path = client.workspace_folders[1].name - 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 + 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 end client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { @@ -674,7 +691,9 @@ require('lazy').setup({ keys = { { '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', }, @@ -721,7 +740,9 @@ require('lazy').setup({ -- Build Step is needed for regex support in snippets. -- This step is not supported in many windows environments. -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then return end + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then + return + end return 'make install_jsregexp' end)(), dependencies = { @@ -863,7 +884,9 @@ 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/nvim-mini/mini.nvim @@ -877,17 +900,33 @@ require('lazy').setup({ branch = 'main', -- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro` config = function() - local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' } + local parsers = { + 'bash', + 'c', + 'diff', + 'html', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'vim', + 'vimdoc', + } require('nvim-treesitter').install(parsers) vim.api.nvim_create_autocmd('FileType', { callback = function(args) local buf, filetype = args.buf, args.match local language = vim.treesitter.language.get_lang(filetype) - if not language then return end + if not language then + return + end -- check if parser exists and load it - if not vim.treesitter.language.add(language) then return end + if not vim.treesitter.language.add(language) then + return + end -- enables syntax highlighting and other treesitter features vim.treesitter.start(buf, language) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 7e58905e..481c6fbb 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -28,14 +28,56 @@ return { }, keys = { -- Basic debugging keymaps, feel free to change to your liking! - { '', function() require('dap').continue() end, desc = 'Debug: Start/Continue' }, - { '', function() require('dap').step_into() end, desc = 'Debug: Step Into' }, - { '', function() require('dap').step_over() end, desc = 'Debug: Step Over' }, - { '', function() require('dap').step_out() end, desc = 'Debug: Step Out' }, - { 'b', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' }, - { 'B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, desc = 'Debug: Set Breakpoint' }, + { + '', + function() + require('dap').continue() + end, + desc = 'Debug: Start/Continue', + }, + { + '', + function() + require('dap').step_into() + end, + desc = 'Debug: Step Into', + }, + { + '', + function() + require('dap').step_over() + end, + desc = 'Debug: Step Over', + }, + { + '', + function() + require('dap').step_out() + end, + desc = 'Debug: Step Out', + }, + { + 'b', + function() + require('dap').toggle_breakpoint() + end, + desc = 'Debug: Toggle Breakpoint', + }, + { + '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. - { '', function() require('dapui').toggle() end, desc = 'Debug: See last session result.' }, + { + '', + function() + require('dapui').toggle() + end, + desc = 'Debug: See last session result.', + }, }, config = function() local dap = require 'dap' diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index f0137084..3913d189 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -39,8 +39,12 @@ return { -- Actions -- visual mode - map('v', 'hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' }) - map('v', 'hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' }) + map('v', 'hs', function() + gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'git [s]tage hunk' }) + map('v', 'hr', function() + gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'git [r]eset hunk' }) -- normal mode map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) @@ -50,7 +54,9 @@ return { map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) - map('n', 'hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' }) + map('n', 'hD', function() + gitsigns.diffthis '@' + end, { desc = 'git [D]iff against last commit' }) -- Toggles map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) map('n', 'tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 7054023c..5ff8e34b 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -52,7 +52,9 @@ return { -- Only run the linter in buffers that you can modify in order to -- avoid superfluous noise, notably within the handy LSP pop-ups that -- describe the hovered symbol using Markdown. - if vim.bo.modifiable then lint.try_lint() end + if vim.bo.modifiable then + lint.try_lint() + end end, }) end,