From 8b99910bb4398b29488de52546c3bc80d4d9bc89 Mon Sep 17 00:00:00 2001 From: Oliver Hartmann Date: Thu, 17 Apr 2025 21:58:34 +0200 Subject: [PATCH] new lua style --- lua/my_autocommands.lua | 24 +- lua/my_keymappings.lua | 16 +- lua/plugins/blink.lua | 16 +- lua/plugins/cmake-tools.lua | 4 +- lua/plugins/cmp.lua | 8 +- lua/plugins/codium.lua | 4 +- lua/plugins/conform.lua | 4 +- lua/plugins/dap.lua | 96 ++------ lua/plugins/gitsigns.lua | 20 +- lua/plugins/grug-far.lua | 8 +- lua/plugins/lsp.lua | 4 +- lua/plugins/lualine.lua | 8 +- lua/plugins/markdown-preview.lua | 4 +- lua/plugins/mini-sessions.lua | 4 +- lua/plugins/neogen.lua | 4 +- lua/plugins/neogit.lua | 4 +- lua/plugins/neotest.lua | 8 +- lua/plugins/oil.lua | 4 +- lua/plugins/overseer.lua | 4 +- lua/plugins/rustaceanvim.lua | 12 +- lua/plugins/snacks.lua | 374 ++++--------------------------- lua/plugins/toggleterm.lua | 8 +- lua/plugins/workspaces.lua | 45 ---- lua/themes/gruvbox-baby.lua | 4 +- lua/utils/python_venv.lua | 4 +- stylua.toml | 1 + 26 files changed, 109 insertions(+), 583 deletions(-) delete mode 100644 lua/plugins/workspaces.lua diff --git a/lua/my_autocommands.lua b/lua/my_autocommands.lua index 6479dc2..0f11c3a 100644 --- a/lua/my_autocommands.lua +++ b/lua/my_autocommands.lua @@ -11,44 +11,32 @@ api.nvim_create_autocmd('TextYankPost', { local fileGrp = api.nvim_create_augroup('file_type', { clear = true }) api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { pattern = { '*.simvis', '*.manifest' }, - callback = function() - vim.bo.filetype = 'xml' - end, + callback = function() vim.bo.filetype = 'xml' end, group = fileGrp, }) api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { pattern = { '*.simcfg', '*.simcon', '*.simudex' }, - callback = function() - vim.bo.filetype = 'xml' - end, + callback = function() vim.bo.filetype = 'xml' end, group = fileGrp, }) api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { pattern = { 'JenkinsFile*' }, - callback = function() - vim.bo.filetype = 'groovy' - end, + callback = function() vim.bo.filetype = 'groovy' end, group = fileGrp, }) api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { pattern = { 'SConstruct', 'SConscript' }, - callback = function() - vim.bo.filetype = 'python' - end, + callback = function() vim.bo.filetype = 'python' end, group = fileGrp, }) api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { pattern = { 'doskey' }, - callback = function() - vim.bo.filetype = 'dosini' - end, + callback = function() vim.bo.filetype = 'dosini' end, group = fileGrp, }) api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { pattern = { '.clangd', '.clang-tidy' }, - callback = function() - vim.bo.filetype = 'yaml' - end, + callback = function() vim.bo.filetype = 'yaml' end, group = fileGrp, }) diff --git a/lua/my_keymappings.lua b/lua/my_keymappings.lua index eaf3877..c27e516 100644 --- a/lua/my_keymappings.lua +++ b/lua/my_keymappings.lua @@ -76,16 +76,8 @@ if vim.g.neovide then vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta print(string.format('scaling: %f', vim.g.neovide_scale_factor)) end - vim.keymap.set('n', '', function() - change_scale_factor(1.25) - end) - vim.keymap.set('n', '', function() - change_scale_factor(1 / 1.25) - end) - vim.keymap.set('n', '', function() - change_scale_factor(1.25) - end) - vim.keymap.set('n', '', function() - change_scale_factor(1 / 1.25) - end) + vim.keymap.set('n', '', function() change_scale_factor(1.25) end) + vim.keymap.set('n', '', function() change_scale_factor(1 / 1.25) end) + vim.keymap.set('n', '', function() change_scale_factor(1.25) end) + vim.keymap.set('n', '', function() change_scale_factor(1 / 1.25) end) end diff --git a/lua/plugins/blink.lua b/lua/plugins/blink.lua index e268fa5..3eb49b1 100644 --- a/lua/plugins/blink.lua +++ b/lua/plugins/blink.lua @@ -54,9 +54,7 @@ return { nerd_font_variant = 'mono', }, - enabled = function() - return (vim.bo.buftype ~= 'prompt' and vim.b.completion ~= false) or require('cmp_dap').is_dap_buffer() - end, + enabled = function() return (vim.bo.buftype ~= 'prompt' and vim.b.completion ~= false) or require('cmp_dap').is_dap_buffer() end, -- default list of enabled providers defined so that you can extend it -- elsewhere in your config, without redefining it, via `opts_extend` sources = { @@ -104,9 +102,7 @@ return { name = 'dap', module = 'blink.compat.source', async = false, - enabled = function() - return require('cmp_dap').is_dap_buffer() - end, + enabled = function() return require('cmp_dap').is_dap_buffer() end, }, buffer = { name = 'Buffer', @@ -116,12 +112,8 @@ return { get_bufnrs = function() return vim .iter(vim.api.nvim_list_wins()) - :map(function(win) - return vim.api.nvim_win_get_buf(win) - end) - :filter(function(buf) - return vim.bo[buf].buftype ~= 'nofile' - end) + :map(function(win) return vim.api.nvim_win_get_buf(win) end) + :filter(function(buf) return vim.bo[buf].buftype ~= 'nofile' end) :totable() end, }, diff --git a/lua/plugins/cmake-tools.lua b/lua/plugins/cmake-tools.lua index 81aabfa..c7d9061 100644 --- a/lua/plugins/cmake-tools.lua +++ b/lua/plugins/cmake-tools.lua @@ -28,9 +28,7 @@ return { keys = { { '', - function() - require('cmake-tools').debug({}) - end, + function() require('cmake-tools').debug({}) end, desc = 'Run and debug target from cmake', }, }, diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 83356aa..28a7615 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -17,9 +17,7 @@ return { 'hrsh7th/cmp-nvim-lsp-signature-help', }, config = function() - local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) - end + local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end local cmp = require('cmp') local lspkind = require('lspkind') @@ -96,9 +94,7 @@ return { { name = 'buffer', option = { - get_bufnrs = function() - return vim.api.nvim_list_bufs() - end, + get_bufnrs = function() return vim.api.nvim_list_bufs() end, }, }, { name = 'path' }, diff --git a/lua/plugins/codium.lua b/lua/plugins/codium.lua index 64f9a98..06476cf 100644 --- a/lua/plugins/codium.lua +++ b/lua/plugins/codium.lua @@ -3,8 +3,6 @@ return { requires = { 'nvim-lua/plenary.nvim', }, - config = function() - require('codeium').setup({}) - end, + config = function() require('codeium').setup({}) end, enabled = vim.fn.hostname() == 'perryLinux64', } diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index 68ce984..60f8ac1 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -19,9 +19,7 @@ return { { 'f', mode = { 'n', 'x', 'v' }, - function() - require('conform').format() - end, + function() require('conform').format() end, desc = 'Format with Conform', }, }, diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 519283e..48007cb 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -20,69 +20,15 @@ return { }, }, keys = { - { - '', - function() - require('dap').continue() - end, - desc = 'DAP start or continue', - }, - { - '', - function() - require('dap').run_last() - end, - desc = 'DAP run last', - }, - { - '', - function() - require('dap').run_last() - end, - desc = 'Run last', - }, - { - '', - function() - require('dap').goto_() - end, - desc = 'DAP goto', - }, - { - '', - function() - require('dap.ui.widgets').hover() - end, - desc = 'DAP Hover', - }, - { - '', - function() - require('dap').toggle_breakpoint() - end, - desc = 'DAP breakpoint', - }, - { - '', - function() - require('dap').step_over() - end, - desc = 'DAP step_over', - }, - { - '', - function() - require('dap').step_into() - end, - desc = 'DAP step_into', - }, - { - '', - function() - require('dap').step_out() - end, - desc = 'DAP step_out', - }, + { '', function() require('dap').continue() end, desc = 'DAP start or continue' }, + { '', function() require('dap').run_last() end, desc = 'DAP run last' }, + { '', function() require('dap').run_last() end, desc = 'Run last' }, + { '', function() require('dap').goto_() end, desc = 'DAP goto' }, + { '', function() require('dap.ui.widgets').hover() end, desc = 'DAP Hover' }, + { '', function() require('dap').toggle_breakpoint() end, desc = 'DAP breakpoint' }, + { '', function() require('dap').step_over() end, desc = 'DAP step_over' }, + { '', function() require('dap').step_into() end, desc = 'DAP step_into' }, + { '', function() require('dap').step_out() end, desc = 'DAP step_out' }, }, config = function() local dap = require('dap') @@ -112,18 +58,10 @@ return { local dapui = require('dapui') dapui.setup() - dap.listeners.before.attach.dapui_config = function() - dapui.open() - end - dap.listeners.before.launch.dapui_config = function() - dapui.open() - end - dap.listeners.before.event_terminated.dapui_config = function() - dapui.close() - end - dap.listeners.before.event_exited.dapui_config = function() - dapui.close() - end + dap.listeners.before.attach.dapui_config = function() dapui.open() end + dap.listeners.before.launch.dapui_config = function() dapui.open() end + dap.listeners.before.event_terminated.dapui_config = function() dapui.close() end + dap.listeners.before.event_exited.dapui_config = function() dapui.close() end local path = require('mason-registry').get_package('debugpy'):get_install_path() if vim.loop.os_uname().sysname:find('Windows') then @@ -168,9 +106,7 @@ return { name = 'Launch codelldb', type = 'codelldb', request = 'launch', - program = function() - return vim.fn.input({ 'Path to executable: ', vim.fn.getcwd() .. '/build_nvim/', 'file' }) - end, + program = function() return vim.fn.input({ 'Path to executable: ', vim.fn.getcwd() .. '/build_nvim/', 'file' }) end, cwd = '${workspaceFolder}', stopOnEntry = false, }, @@ -178,9 +114,7 @@ return { name = 'Launch lldb', type = 'lldb', request = 'launch', - program = function() - return vim.fn.input({ 'Path to executable: ', vim.fn.getcwd() .. '/build_nvim', 'file' }) - end, + program = function() return vim.fn.input({ 'Path to executable: ', vim.fn.getcwd() .. '/build_nvim', 'file' }) end, cwd = '${workspaceFolder}', stopOnEntry = false, args = {}, diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index a3bb97b..fb1083c 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -34,32 +34,22 @@ return { vim.keymap.set('n', 'hs', gitsigns.stage_hunk, { desc = 'Stage hunk' }) vim.keymap.set('n', 'hr', gitsigns.reset_hunk, { desc = 'Reset hunk' }) - vim.keymap.set('v', 'hs', function() - gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) - end, { desc = 'Stage hunk' }) + vim.keymap.set('v', 'hs', function() gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) end, { desc = 'Stage hunk' }) - vim.keymap.set('v', 'hr', function() - gitsigns.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) - end, { desc = 'Reset hunk' }) + vim.keymap.set('v', 'hr', function() gitsigns.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) end, { desc = 'Reset hunk' }) vim.keymap.set('n', 'hS', gitsigns.stage_buffer, { desc = 'Stage buffer' }) vim.keymap.set('n', 'hR', gitsigns.reset_buffer, { desc = 'Reset buffer' }) vim.keymap.set('n', 'hp', gitsigns.preview_hunk, { desc = 'Preview hunk' }) vim.keymap.set('n', 'hi', gitsigns.preview_hunk_inline, { desc = 'Preview hunk inline' }) - vim.keymap.set('n', 'hb', function() - gitsigns.blame_line({ full = true }) - end, { desc = 'Blame line' }) + vim.keymap.set('n', 'hb', function() gitsigns.blame_line({ full = true }) end, { desc = 'Blame line' }) vim.keymap.set('n', 'hd', gitsigns.diffthis, { desc = 'Diff this' }) - vim.keymap.set('n', 'hD', function() - gitsigns.diffthis('~') - end, { desc = 'Diff this (cached)' }) + vim.keymap.set('n', 'hD', function() gitsigns.diffthis('~') end, { desc = 'Diff this (cached)' }) - vim.keymap.set('n', 'hQ', function() - gitsigns.setqflist('all') - end, { desc = 'Set quickfix list all' }) + vim.keymap.set('n', 'hQ', function() gitsigns.setqflist('all') end, { desc = 'Set quickfix list all' }) vim.keymap.set('n', 'hq', gitsigns.setqflist, { desc = 'Set quickfix list' }) -- Toggles diff --git a/lua/plugins/grug-far.lua b/lua/plugins/grug-far.lua index 5e6c7ef..77783b9 100644 --- a/lua/plugins/grug-far.lua +++ b/lua/plugins/grug-far.lua @@ -1,14 +1,10 @@ return { 'MagicDuck/grug-far.nvim', - config = function() - require('grug-far').setup({}) - end, + config = function() require('grug-far').setup({}) end, keys = { { '', - function() - require('grug-far').open() - end, + function() require('grug-far').open() end, desc = 'GrugFar', mode = { 'n', 'v' }, }, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 6842dc3..957f56f 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -130,7 +130,9 @@ return { callback = function(args) local bufnr = args.buf local client = vim.lsp.get_client_by_id(args.data.client_id) - if not client then return end + if not client then + return + end lspKeys(client, bufnr) if client.server_capabilities.completionProvider then diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 94b4da8..d5711ff 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -39,12 +39,8 @@ return { color = { fg = colors.vulgaris.light_blue, gui = 'bold' }, }, { - function() - return require('nvim-navic').get_location() - end, - cond = function() - return package.loaded['nvim-navic'] and require('nvim-navic').is_available() - end, + function() return require('nvim-navic').get_location() end, + cond = function() return package.loaded['nvim-navic'] and require('nvim-navic').is_available() end, color = { fg = colors.vulgaris.blue }, }, }, diff --git a/lua/plugins/markdown-preview.lua b/lua/plugins/markdown-preview.lua index fc3113e..5ef3da6 100644 --- a/lua/plugins/markdown-preview.lua +++ b/lua/plugins/markdown-preview.lua @@ -7,9 +7,7 @@ return { }, branch = 'master', ft = { 'markdown' }, - build = function() - vim.fn['mkdp#util#install']() - end, + build = function() vim.fn['mkdp#util#install']() end, init = function() vim.g.mkdp_auto_close = 0 vim.g.mkdp_auto_start = 0 diff --git a/lua/plugins/mini-sessions.lua b/lua/plugins/mini-sessions.lua index 58f72b2..59ca65b 100644 --- a/lua/plugins/mini-sessions.lua +++ b/lua/plugins/mini-sessions.lua @@ -1,7 +1,5 @@ return { 'echasnovski/mini.sessions', version = '*', - config = function() - require('mini.sessions').setup() - end, + config = function() require('mini.sessions').setup() end, } diff --git a/lua/plugins/neogen.lua b/lua/plugins/neogen.lua index 2eb0235..6db094f 100644 --- a/lua/plugins/neogen.lua +++ b/lua/plugins/neogen.lua @@ -24,9 +24,7 @@ return { keys = { { 'n', - function() - require('neogen').generate({}) - end, + function() require('neogen').generate({}) end, desc = 'Add comment', }, }, diff --git a/lua/plugins/neogit.lua b/lua/plugins/neogit.lua index 39a76a6..a01d599 100644 --- a/lua/plugins/neogit.lua +++ b/lua/plugins/neogit.lua @@ -17,9 +17,7 @@ return { keys = { { 't', - function() - require('neogit').open() - end, + function() require('neogit').open() end, }, }, cmd = { 'Neogit ' }, diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua index 960c605..bf4375f 100644 --- a/lua/plugins/neotest.lua +++ b/lua/plugins/neotest.lua @@ -23,16 +23,12 @@ return { keys = { { '', - function() - require('neotest').run.run() - end, + function() require('neotest').run.run() end, desc = 'Run nearest test', }, { '', - function() - require('neotest').run.run({ strategy = 'dap' }) - end, + function() require('neotest').run.run({ strategy = 'dap' }) end, desc = 'Run nearest test', }, }, diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua index 93bfffe..069908f 100644 --- a/lua/plugins/oil.lua +++ b/lua/plugins/oil.lua @@ -29,9 +29,7 @@ return { keys = { { '-', - function() - require('oil').open() - end, + function() require('oil').open() end, desc = 'Open oil', }, }, diff --git a/lua/plugins/overseer.lua b/lua/plugins/overseer.lua index f3953fe..6eb15f1 100644 --- a/lua/plugins/overseer.lua +++ b/lua/plugins/overseer.lua @@ -8,9 +8,7 @@ return { keys = { { '', - function() - require('overseer').run_template() - end, + function() require('overseer').run_template() end, mode = { 'n', 'x' }, desc = 'Start task (overseer)', }, diff --git a/lua/plugins/rustaceanvim.lua b/lua/plugins/rustaceanvim.lua index 7821ed2..465d13e 100644 --- a/lua/plugins/rustaceanvim.lua +++ b/lua/plugins/rustaceanvim.lua @@ -6,23 +6,17 @@ return { server = { on_attach = function(client, bufnr) local options = { noremap = true, silent = false, buffer = bufnr } - vim.keymap.set('n', 'y', function() - vim.cmd.RustLsp({ 'hover', 'actions' }) - end, vim.tbl_extend('error', options, { desc = 'Hover' })) + vim.keymap.set('n', 'y', function() vim.cmd.RustLsp({ 'hover', 'actions' }) end, vim.tbl_extend('error', options, { desc = 'Hover' })) local group = vim.api.nvim_create_augroup('lsp_document_highlight', { clear = false }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - callback = function() - vim.lsp.buf.document_highlight() - end, + callback = function() vim.lsp.buf.document_highlight() end, buffer = bufnr, group = group, desc = 'Document Highlight', }) vim.api.nvim_create_autocmd('CursorMoved', { - callback = function() - vim.lsp.buf.clear_references() - end, + callback = function() vim.lsp.buf.clear_references() end, buffer = bufnr, group = group, desc = 'Clear All the References', diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua index 4d6b530..ca7d585 100644 --- a/lua/plugins/snacks.lua +++ b/lua/plugins/snacks.lua @@ -63,198 +63,39 @@ return { }, }, keys = { - { - 'g', - function() - Snacks.lazygit() - end, - desc = 'Lazygit', - }, - { - 'gf', - function() - Snacks.lazygit.log_file() - end, - desc = 'Lazygit Current File History', - }, - { - 'gl', - function() - Snacks.lazygit.log() - end, - desc = 'Lazygit Log (cwd)', - }, - { - 'm', - function() - Snacks.words.jump(vim.v.count1) - end, - desc = 'Next Reference', - mode = { 'n' }, - }, - { - '', - function() - Snacks.words.jump(-vim.v.count1) - end, - desc = 'Prev Reference', - mode = { 'n' }, - }, + { 'g', function() Snacks.lazygit() end, desc = 'Lazygit' }, + { 'gf', function() Snacks.lazygit.log_file() end, desc = 'Lazygit Current File History' }, + { 'gl', function() Snacks.lazygit.log() end, desc = 'Lazygit Log (cwd)' }, + { 'm', function() Snacks.words.jump(vim.v.count1) end, desc = 'Next Reference', mode = { 'n' } }, + { '', function() Snacks.words.jump(-vim.v.count1) end, desc = 'Prev Reference', mode = { 'n' } }, -- Top Pickers & Explorer - { - '', - function() - Snacks.picker.smart() - end, - desc = 'Smart Find Files', - }, - { - 'b', - function() - Snacks.picker.buffers() - end, - desc = 'Buffers', - }, - { - 'l', - function() - Snacks.picker.grep() - end, - desc = 'Grep', - }, - { - ':', - function() - Snacks.picker.command_history() - end, - desc = 'Command History', - }, - { - 'n', - function() - Snacks.picker.notifications() - end, - desc = 'Notification History', - }, - { - 'e', - function() - Snacks.explorer() - end, - desc = 'File Explorer', - }, + { '', function() Snacks.picker.smart() end, desc = 'Smart Find Files' }, + { 'b', function() Snacks.picker.buffers() end, desc = 'Buffers' }, + { 'l', function() Snacks.picker.grep() end, desc = 'Grep' }, + { ':', function() Snacks.picker.command_history() end, desc = 'Command History' }, + { 'n', function() Snacks.picker.notifications() end, desc = 'Notification History' }, + { 'e', function() Snacks.explorer() end, desc = 'File Explorer' }, -- find -- { "fb", function() Snacks.picker.buffers() end, desc = "Buffers" }, -- { "f", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" }, - { - 'f', - function() - Snacks.picker.files() - end, - desc = 'Find Files', - }, - { - 'g', - function() - Snacks.picker.git_files() - end, - desc = 'Find Git Files', - }, - { - 'p', - function() - Snacks.picker.projects() - end, - desc = 'Projects', - }, - { - 'o', - function() - Snacks.picker.recent() - end, - desc = 'Recent', - }, - { - 'i', - function() - Snacks.picker.recent({ filter = { cwd = true } }) - end, - desc = 'Recent in cwd', - }, + { 'f', function() Snacks.picker.files() end, desc = 'Find Files' }, + { 'g', function() Snacks.picker.git_files() end, desc = 'Find Git Files' }, + { 'p', function() Snacks.picker.projects() end, desc = 'Projects' }, + { 'o', function() Snacks.picker.recent() end, desc = 'Recent' }, + { 'i', function() Snacks.picker.recent({ filter = { cwd = true } }) end, desc = 'Recent in cwd' }, -- git - { - 'nb', - function() - Snacks.picker.git_branches() - end, - desc = 'Git Branches', - }, - { - 'nl', - function() - Snacks.picker.git_log() - end, - desc = 'Git Log', - }, - { - 'nL', - function() - Snacks.picker.git_log_line() - end, - desc = 'Git Log Line', - }, - { - 'ns', - function() - Snacks.picker.git_status() - end, - desc = 'Git Status', - }, - { - 'nS', - function() - Snacks.picker.git_stash() - end, - desc = 'Git Stash', - }, - { - 'nd', - function() - Snacks.picker.git_diff() - end, - desc = 'Git Diff (Hunks)', - }, - { - 'nf', - function() - Snacks.picker.git_log_file() - end, - desc = 'Git Log File', - }, + { 'nb', function() Snacks.picker.git_branches() end, desc = 'Git Branches' }, + { 'nl', function() Snacks.picker.git_log() end, desc = 'Git Log' }, + { 'nL', function() Snacks.picker.git_log_line() end, desc = 'Git Log Line' }, + { 'ns', function() Snacks.picker.git_status() end, desc = 'Git Status' }, + { 'nS', function() Snacks.picker.git_stash() end, desc = 'Git Stash' }, + { 'nd', function() Snacks.picker.git_diff() end, desc = 'Git Diff (Hunks)' }, + { 'nf', function() Snacks.picker.git_log_file() end, desc = 'Git Log File' }, -- Grep - { - 'sb', - function() - Snacks.picker.lines() - end, - desc = 'Buffer Lines', - }, - { - 'sB', - function() - Snacks.picker.grep_buffers() - end, - desc = 'Grep Open Buffers', - }, + { 'sb', function() Snacks.picker.lines() end, desc = 'Buffer Lines' }, + { 'sB', function() Snacks.picker.grep_buffers() end, desc = 'Grep Open Buffers' }, -- { "sg", function() Snacks.picker.grep() end, desc = "Grep" }, - { - 'd', - function() - Snacks.picker.grep_word() - end, - desc = 'Visual selection or word', - mode = { 'n', 'x' }, - }, + { 'd', function() Snacks.picker.grep_word() end, desc = 'Visual selection or word', mode = { 'n', 'x' } }, -- search -- { 's"', function() Snacks.picker.registers() end, desc = "Registers" }, -- { 's/', function() Snacks.picker.search_history() end, desc = "Search History" }, @@ -262,149 +103,28 @@ return { -- { "sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" }, -- { "sc", function() Snacks.picker.command_history() end, desc = "Command History" }, -- { "sC", function() Snacks.picker.commands() end, desc = "Commands" }, - -- { "v", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" }, - { - 'V', - function() - Snacks.picker.diagnostics_buffer() - end, - desc = 'Buffer Diagnostics', - }, - { - 'sh', - function() - Snacks.picker.help() - end, - desc = 'Help Pages', - }, - { - 'sH', - function() - Snacks.picker.highlights() - end, - desc = 'Highlights', - }, - { - 'si', - function() - Snacks.picker.icons() - end, - desc = 'Icons', - }, - { - 'j', - function() - Snacks.picker.jumps() - end, - desc = 'Jumps', - }, - { - 'sk', - function() - Snacks.picker.keymaps() - end, - desc = 'Keymaps', - }, - { - 'sl', - function() - Snacks.picker.loclist() - end, - desc = 'Location List', - }, - { - 'sm', - function() - Snacks.picker.marks() - end, - desc = 'Marks', - }, - { - 'sM', - function() - Snacks.picker.man() - end, - desc = 'Man Pages', - }, - { - 'sp', - function() - Snacks.picker.lazy() - end, - desc = 'Search for Plugin Spec', - }, - { - 'sq', - function() - Snacks.picker.qflist() - end, - desc = 'Quickfix List', - }, - { - 'sR', - function() - Snacks.picker.resume() - end, - desc = 'Resume', - }, - { - 'su', - function() - Snacks.picker.undo() - end, - desc = 'Undo History', - }, + { 'v', function() Snacks.picker.diagnostics() end, desc = 'Diagnostics' }, + { 'V', function() Snacks.picker.diagnostics_buffer() end, desc = 'Buffer Diagnostics' }, + { 'sh', function() Snacks.picker.help() end, desc = 'Help Pages' }, + { 'sH', function() Snacks.picker.highlights() end, desc = 'Highlights' }, + { 'si', function() Snacks.picker.icons() end, desc = 'Icons' }, + { 'j', function() Snacks.picker.jumps() end, desc = 'Jumps' }, + { 'sk', function() Snacks.picker.keymaps() end, desc = 'Keymaps' }, + { 'sl', function() Snacks.picker.loclist() end, desc = 'Location List' }, + { 'sm', function() Snacks.picker.marks() end, desc = 'Marks' }, + { 'sM', function() Snacks.picker.man() end, desc = 'Man Pages' }, + { 'sp', function() Snacks.picker.lazy() end, desc = 'Search for Plugin Spec' }, + { 'sq', function() Snacks.picker.qflist() end, desc = 'Quickfix List' }, + { 'sR', function() Snacks.picker.resume() end, desc = 'Resume' }, + { 'su', function() Snacks.picker.undo() end, desc = 'Undo History' }, -- { "uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" }, -- LSP - { - 'd', - function() - Snacks.picker.lsp_definitions() - end, - desc = 'Goto Definition', - }, - { - 'D', - function() - Snacks.picker.lsp_declarations() - end, - desc = 'Goto Declaration', - }, - { - 'r', - function() - Snacks.picker.lsp_references() - end, - nowait = true, - desc = 'References', - }, - { - 'I', - function() - Snacks.picker.lsp_implementations() - end, - desc = 'Goto Implementation', - }, - { - 'e', - function() - Snacks.picker.lsp_type_definitions() - end, - desc = 'Goto T[y]pe Definition', - }, - { - '', - function() - Snacks.picker.lsp_symbols() - end, - desc = 'LSP Symbols', - }, - { - 'sS', - function() - Snacks.picker.lsp_workspace_symbols() - end, - desc = 'LSP Workspace Symbols', - }, + { 'd', function() Snacks.picker.lsp_definitions() end, desc = 'Goto Definition' }, + { 'D', function() Snacks.picker.lsp_declarations() end, desc = 'Goto Declaration' }, + { 'r', function() Snacks.picker.lsp_references() end, nowait = true, desc = 'References' }, + { 'I', function() Snacks.picker.lsp_implementations() end, desc = 'Goto Implementation' }, + { 'e', function() Snacks.picker.lsp_type_definitions() end, desc = 'Goto T[y]pe Definition' }, + { '', function() Snacks.picker.lsp_symbols() end, desc = 'LSP Symbols' }, + { 'sS', function() Snacks.picker.lsp_workspace_symbols() end, desc = 'LSP Workspace Symbols' }, }, } diff --git a/lua/plugins/toggleterm.lua b/lua/plugins/toggleterm.lua index 3f38743..6cdbb60 100644 --- a/lua/plugins/toggleterm.lua +++ b/lua/plugins/toggleterm.lua @@ -23,9 +23,7 @@ return { local lazygit = Terminal:new({ cmd = 'lazygit', direction = 'float', - cwd = function() - return vim.fn.getcwd() - end, + cwd = function() return vim.fn.getcwd() end, float_opts = { border = 'double', }, @@ -35,9 +33,7 @@ return { vim.api.nvim_buf_set_keymap(term.bufnr, 'n', 'q', 'close', { noremap = true, silent = true }) end, -- function to run on closing the terminal - on_close = function(term) - vim.cmd('startinsert!') - end, + on_close = function(term) vim.cmd('startinsert!') end, }) lazygit:open() end diff --git a/lua/plugins/workspaces.lua b/lua/plugins/workspaces.lua deleted file mode 100644 index 9ff8cf0..0000000 --- a/lua/plugins/workspaces.lua +++ /dev/null @@ -1,45 +0,0 @@ -return { - 'natecraddock/workspaces.nvim', - config = function() - require('workspaces').setup() - end, - branch = 'master', - keys = { - { - 'p', - function() - local workspaces = require('workspaces') - local fzf_lua = require('fzf-lua') - fzf_lua.fzf_exec(function(cb) - local results = workspaces.get() - for _, e in ipairs(results) do - cb(e['name']) - end - cb() - end, { - actions = { - ['default'] = { - function(selected) - workspaces.open(selected[1]) - fzf_lua.git_files() - end, - }, - ['ctrl-d'] = { - function(selected) - workspaces.remove(selected[1]) - end, - fzf_lua.actions.resume, - }, - ['ctrl-a'] = { - function() - workspaces.add() - end, - fzf_lua.actions.resume, - }, - }, - }) - end, - }, - }, - enabled = false, -} diff --git a/lua/themes/gruvbox-baby.lua b/lua/themes/gruvbox-baby.lua index 7e2497b..6850639 100644 --- a/lua/themes/gruvbox-baby.lua +++ b/lua/themes/gruvbox-baby.lua @@ -2,8 +2,6 @@ return { 'luisiacc/gruvbox-baby', lazy = true, priority = 1000, -- make sure to load this before all the other start plugins - config = function() - vim.cmd('colorscheme gruvbox-baby') - end, + config = function() vim.cmd('colorscheme gruvbox-baby') end, enabled = true, } diff --git a/lua/utils/python_venv.lua b/lua/utils/python_venv.lua index d3090f2..866870b 100644 --- a/lua/utils/python_venv.lua +++ b/lua/utils/python_venv.lua @@ -110,9 +110,7 @@ end M.pick_venv = function() vim.ui.select(M.getPythonEnvs(), { prompt = 'Select python venv', - format_item = function(item) - return string.format('%s (%s)', item.name, item.path) - end, + format_item = function(item) return string.format('%s (%s)', item.name, item.path) end, }, function(choice) if not choice then return diff --git a/stylua.toml b/stylua.toml index 56619e8..251e8aa 100644 --- a/stylua.toml +++ b/stylua.toml @@ -4,3 +4,4 @@ indent_type = "Spaces" indent_width = 2 quote_style = "AutoPreferSingle" call_parentheses = "Always" +collapse_simple_statement = "FunctionOnly"