From ae5b5fd06bc7c5ae65e8cdb10163fba846a90c44 Mon Sep 17 00:00:00 2001 From: Oliver Hartmann Date: Thu, 6 Jun 2024 23:56:11 +0200 Subject: [PATCH] format with stylua --- lua/config/lazy.lua | 54 +-- lua/config/options.lua | 34 +- lua/my_autocommands.lua | 9 +- lua/my_keymappings.lua | 18 +- .../template/user/clang/clang-tidy.lua | 11 +- lua/overseer/template/user/cmake/build.lua | 14 +- lua/overseer/template/user/cmake/clean.lua | 10 +- lua/overseer/template/user/cmake/cmake.lua | 9 +- .../template/user/cmake/configure.lua | 10 +- lua/plugins/aerial.lua | 46 +- lua/plugins/cmake-tools.lua | 74 +-- lua/plugins/cmp.lua | 37 +- lua/plugins/comment.lua | 42 +- lua/plugins/dap.lua | 449 +++++++++--------- lua/plugins/diffview.lua | 12 +- lua/plugins/dressing.lua | 6 +- lua/plugins/flash.lua | 68 +-- lua/plugins/fzf-lua.lua | 16 +- lua/plugins/gitsigns.lua | 2 +- lua/plugins/indent_blankline.lua | 10 +- lua/plugins/init.lua | 3 +- lua/plugins/lazydev.lua | 4 +- lua/plugins/lspconfig.lua | 187 +++----- lua/plugins/lualine.lua | 38 +- lua/plugins/luasnip-snippets.lua | 2 +- lua/plugins/luasnip.lua | 75 ++- lua/plugins/markdown-preview.lua | 6 +- lua/plugins/neogen.lua | 68 +-- lua/plugins/neogit.lua | 54 +-- lua/plugins/neotest.lua | 78 +-- lua/plugins/nvim-highlight-colors.lua | 2 +- lua/plugins/nvim-lint.lua | 4 +- lua/plugins/nvim-rooter.lua | 8 +- lua/plugins/nvim-surround.lua | 4 +- lua/plugins/oil.lua | 4 +- lua/plugins/overseer.lua | 4 +- lua/plugins/pretty_hover.lua | 10 +- lua/plugins/rainbow-delimiters.lua | 10 +- lua/plugins/rustaceanvim.lua | 17 +- lua/plugins/toggleterm.lua | 8 +- lua/plugins/treesitter.lua | 110 ++--- lua/plugins/which-key.lua | 26 +- lua/plugins/workspaces.lua | 89 ++-- lua/themes/astrodark.lua | 21 +- lua/themes/bamboo.lua | 6 +- lua/themes/catppuccin.lua | 7 +- lua/themes/everforest.lua | 2 +- lua/themes/github-theme.lua | 7 +- lua/themes/gruvbox-baby.lua | 2 +- lua/themes/gruvbox.lua | 2 +- lua/themes/gruvbox_flat.lua | 38 +- lua/themes/gruvbox_material.lua | 84 ++-- lua/themes/kanagawa.lua | 10 +- lua/themes/material.lua | 38 +- lua/themes/monokai-pro.lua | 6 +- lua/utils/python_venv.lua | 16 +- stylua.toml | 2 +- 57 files changed, 994 insertions(+), 989 deletions(-) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index ffca987..bf487ae 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -1,27 +1,27 @@ -local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - 'git', - 'clone', - '--filter=blob:none', - 'https://github.com/folke/lazy.nvim.git', - '--branch=stable', -- latest stable release - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - -require('lazy').setup({ - defaults = { - version = '', - }, - spec = { - { import = 'plugins' }, - { import = 'themes' } - }, - change_detection = { - -- automatically check for config file changes and reload the ui - enabled = true, - notify = false, -- get a notification when changes are found - }, -}) +local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/folke/lazy.nvim.git', + '--branch=stable', -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require('lazy').setup({ + defaults = { + version = '', + }, + spec = { + { import = 'plugins' }, + { import = 'themes' }, + }, + change_detection = { + -- automatically check for config file changes and reload the ui + enabled = true, + notify = false, -- get a notification when changes are found + }, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua index 4cf8b72..004ad91 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -3,24 +3,24 @@ vim.cmd('language en_US.utf-8') local opt = vim.opt local indent = 2 -opt.termguicolors = true -- Enable colors in terminal -opt.hlsearch = true --Set highlight on search -opt.number = true --Make line numbers default +opt.termguicolors = true -- Enable colors in terminal +opt.hlsearch = true --Set highlight on search +opt.number = true --Make line numbers default opt.relativenumber = false --Make relative number default -opt.mouse = 'a' --Enable mouse mode -opt.breakindent = true --Enable break indent -opt.undofile = true --Save undo history -opt.ignorecase = true --Case insensitive searching unless /C or capital in search -opt.smartcase = true -- Smart case -opt.updatetime = 300 --Decrease update time -opt.signcolumn = 'yes' -- Always show sign column -opt.timeoutlen = 300 -- Time in milliseconds to wait for a mapped sequence to complete. +opt.mouse = 'a' --Enable mouse mode +opt.breakindent = true --Enable break indent +opt.undofile = true --Save undo history +opt.ignorecase = true --Case insensitive searching unless /C or capital in search +opt.smartcase = true -- Smart case +opt.updatetime = 300 --Decrease update time +opt.signcolumn = 'yes' -- Always show sign column +opt.timeoutlen = 300 -- Time in milliseconds to wait for a mapped sequence to complete. opt.ttimeoutlen = 10 -opt.showmode = false -- Do not need to show the mode. We use the statusline instead. -opt.scrolloff = 999 -- Lines of context -opt.joinspaces = false -- No double spaces with join after a dot -opt.showmatch = true -- Show matching braces -opt.wrap = true -- When on, lines longer than the width of the window will wrap and displaying continues on the next line +opt.showmode = false -- Do not need to show the mode. We use the statusline instead. +opt.scrolloff = 999 -- Lines of context +opt.joinspaces = false -- No double spaces with join after a dot +opt.showmatch = true -- Show matching braces +opt.wrap = true -- When on, lines longer than the width of the window will wrap and displaying continues on the next line opt.list = true opt.hidden = true opt.scrolloff = 4 @@ -90,7 +90,7 @@ opt.completeopt = 'menu,menuone,noselect' opt.expandtab = true opt.smartindent = true opt.title = true -opt.titlestring = '%(%{fnamemodify(getcwd(),\":t\")}%) Neovim' +opt.titlestring = '%(%{fnamemodify(getcwd(),":t")}%) Neovim' opt.laststatus = 3 -- for lualine opt.background = 'dark' diff --git a/lua/my_autocommands.lua b/lua/my_autocommands.lua index 00ed704..6479dc2 100644 --- a/lua/my_autocommands.lua +++ b/lua/my_autocommands.lua @@ -78,16 +78,11 @@ vim.api.nvim_create_autocmd('BufReadPost', { end, }) - -- Check if we need to reload the file when it changed -api.nvim_create_autocmd({ 'FocusGained', 'BufEnter' }, - { command = [[if !bufexists("[Command Line]") | checktime | endif]] }) +api.nvim_create_autocmd({ 'FocusGained', 'BufEnter' }, { command = [[if !bufexists("[Command Line]") | checktime | endif]] }) -- windows to close with "q" -api.nvim_create_autocmd( - 'FileType', - { pattern = { 'help', 'startuptime', 'qf', 'lspinfo' }, command = [[nnoremap q :close]] } -) +api.nvim_create_autocmd('FileType', { pattern = { 'help', 'startuptime', 'qf', 'lspinfo' }, command = [[nnoremap q :close]] }) api.nvim_create_autocmd('FileType', { pattern = 'man', command = [[nnoremap q :quit]] }) -- don't auto comment new line diff --git a/lua/my_keymappings.lua b/lua/my_keymappings.lua index 8033187..6e47120 100644 --- a/lua/my_keymappings.lua +++ b/lua/my_keymappings.lua @@ -53,7 +53,6 @@ vim.keymap.set('x', "'", 'y/\\V"N', { noremap = true, silent = true, de vim.keymap.set('n', 'x', 'za', { desc = 'Toggle fold' }) - vim.keymap.set({ 'n', 'x' }, 'y', '"+y', { desc = 'Copy from system clipboard' }) vim.keymap.set({ 'n', 'x' }, 'Y', '"+yg_', { desc = 'Copy from system clipboard' }) vim.keymap.set({ 'n', 'x' }, 'p', '"+p', { desc = 'Paste from system clipboard' }) @@ -68,9 +67,16 @@ 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/overseer/template/user/clang/clang-tidy.lua b/lua/overseer/template/user/clang/clang-tidy.lua index b475fc0..0590f4c 100644 --- a/lua/overseer/template/user/clang/clang-tidy.lua +++ b/lua/overseer/template/user/clang/clang-tidy.lua @@ -10,11 +10,12 @@ return { args = { file, '-p', 'build_nvim', '--quiet', '--config-file', dir .. '/.clang-tidy' }, cwd = dir, components = { - { 'on_result_diagnostics_quickfix', open = false}, - { 'on_output_parse', problem_matcher = '$gcc' }, - { 'on_result_diagnostics', remove_on_restart = true }, - { 'restart_on_save'}, - 'default' }, + { 'on_result_diagnostics_quickfix', open = false }, + { 'on_output_parse', problem_matcher = '$gcc' }, + { 'on_result_diagnostics', remove_on_restart = true }, + { 'restart_on_save' }, + 'default', + }, } end, condition = { diff --git a/lua/overseer/template/user/cmake/build.lua b/lua/overseer/template/user/cmake/build.lua index a62f2d6..c51413d 100644 --- a/lua/overseer/template/user/cmake/build.lua +++ b/lua/overseer/template/user/cmake/build.lua @@ -1,26 +1,22 @@ - return { name = 'CMake Build for nvim', builder = function() return { cmd = { 'cmake' }, - args = { '--build', '.', - '--', '-j8' }, + args = { '--build', '.', '--', '-j8' }, cwd = 'build_nvim', -- components = {"on_output_parse", problem_matcher = "$gcc"} -- components = {'on_output_quickfix', set_diagnostics = true, open = true} - components = { { "on_output_quickfix", open = true, open_on_match = true }, - { 'on_output_parse', problem_matcher = '$gcc' }, - 'default' }, + components = { { 'on_output_quickfix', open = true, open_on_match = true }, { 'on_output_parse', problem_matcher = '$gcc' }, 'default' }, } end, condition = { callback = function(opts) - if vim.fn.executable("cmake") == 0 then + if vim.fn.executable('cmake') == 0 then return false, 'Command "cmake" not found' end - if vim.fn.findfile("CMakeLists.txt", opts.dir .. ";") == "" then - return false, "No CMakeLists.txt found" + if vim.fn.findfile('CMakeLists.txt', opts.dir .. ';') == '' then + return false, 'No CMakeLists.txt found' end return true end, diff --git a/lua/overseer/template/user/cmake/clean.lua b/lua/overseer/template/user/cmake/clean.lua index 5b8a28d..507eff9 100644 --- a/lua/overseer/template/user/cmake/clean.lua +++ b/lua/overseer/template/user/cmake/clean.lua @@ -1,21 +1,19 @@ - return { name = 'CMake Clean for nvim', builder = function() return { cmd = { 'cmake' }, - args = { '--build', '.', - '-t', 'clean' }, + args = { '--build', '.', '-t', 'clean' }, cwd = 'build_nvim', } end, condition = { callback = function(opts) - if vim.fn.executable("cmake") == 0 then + if vim.fn.executable('cmake') == 0 then return false, 'Command "cmake" not found' end - if vim.fn.findfile("CMakeLists.txt", opts.dir .. ";") == "" then - return false, "No CMakeLists.txt found" + if vim.fn.findfile('CMakeLists.txt', opts.dir .. ';') == '' then + return false, 'No CMakeLists.txt found' end return true end, diff --git a/lua/overseer/template/user/cmake/cmake.lua b/lua/overseer/template/user/cmake/cmake.lua index c970b46..47f8e61 100644 --- a/lua/overseer/template/user/cmake/cmake.lua +++ b/lua/overseer/template/user/cmake/cmake.lua @@ -1,6 +1,7 @@ return { -'builtin', -'user.cmake.configure', -'user.cmake.build', -'user.cmake.clean'} + 'builtin', + 'user.cmake.configure', + 'user.cmake.build', + 'user.cmake.clean', +} -- https://gitlab.com/ranjithshegde/dotbare/-/tree/master/.config/nvim/lua/overseer diff --git a/lua/overseer/template/user/cmake/configure.lua b/lua/overseer/template/user/cmake/configure.lua index 6075f5c..1c9808a 100644 --- a/lua/overseer/template/user/cmake/configure.lua +++ b/lua/overseer/template/user/cmake/configure.lua @@ -4,19 +4,17 @@ return { local cwd = vim.fn.getcwd() return { cmd = { 'cmake' }, - args = { '-B', 'build_nvim', - '-S', cwd, - '-G', 'Ninja' }, + args = { '-B', 'build_nvim', '-S', cwd, '-G', 'Ninja' }, cwd = build_nvim, } end, condition = { callback = function(opts) - if vim.fn.executable("cmake") == 0 then + if vim.fn.executable('cmake') == 0 then return false, 'Command "cmake" not found' end - if vim.fn.findfile("CMakeLists.txt", opts.dir .. ";") == "" then - return false, "No CMakeLists.txt found" + if vim.fn.findfile('CMakeLists.txt', opts.dir .. ';') == '' then + return false, 'No CMakeLists.txt found' end return true end, diff --git a/lua/plugins/aerial.lua b/lua/plugins/aerial.lua index b265195..bbeeaa7 100644 --- a/lua/plugins/aerial.lua +++ b/lua/plugins/aerial.lua @@ -1,23 +1,23 @@ -return { - 'stevearc/aerial.nvim', - config = function() - require('aerial').setup({ - backends = { 'lsp', 'treesitter', 'markdown' }, - layout = { - default_direction = 'prefer_left' - }, - filter_kind = false, - show_guides = true, - }) - end, - cmd = 'AerialToggle', - keys = { - { - 's', - function() - require('aerial').toggle() - end, - desc = 'Symbols outline', - } - } -} +return { + 'stevearc/aerial.nvim', + config = function() + require('aerial').setup({ + backends = { 'lsp', 'treesitter', 'markdown' }, + layout = { + default_direction = 'prefer_left', + }, + filter_kind = false, + show_guides = true, + }) + end, + cmd = 'AerialToggle', + keys = { + { + 's', + function() + require('aerial').toggle() + end, + desc = 'Symbols outline', + }, + }, +} diff --git a/lua/plugins/cmake-tools.lua b/lua/plugins/cmake-tools.lua index e942a2b..81aabfa 100644 --- a/lua/plugins/cmake-tools.lua +++ b/lua/plugins/cmake-tools.lua @@ -1,37 +1,37 @@ -return { - 'Civitasv/cmake-tools.nvim', - opts = { - cmake_command = 'cmake', - cmake_generate_options = { '-D', 'CMAKE_EXPORT_COMPILE_COMMANDS=1', '-G', 'Ninja' }, - cmake_show_console = 'always', - cmake_build_directory = 'build_nvim', - cmake_dap_configuration = { name = 'cpp', type = 'codelldb', request = 'launch' }, -- dap configuration, optional - }, - cmd = { - 'CMakeGenerate', - 'CMakeBuild', - 'CMakeRun', - 'CMakeDebug', - 'CMakeSelectBuildType', - 'CMakeSelectBuildTarget', - 'CMakeSelectLaunchTarget', - 'CMakeSelectKit', - 'CMakeSelectConfigurePreset', - 'CMakeSelectBuildPreset', - 'CMakeSelectLaunchTarget', - 'CMakeOpen', - 'CMakeClose', - 'CMakeInstall', - 'CMakeClean', - 'CMakeStop', - }, - keys = { - { - '', - function() - require('cmake-tools').debug({}) - end, - desc = 'Run and debug target from cmake' - } - } -} +return { + 'Civitasv/cmake-tools.nvim', + opts = { + cmake_command = 'cmake', + cmake_generate_options = { '-D', 'CMAKE_EXPORT_COMPILE_COMMANDS=1', '-G', 'Ninja' }, + cmake_show_console = 'always', + cmake_build_directory = 'build_nvim', + cmake_dap_configuration = { name = 'cpp', type = 'codelldb', request = 'launch' }, -- dap configuration, optional + }, + cmd = { + 'CMakeGenerate', + 'CMakeBuild', + 'CMakeRun', + 'CMakeDebug', + 'CMakeSelectBuildType', + 'CMakeSelectBuildTarget', + 'CMakeSelectLaunchTarget', + 'CMakeSelectKit', + 'CMakeSelectConfigurePreset', + 'CMakeSelectBuildPreset', + 'CMakeSelectLaunchTarget', + 'CMakeOpen', + 'CMakeClose', + 'CMakeInstall', + 'CMakeClean', + 'CMakeStop', + }, + keys = { + { + '', + 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 31dc365..59b27d8 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -70,18 +70,19 @@ return { else fallback() end - end, { 'i', 's', }), - [''] = cmp.mapping(cmp.mapping.complete( - { + end, { 'i', 's' }), + [''] = cmp.mapping( + cmp.mapping.complete({ config = { sources = { { - name = 'cmdline_history' - } - } - } - } - ), { 'c' }), + name = 'cmdline_history', + }, + }, + }, + }), + { 'c' } + ), }, snippet = { expand = function(args) @@ -89,15 +90,15 @@ return { end, }, sources = { - { name = 'neorg', priority = 8 }, + { name = 'neorg', priority = 8 }, { name = 'luasnip', priority = 8 }, { name = 'nvim_lsp', option = { markdown_oxide = { - keyword_pattern = [[\(\k\| \|\/\|#\)\+]] - } - } + keyword_pattern = [[\(\k\| \|\/\|#\)\+]], + }, + }, }, { name = 'nvim_lsp_signature_help', priority = 7 }, -- { name = 'treesitter', priority = 6 }, @@ -111,8 +112,8 @@ return { bufs[vim.api.nvim_win_get_buf(win)] = true end return vim.tbl_keys(bufs) - end - } + end, + }, }, -- { name = 'nvim_lua' }, -- { name = 'look' }, @@ -124,9 +125,9 @@ return { }, enabled = function() return vim.api.nvim_buf_get_option(0, 'buftype') ~= 'prompt' - or vim.api.nvim_buf_get_option(0, 'filetype') == 'dap-repl' - or vim.api.nvim_buf_get_option(0, 'filetype') == 'dapui_watches' - or vim.api.nvim_buf_get_option(0, 'filetype') == 'dapui_hover' + or vim.api.nvim_buf_get_option(0, 'filetype') == 'dap-repl' + or vim.api.nvim_buf_get_option(0, 'filetype') == 'dapui_watches' + or vim.api.nvim_buf_get_option(0, 'filetype') == 'dapui_hover' end, -- completion = { -- completeopt = 'menu,menuone,noinsert, noselect', diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua index 92acae7..2054015 100644 --- a/lua/plugins/comment.lua +++ b/lua/plugins/comment.lua @@ -1,21 +1,21 @@ -return { - 'numToStr/Comment.nvim', - version = '*', - opts = { - mappings = false, - }, - keys = { - { - '', - '(comment_toggle_linewise_current)', - desc = 'Toggle comment' - }, - - { - '', - '(comment_toggle_linewise_visual)gv', - mode = 'v', - desc = 'Toggle comment' - } - } -} +return { + 'numToStr/Comment.nvim', + version = '*', + opts = { + mappings = false, + }, + keys = { + { + '', + '(comment_toggle_linewise_current)', + desc = 'Toggle comment', + }, + + { + '', + '(comment_toggle_linewise_visual)gv', + mode = 'v', + desc = 'Toggle comment', + }, + }, +} diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index d07dbbf..a34462e 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,225 +1,224 @@ -return { - 'mfussenegger/nvim-dap', - dependencies = { - 'mfussenegger/nvim-dap-python', - 'theHamsta/nvim-dap-virtual-text', - { - 'rcarriga/nvim-dap-ui', - dependencies = { - 'nvim-neotest/nvim-nio' - } - }, - 'rcarriga/cmp-dap', - }, - keys = { - { - '', - function() - require('dap').continue() - end, - desc = 'DAP start or continue' - }, - { - '', - function() - require('dap').run_last() - end, - desc = 'DAP run last' - }, - { - '', - function() - loadConfigs() - end, - desc = 'DAP configs' - }, - { - '', - 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') - vim.fn.sign_define('DapBreakpoint', { text = '🛑', texthl = '', linehl = '', numhl = '' }) - require('cmp_dap').is_dap_buffer() - - - -- make sure we can exit the terminal with esc - vim.api.nvim_create_autocmd({ 'TermOpen' }, { - pattern = { '*dap-terminal*' }, - callback = function() - local opts = { noremap = true } - vim.api.nvim_buf_set_keymap(0, 't', '', [[]], opts) - end - }) - - local pythonVenv = require('utils.python_venv') - - function loadConfigs() - require('dap.ext.vscode').load_launchjs() - -- Make sure we use the correct python env even for the configs from launch.json - for _, config in pairs(dap.configurations.python) do - config.pythonPath = pythonVenv.getPythonEnv() - config.cwd = vim.fn.getcwd() - end - require('fzf-lua').dap_configurations() - end - - local masonpath = vim.fn.stdpath('data') .. '/mason' - - -- PYTHON - dap.adapters.python = { - type = 'executable', - command = 'python', - args = { '-m', 'debugpy.adapter' }, - options = { - detached = true, - }, - } - - local dapui = require('dapui') - dapui.setup() - dap.listeners.after.event_initialized['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.configurations.python = { - { - type = 'python', - request = 'launch', - name = 'Launch file with venv', - justMyCode = false, - program = '${file}', - cwd = vim.fn.getcwd(), - pythonPath = pythonVenv.getPythonEnv - }, - } - - -- require('dap-python').setup('C:\\Users\\oli\\AppData\\Local\\nvim\\venv_debugpy\\Scripts\\python') - -- table.insert(require('dap').configurations.python, { - -- -- type = 'python', - -- -- request = 'launch', - -- -- name = 'My custom launch configuration', - -- -- program = '${file}', - -- justMyCode = false - -- -- ... more options, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings - -- }) - -- require('dap-python').setup('C:/Users/oli/AppData/Local/nvim-data/mason/packages/debugpy/venv/Scripts/python.exe') - - -- CPP - dap.adapters.codelldb = { - type = 'server', - port = '${port}', - executable = { - command = require 'mason-core.path'.bin_prefix 'codelldb', - args = { '--port', '${port}' }, - - -- On windows you may have to uncomment this: - detached = false, - } - } - - dap.adapters.cppdbg = { - id = 'cppdbg', - type = 'executable', - command = masonpath .. '/bin/OpenDebugAD7', - } - - dap.adapters.lldb = { - type = 'executable', - command = function() - if vim.loop.os_uname().sysname == 'Linux' then - return 'lldb-vscode' - else - return os.getenv('SCOOP') .. '/apps/llvm/current/bin/lldb-vscode.exe' - end - end, - name = 'lldb' - } - - dap.configurations.cpp = { - { - name = 'Launch codelldb', - type = 'codelldb', - request = 'launch', - program = function() - return vim.fn.input({ 'Path to executable: ', vim.fn.getcwd() .. '/build_nvim/', 'file' }) - end, - cwd = '${workspaceFolder}', - stopOnEntry = false, - }, - { - name = 'Launch lldb', - type = 'lldb', - request = 'launch', - program = function() - return vim.fn.input({ 'Path to executable: ', vim.fn.getcwd() .. '/build_nvim', 'file' }) - end, - cwd = '${workspaceFolder}', - stopOnEntry = false, - args = {}, - - -- 💀 - -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: - -- - -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope - -- - -- Otherwise you might get the following error: - -- - -- Error on launch: Failed to attach to the target process - -- - -- But you should be aware of the implications: - -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html - -- runInTerminal = false, - }, - } - - -- EXTENSIONS - - require('nvim-dap-virtual-text').setup({}) - end, -} +return { + 'mfussenegger/nvim-dap', + dependencies = { + 'mfussenegger/nvim-dap-python', + 'theHamsta/nvim-dap-virtual-text', + { + 'rcarriga/nvim-dap-ui', + dependencies = { + 'nvim-neotest/nvim-nio', + }, + }, + 'rcarriga/cmp-dap', + }, + keys = { + { + '', + function() + require('dap').continue() + end, + desc = 'DAP start or continue', + }, + { + '', + function() + require('dap').run_last() + end, + desc = 'DAP run last', + }, + { + '', + function() + loadConfigs() + end, + desc = 'DAP configs', + }, + { + '', + 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') + vim.fn.sign_define('DapBreakpoint', { text = '🛑', texthl = '', linehl = '', numhl = '' }) + require('cmp_dap').is_dap_buffer() + + -- make sure we can exit the terminal with esc + vim.api.nvim_create_autocmd({ 'TermOpen' }, { + pattern = { '*dap-terminal*' }, + callback = function() + local opts = { noremap = true } + vim.api.nvim_buf_set_keymap(0, 't', '', [[]], opts) + end, + }) + + local pythonVenv = require('utils.python_venv') + + function loadConfigs() + require('dap.ext.vscode').load_launchjs() + -- Make sure we use the correct python env even for the configs from launch.json + for _, config in pairs(dap.configurations.python) do + config.pythonPath = pythonVenv.getPythonEnv() + config.cwd = vim.fn.getcwd() + end + require('fzf-lua').dap_configurations() + end + + local masonpath = vim.fn.stdpath('data') .. '/mason' + + -- PYTHON + dap.adapters.python = { + type = 'executable', + command = 'python', + args = { '-m', 'debugpy.adapter' }, + options = { + detached = true, + }, + } + + local dapui = require('dapui') + dapui.setup() + dap.listeners.after.event_initialized['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.configurations.python = { + { + type = 'python', + request = 'launch', + name = 'Launch file with venv', + justMyCode = false, + program = '${file}', + cwd = vim.fn.getcwd(), + pythonPath = pythonVenv.getPythonEnv, + }, + } + + -- require('dap-python').setup('C:\\Users\\oli\\AppData\\Local\\nvim\\venv_debugpy\\Scripts\\python') + -- table.insert(require('dap').configurations.python, { + -- -- type = 'python', + -- -- request = 'launch', + -- -- name = 'My custom launch configuration', + -- -- program = '${file}', + -- justMyCode = false + -- -- ... more options, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings + -- }) + -- require('dap-python').setup('C:/Users/oli/AppData/Local/nvim-data/mason/packages/debugpy/venv/Scripts/python.exe') + + -- CPP + dap.adapters.codelldb = { + type = 'server', + port = '${port}', + executable = { + command = require('mason-core.path').bin_prefix('codelldb'), + args = { '--port', '${port}' }, + + -- On windows you may have to uncomment this: + detached = false, + }, + } + + dap.adapters.cppdbg = { + id = 'cppdbg', + type = 'executable', + command = masonpath .. '/bin/OpenDebugAD7', + } + + dap.adapters.lldb = { + type = 'executable', + command = function() + if vim.loop.os_uname().sysname == 'Linux' then + return 'lldb-vscode' + else + return os.getenv('SCOOP') .. '/apps/llvm/current/bin/lldb-vscode.exe' + end + end, + name = 'lldb', + } + + dap.configurations.cpp = { + { + name = 'Launch codelldb', + type = 'codelldb', + request = 'launch', + program = function() + return vim.fn.input({ 'Path to executable: ', vim.fn.getcwd() .. '/build_nvim/', 'file' }) + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + }, + { + name = 'Launch lldb', + type = 'lldb', + request = 'launch', + program = function() + return vim.fn.input({ 'Path to executable: ', vim.fn.getcwd() .. '/build_nvim', 'file' }) + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, + + -- 💀 + -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: + -- + -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + -- + -- Otherwise you might get the following error: + -- + -- Error on launch: Failed to attach to the target process + -- + -- But you should be aware of the implications: + -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html + -- runInTerminal = false, + }, + } + + -- EXTENSIONS + + require('nvim-dap-virtual-text').setup({}) + end, +} diff --git a/lua/plugins/diffview.lua b/lua/plugins/diffview.lua index 7b7ec41..9c91e75 100644 --- a/lua/plugins/diffview.lua +++ b/lua/plugins/diffview.lua @@ -1,20 +1,20 @@ return { 'sindrets/diffview.nvim', dependencies = { - 'nvim-lua/plenary.nvim' + 'nvim-lua/plenary.nvim', }, opts = { keymaps = { view = { - ['b'] = false + ['b'] = false, }, file_panel = { - ['b'] = false + ['b'] = false, }, file_history_panel = { - ['b'] = false + ['b'] = false, }, - } + }, }, cmd = 'DiffviewOpen', keys = { @@ -33,5 +33,5 @@ return { 'DiffviewOpen origin/master...', desc = 'Diffview vs master', }, - } + }, } diff --git a/lua/plugins/dressing.lua b/lua/plugins/dressing.lua index 43a9c6c..9984933 100644 --- a/lua/plugins/dressing.lua +++ b/lua/plugins/dressing.lua @@ -1,3 +1,3 @@ -return { - 'stevearc/dressing.nvim' -} +return { + 'stevearc/dressing.nvim', +} diff --git a/lua/plugins/flash.lua b/lua/plugins/flash.lua index c9138ca..a8ba660 100644 --- a/lua/plugins/flash.lua +++ b/lua/plugins/flash.lua @@ -1,34 +1,34 @@ -return { - 'folke/flash.nvim', - event = 'VeryLazy', - ---@type Flash.Config - opts = { - modes = { - search = { - enabled = false - }, - char = { - keys = { 'f', 'F', 't', 'T', ';' }, - } - } - }, - keys = { - { - 's', - mode = { 'n', 'x', 'o' }, - function() - -- default options: exact mode, multi window, all directions, with a backdrop - require('flash').jump() - end, - desc = 'Flash jump' - }, - { - 'S', - mode = { 'n', 'o', 'x' }, - function() - require('flash').treesitter() - end, - desc = 'Flash treesitter' - }, - }, -} +return { + 'folke/flash.nvim', + event = 'VeryLazy', + ---@type Flash.Config + opts = { + modes = { + search = { + enabled = false, + }, + char = { + keys = { 'f', 'F', 't', 'T', ';' }, + }, + }, + }, + keys = { + { + 's', + mode = { 'n', 'x', 'o' }, + function() + -- default options: exact mode, multi window, all directions, with a backdrop + require('flash').jump() + end, + desc = 'Flash jump', + }, + { + 'S', + mode = { 'n', 'o', 'x' }, + function() + require('flash').treesitter() + end, + desc = 'Flash treesitter', + }, + }, +} diff --git a/lua/plugins/fzf-lua.lua b/lua/plugins/fzf-lua.lua index 427e99d..b0fae48 100644 --- a/lua/plugins/fzf-lua.lua +++ b/lua/plugins/fzf-lua.lua @@ -2,7 +2,7 @@ return { 'ibhagwan/fzf-lua', dependencies = { 'nvim-tree/nvim-web-devicons' }, config = function() - local actions = require 'fzf-lua.actions' + local actions = require('fzf-lua.actions') require('fzf-lua').setup({ 'borderless_full', actions = { @@ -17,12 +17,12 @@ return { }, buffers = { ['default'] = actions.buf_edit, - ['ctrl-s'] = actions.buf_split, - ['ctrl-v'] = actions.buf_vsplit, - ['ctrl-t'] = actions.buf_tabedit, - ['ctrl-x'] = actions.buf_split - } - } + ['ctrl-s'] = actions.buf_split, + ['ctrl-v'] = actions.buf_vsplit, + ['ctrl-t'] = actions.buf_tabedit, + ['ctrl-x'] = actions.buf_split, + }, + }, }) end, cmd = 'FzfLua', @@ -121,5 +121,5 @@ return { mode = { 'n', 'v', 'i' }, desc = 'Fuzzy complete path', }, - } + }, } diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index 104dbe0..b5acb86 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -9,5 +9,5 @@ return { delay = 1000, ignore_whitespace = false, }, - } + }, } diff --git a/lua/plugins/indent_blankline.lua b/lua/plugins/indent_blankline.lua index c662f37..381ef90 100644 --- a/lua/plugins/indent_blankline.lua +++ b/lua/plugins/indent_blankline.lua @@ -21,7 +21,7 @@ return { 'RainbowCyan', } - local hooks = require 'ibl.hooks' + local hooks = require('ibl.hooks') -- create the highlight groups in the highlight setup hook, so they are reset -- every time the colorscheme changes hooks.register(hooks.type.HIGHLIGHT_SETUP, function() @@ -35,12 +35,12 @@ return { end) vim.g.rainbow_delimiters = { highlight = highlight } - require('ibl').setup { + require('ibl').setup({ scope = { highlight = highlight, - show_start = false - } - } + show_start = false, + }, + }) hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark) end, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 058678e..a564707 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,2 +1 @@ -return { -} +return {} diff --git a/lua/plugins/lazydev.lua b/lua/plugins/lazydev.lua index f3a7612..fad6d25 100644 --- a/lua/plugins/lazydev.lua +++ b/lua/plugins/lazydev.lua @@ -12,9 +12,9 @@ return { }, { 'Bilal2453/luvit-meta', - lazy = true + lazy = true, }, -- optional `vim.uv` typings - { -- optional completion source for require statements and module annotations + { -- optional completion source for require statements and module annotations 'hrsh7th/nvim-cmp', opts = function(_, opts) opts.sources = opts.sources or {} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index faafe59..d3a79d8 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -1,66 +1,49 @@ local lspKeys = function(client, bufnr) local fzf = require('fzf-lua') local options = { noremap = true, silent = false, buffer = bufnr } - vim.keymap.set('n', ',', vim.diagnostic.goto_prev, - vim.tbl_extend('error', options, { desc = 'Diag prev' })) - vim.keymap.set('n', ';', vim.diagnostic.goto_next, - vim.tbl_extend('error', options, { desc = 'Diag next' })) - vim.keymap.set({ 'n', 'x' }, 'a', vim.lsp.buf.code_action, - vim.tbl_extend('error', options, { desc = 'Code action' })) - vim.keymap.set('n', 'd', function() fzf.lsp_definitions({ jump_to_single_result = true }) end, - vim.tbl_extend('error', options, { desc = 'Definition' })) - vim.keymap.set('n', 'e', - vim.lsp.buf.declaration, vim.tbl_extend('error', options, { desc = 'Declaration' })) - vim.keymap.set('n', 'h', function() require('pretty_hover').hover() end, - vim.tbl_extend('error', options, { desc = 'Hover' })) - vim.keymap.set('n', 'c', vim.lsp.buf.outgoing_calls, - vim.tbl_extend('error', options, { desc = 'Outgoing calls' })) - vim.keymap.set('n', 'C', vim.lsp.buf.incoming_calls, - vim.tbl_extend('error', options, { desc = 'Incoming calls' })) - vim.keymap.set('n', 'm', vim.lsp.buf.rename, - vim.tbl_extend('error', options, { desc = 'Rename' })) - vim.keymap.set('n', '', fzf.lsp_live_workspace_symbols, - vim.tbl_extend('error', options, { desc = 'Workspace symbols' })) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, - vim.tbl_extend('error', options, { desc = 'Type definition' })) - vim.keymap.set({ 'n', 'i', 'x' }, '', vim.lsp.buf.signature_help, - vim.tbl_extend('error', options, { desc = 'Signature help' })) - vim.keymap.set('n', 'r', fzf.lsp_references, - vim.tbl_extend('error', options, { desc = 'References' })) - vim.keymap.set('n', '', fzf.lsp_document_symbols, - vim.tbl_extend('error', options, { desc = 'Document symbols' })) - vim.keymap.set('n', 's', fzf.lsp_live_workspace_symbols, - vim.tbl_extend('error', options, { desc = 'Workspace symbols' })) - vim.keymap.set('n', 'v', vim.diagnostic.open_float, - vim.tbl_extend('error', options, { desc = 'Diagnostics Float' })) - vim.keymap.set('n', 'V', fzf.diagnostics_document, - vim.tbl_extend('error', options, { desc = 'Diagnostics' })) - vim.keymap.set('n', '', 'ClangdSwitchSourceHeader', - vim.tbl_extend('error', options, { desc = 'Switch Source/Header' })) + vim.keymap.set('n', ',', vim.diagnostic.goto_prev, vim.tbl_extend('error', options, { desc = 'Diag prev' })) + vim.keymap.set('n', ';', vim.diagnostic.goto_next, vim.tbl_extend('error', options, { desc = 'Diag next' })) + vim.keymap.set({ 'n', 'x' }, 'a', vim.lsp.buf.code_action, vim.tbl_extend('error', options, { desc = 'Code action' })) + vim.keymap.set('n', 'd', function() + fzf.lsp_definitions({ jump_to_single_result = true }) + end, vim.tbl_extend('error', options, { desc = 'Definition' })) + vim.keymap.set('n', 'e', vim.lsp.buf.declaration, vim.tbl_extend('error', options, { desc = 'Declaration' })) + vim.keymap.set('n', 'h', function() + require('pretty_hover').hover() + end, vim.tbl_extend('error', options, { desc = 'Hover' })) + vim.keymap.set('n', 'c', vim.lsp.buf.outgoing_calls, vim.tbl_extend('error', options, { desc = 'Outgoing calls' })) + vim.keymap.set('n', 'C', vim.lsp.buf.incoming_calls, vim.tbl_extend('error', options, { desc = 'Incoming calls' })) + vim.keymap.set('n', 'm', vim.lsp.buf.rename, vim.tbl_extend('error', options, { desc = 'Rename' })) + vim.keymap.set('n', '', fzf.lsp_live_workspace_symbols, vim.tbl_extend('error', options, { desc = 'Workspace symbols' })) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, vim.tbl_extend('error', options, { desc = 'Type definition' })) + vim.keymap.set({ 'n', 'i', 'x' }, '', vim.lsp.buf.signature_help, vim.tbl_extend('error', options, { desc = 'Signature help' })) + vim.keymap.set('n', 'r', fzf.lsp_references, vim.tbl_extend('error', options, { desc = 'References' })) + vim.keymap.set('n', '', fzf.lsp_document_symbols, vim.tbl_extend('error', options, { desc = 'Document symbols' })) + vim.keymap.set('n', 's', fzf.lsp_live_workspace_symbols, vim.tbl_extend('error', options, { desc = 'Workspace symbols' })) + vim.keymap.set('n', 'v', vim.diagnostic.open_float, vim.tbl_extend('error', options, { desc = 'Diagnostics Float' })) + vim.keymap.set('n', 'V', fzf.diagnostics_document, vim.tbl_extend('error', options, { desc = 'Diagnostics' })) + vim.keymap.set('n', '', 'ClangdSwitchSourceHeader', vim.tbl_extend('error', options, { desc = 'Switch Source/Header' })) -- Set some keybinds conditional on server capabilities if client.server_capabilities.documentFormattingProvider then vim.keymap.set('n', 'f', function() - vim.lsp.buf.format({ timeout_ms = 10000 }) - end, - { noremap = true, silent = false, desc = 'Format file', buffer = bufnr }) + vim.lsp.buf.format({ timeout_ms = 10000 }) + end, { noremap = true, silent = false, desc = 'Format file', buffer = bufnr }) end if client.server_capabilities.documentRangeFormattingProvider then vim.keymap.set('x', 'f', function() - vim.lsp.buf.format({ timeout_ms = 10000 }) - end, - { noremap = true, silent = false, desc = 'Format visual', buffer = bufnr }) + vim.lsp.buf.format({ timeout_ms = 10000 }) + end, { noremap = true, silent = false, desc = 'Format visual', buffer = bufnr }) end if client.supports_method('inlayHintProvider') then vim.keymap.set('n', 'i', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr }) - end, - { - noremap = true, - silent = false, - desc = 'Toggle inlay hints', - buffer = bufnr - }) + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr }) + end, { + noremap = true, + silent = false, + desc = 'Toggle inlay hints', + buffer = bufnr, + }) end end @@ -88,10 +71,10 @@ local document_highlight = function(bufnr) buffer = bufnr, callback = function() vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { + vim.api.nvim_clear_autocmds({ group = group, - buffer = bufnr - } + buffer = bufnr, + }) end, }) end @@ -127,8 +110,8 @@ return { config = function() require('mason').setup({ ui = { - border = 'rounded' - } + border = 'rounded', + }, }) require('mason-lspconfig').setup({ automatic_installation = false, @@ -141,7 +124,7 @@ return { 'lua_ls', 'jsonls', -- 'groovyls', -- Doesn't work in WSL - } + }, }) local lspconfig = require('lspconfig') @@ -161,9 +144,9 @@ return { } local signs = { { name = 'DiagnosticSignError', text = diagnostics.Error }, - { name = 'DiagnosticSignWarn', text = diagnostics.Warning }, - { name = 'DiagnosticSignHint', text = diagnostics.Hint }, - { name = 'DiagnosticSignInfo', text = diagnostics.Information }, + { name = 'DiagnosticSignWarn', text = diagnostics.Warning }, + { name = 'DiagnosticSignHint', text = diagnostics.Hint }, + { name = 'DiagnosticSignInfo', text = diagnostics.Information }, } for _, sign in ipairs(signs) do @@ -179,13 +162,12 @@ return { vim.diagnostic.open_float({ focusable = false, width = 80 }) end - -- lspconfig['pyright'].setup { -- capabilities = capabilities, -- on_attach = on_attach, -- } - lspconfig['basedpyright'].setup { + lspconfig['basedpyright'].setup({ capabilities = capabilities, on_attach = on_attach, settings = { @@ -193,12 +175,12 @@ return { typeCheckingMode = 'standard', }, }, - } + }) - lspconfig['groovyls'].setup { + lspconfig['groovyls'].setup({ capabilities = capabilities, on_attach = on_attach, - } + }) -- lspconfig['cmake'].setup { -- capabilities = capabilities, @@ -215,8 +197,8 @@ return { return lspconfig.util.find_git_ancestor(fname) end, single_file_support = true, -- suggested - on_attach = on_attach -- on_attach is the on_attach function you defined - } + on_attach = on_attach, -- on_attach is the on_attach function you defined + }, } lspconfig.neocmake.setup({}) end @@ -224,48 +206,42 @@ return { local clangd_capabilities = capabilities clangd_capabilities.textDocument.semanticHighlighting = true clangd_capabilities.offsetEncoding = { 'utf-16' } - lspconfig['clangd'].setup { + lspconfig['clangd'].setup({ capabilities = clangd_capabilities, on_attach = on_attach, - cmd = { 'clangd', + cmd = { + 'clangd', '--compile-commands-dir=build_nvim', - '--query-driver', '/opt/cortex-a78-2022.08-gcc12.1-linux5.15/bin/aarch64-linux-gnu-g*', + '--query-driver', + '/opt/cortex-a78-2022.08-gcc12.1-linux5.15/bin/aarch64-linux-gnu-g*', '--clang-tidy', '--background-index', '--use-dirty-headers', - '--completion-style=detailed' }, - root_dir = lspconfig.util.root_pattern( - '.clangd', - '.clang-tidy', - '.clang-format', - 'compile_flags.txt', - 'configure.ac', - '.git', - 'build_nvim' - ) - } + '--completion-style=detailed', + }, + root_dir = lspconfig.util.root_pattern('.clangd', '.clang-tidy', '.clang-format', 'compile_flags.txt', 'configure.ac', '.git', 'build_nvim'), + }) require('clangd_extensions').setup({ - extensions = - { + extensions = { inlay_hints = { -- Only show inlay hints for the current line only_current_line = true, - } - } + }, + }, }) - lspconfig['jsonls'].setup { + lspconfig['jsonls'].setup({ capabilities = capabilities, on_attach = on_attach, - } + }) -- lspconfig['rust_analyzer'].setup { -- capabilities = capabilities, -- on_attach = on_attach, -- } - lspconfig['lua_ls'].setup { + lspconfig['lua_ls'].setup({ capabilities = capabilities, on_attach = on_attach, settings = { @@ -274,7 +250,7 @@ return { checkThirdParty = false, }, completion = { - callSnippet = 'Replace' + callSnippet = 'Replace', }, -- Do not send telemetry data containing a randomized but unique identifier telemetry = { @@ -286,36 +262,36 @@ return { indent_style = 'space', indent_size = '2', quote_style = 'single', - } - } + }, + }, }, - } - } + }, + }) - lspconfig['dockerls'].setup { + lspconfig['dockerls'].setup({ capabilities = capabilities, on_attach = on_attach, - } + }) - lspconfig['markdown_oxide'].setup { + lspconfig['markdown_oxide'].setup({ capabilities = capabilities, on_attach = on_attach, - } + }) -- lspconfig['marksman'].setup { -- capabilities = capabilities, -- on_attach = on_attach, -- } - lspconfig['yamlls'].setup { + lspconfig['yamlls'].setup({ capabilities = capabilities, on_attach = on_attach, settings = { yaml = { - validate = true - } - } - } + validate = true, + }, + }, + }) local prettier = require('efmls-configs.formatters.prettier') local stylua = require('efmls-configs.formatters.stylua') @@ -352,15 +328,10 @@ return { float = { border = 'single', format = function(diagnostic) - return string.format( - '%s (%s) [%s]', - diagnostic.message, - diagnostic.source, - diagnostic.code or diagnostic.user_data.lsp.code - ) + return string.format('%s (%s) [%s]', diagnostic.message, diagnostic.source, diagnostic.code or diagnostic.user_data.lsp.code) end, }, }) end, - event = 'VeryLazy' + event = 'VeryLazy', } diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index c84a51c..460d5bc 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -2,10 +2,10 @@ return { 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons', - 'Isrothy/lualine-diagnostic-message' + 'Isrothy/lualine-diagnostic-message', }, config = function() - require('lualine').setup { + require('lualine').setup({ options = { theme = 'bamboo', disabled_filetypes = { @@ -22,17 +22,17 @@ return { 'diff', { 'diagnostics', - sources = { 'nvim_diagnostic' } - } + sources = { 'nvim_diagnostic' }, + }, }, lualine_c = { 'hostname', 'getcwd', - { 'filename', path = 1, file_status = true } + { 'filename', path = 1, file_status = true }, }, lualine_y = { 'searchcount', - 'progress' + 'progress', }, }, inactive_sections = { @@ -41,9 +41,9 @@ return { { 'filename', path = 1, - file_status = true - } - } + file_status = true, + }, + }, }, winbar = { lualine_a = { @@ -65,15 +65,13 @@ return { warn = ' ', info = ' ', hint = ' ', - } - } - }, - lualine_c = { + }, + }, }, + lualine_c = {}, lualine_x = {}, lualine_y = {}, - lualine_z = { - } + lualine_z = {}, }, inactive_winbar = { lualine_a = { @@ -82,7 +80,7 @@ return { path = 0, file_status = true, separator = { left = '', right = '' }, - } + }, }, lualine_b = { { @@ -92,7 +90,7 @@ return { lualine_c = {}, lualine_x = {}, lualine_y = {}, - lualine_z = {} + lualine_z = {}, }, tabline = { lualine_a = {}, @@ -101,12 +99,12 @@ return { { 'tabs', mode = 2, - } + }, }, lualine_x = {}, lualine_y = {}, - lualine_z = {} + lualine_z = {}, }, - } + }) end, } diff --git a/lua/plugins/luasnip-snippets.lua b/lua/plugins/luasnip-snippets.lua index 5c99142..109b031 100644 --- a/lua/plugins/luasnip-snippets.lua +++ b/lua/plugins/luasnip-snippets.lua @@ -5,5 +5,5 @@ return { -- Mandatory setup function require('luasnip_snippets.common.snip_utils').setup() end, - enabled = false + enabled = false, } diff --git a/lua/plugins/luasnip.lua b/lua/plugins/luasnip.lua index 982d266..888eedd 100644 --- a/lua/plugins/luasnip.lua +++ b/lua/plugins/luasnip.lua @@ -44,29 +44,68 @@ return { ls.snippets = { cpp = { - s('TEST_F_getset', - { - t('TEST_F('), i(1, 'TestClass'), t(' ,test_'), p(getRegA, false), t({ '_set_get)', '{', ' ' }), - i(2, 'm_object'), t('.set'), p(getRegA, true), t('('), i(3, '32.F'), t({ ');', ' ' }), - i(4, 'EXPECT_EQ('), rep(3), t(', '), rep(2), t('.get'), p(getRegA, true), t({ '());', '' }), - t({ '', '}', '' }) - }), - s('TEST_fn_getset', - { - t('void '), p(getRegA, false), t('_'), i(1, 'get'), t('_'), i(2, 'set'), t({ '()', '{', ' ' }), - i(3, 'm_object'), t('.set'), p(getRegA, true), t('('), i(4, '32.F'), t({ ');', ' ' }), - i(5, 'EXPECT_EQ('), rep(4), t(', '), rep(3), t('.get'), p(getRegA, true), t({ '());', '' }), - t({ '', '}', '', '' }), + s('TEST_F_getset', { + t('TEST_F('), + i(1, 'TestClass'), + t(' ,test_'), + p(getRegA, false), + t({ '_set_get)', '{', ' ' }), + i(2, 'm_object'), + t('.set'), + p(getRegA, true), + t('('), + i(3, '32.F'), + t({ ');', ' ' }), + i(4, 'EXPECT_EQ('), + rep(3), + t(', '), + rep(2), + t('.get'), + p(getRegA, true), + t({ '());', '' }), + t({ '', '}', '' }), + }), + s('TEST_fn_getset', { + t('void '), + p(getRegA, false), + t('_'), + i(1, 'get'), + t('_'), + i(2, 'set'), + t({ '()', '{', ' ' }), + i(3, 'm_object'), + t('.set'), + p(getRegA, true), + t('('), + i(4, '32.F'), + t({ ');', ' ' }), + i(5, 'EXPECT_EQ('), + rep(4), + t(', '), + rep(3), + t('.get'), + p(getRegA, true), + t({ '());', '' }), + t({ '', '}', '', '' }), - t('TEST_F('), i(5), t(' ,test_'), p(getRegA, false), t({ '_set_get)', '{', ' ' }), - p(getRegA, false), t('_'), rep(1), t('_'), rep(2), t({ '();' }), - t({ '', '}' }), - }) + t('TEST_F('), + i(5), + t(' ,test_'), + p(getRegA, false), + t({ '_set_get)', '{', ' ' }), + p(getRegA, false), + t('_'), + rep(1), + t('_'), + rep(2), + t({ '();' }), + t({ '', '}' }), + }), }, } require('luasnip.loaders.from_vscode').lazy_load() require('luasnip.loaders.from_vscode').lazy_load({ paths = { './my-snippets' } }) end, - cmd = 'LuaSnipListAvailable' + cmd = 'LuaSnipListAvailable', } diff --git a/lua/plugins/markdown-preview.lua b/lua/plugins/markdown-preview.lua index 5fa64e0..06d2edc 100644 --- a/lua/plugins/markdown-preview.lua +++ b/lua/plugins/markdown-preview.lua @@ -3,17 +3,17 @@ return { cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', - 'MarkdownPreviewStop' + 'MarkdownPreviewStop', }, branch = 'master', ft = { 'markdown' }, build = function() vim.fn['mkdp#util#install']() end, - init = function () + init = function() vim.g.mkdp_auto_close = 0 vim.g.mkdp_auto_start = 1 vim.g.mkdp_combine_preview = 1 vim.g.mkdp_combine_preview_auto_refresh = 1 - end + end, } diff --git a/lua/plugins/neogen.lua b/lua/plugins/neogen.lua index 4eca942..2eb0235 100644 --- a/lua/plugins/neogen.lua +++ b/lua/plugins/neogen.lua @@ -1,34 +1,34 @@ -return { - 'danymat/neogen', - dependencies = 'nvim-treesitter/nvim-treesitter', - opts = { - enabled = true, - languages = { - cpp = { - template = { - annotation_convention = 'custom', - custom = { - { nil, '/// file', { no_results = true, type = { 'file' } } }, - { nil, '/// $1', { no_results = true, type = { 'func', 'file' } } }, - { nil, '', { no_results = true, type = { 'file' } } }, - - { nil, '/// $1', { type = { 'func' } } }, - { 'tparam', '/// \\tparam %s $1' }, - { 'parameters', '/// \\param %s $1' }, - { 'return_statement', '/// \\return $1' }, - }, - }, - }, - }, - }, - keys = { - { - 'n', - function() - require('neogen').generate({}) - end, - desc = 'Add comment', - } - }, - cmd = 'Neogen' -} +return { + 'danymat/neogen', + dependencies = 'nvim-treesitter/nvim-treesitter', + opts = { + enabled = true, + languages = { + cpp = { + template = { + annotation_convention = 'custom', + custom = { + { nil, '/// file', { no_results = true, type = { 'file' } } }, + { nil, '/// $1', { no_results = true, type = { 'func', 'file' } } }, + { nil, '', { no_results = true, type = { 'file' } } }, + + { nil, '/// $1', { type = { 'func' } } }, + { 'tparam', '/// \\tparam %s $1' }, + { 'parameters', '/// \\param %s $1' }, + { 'return_statement', '/// \\return $1' }, + }, + }, + }, + }, + }, + keys = { + { + 'n', + function() + require('neogen').generate({}) + end, + desc = 'Add comment', + }, + }, + cmd = 'Neogen', +} diff --git a/lua/plugins/neogit.lua b/lua/plugins/neogit.lua index b255600..724365d 100644 --- a/lua/plugins/neogit.lua +++ b/lua/plugins/neogit.lua @@ -1,27 +1,27 @@ -return { - 'TimUntersberger/neogit', - dependencies = { - 'nvim-lua/plenary.nvim', - 'sindrets/diffview.nvim' - }, - config = function() - local neogit = require('neogit') - neogit.setup { - integrations = { - diffview = true, - telescope = false, - fzf_lua = true - }, - graph_style = "unicode", - } - end, - keys = { - { - 't', - function() - require('neogit').open() - end - } - }, - cmd = { 'Neogit ' } -} +return { + 'TimUntersberger/neogit', + dependencies = { + 'nvim-lua/plenary.nvim', + 'sindrets/diffview.nvim', + }, + config = function() + local neogit = require('neogit') + neogit.setup({ + integrations = { + diffview = true, + telescope = false, + fzf_lua = true, + }, + graph_style = 'unicode', + }) + end, + keys = { + { + 't', + function() + require('neogit').open() + end, + }, + }, + cmd = { 'Neogit ' }, +} diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua index d74f687..960c605 100644 --- a/lua/plugins/neotest.lua +++ b/lua/plugins/neotest.lua @@ -1,39 +1,39 @@ -return { - 'nvim-neotest/neotest', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-treesitter/nvim-treesitter', - 'antoinemadec/FixCursorHold.nvim', - 'nvim-neotest/neotest-python' - }, - config = function() - local pythonVenv = require('utils.python_venv') - require('neotest').setup({ - adapters = { - require('neotest-python')({ - dap = { - justMyCode = false - }, - runner = 'pytest', - python = pythonVenv.getPythonEnv - }) - } - }) - end, - keys = { - { - '', - function() - require('neotest').run.run() - end, - desc = 'Run nearest test' - }, - { - '', - function() - require('neotest').run.run({ strategy = 'dap' }) - end, - desc = 'Run nearest test' - } - } -} +return { + 'nvim-neotest/neotest', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + 'antoinemadec/FixCursorHold.nvim', + 'nvim-neotest/neotest-python', + }, + config = function() + local pythonVenv = require('utils.python_venv') + require('neotest').setup({ + adapters = { + require('neotest-python')({ + dap = { + justMyCode = false, + }, + runner = 'pytest', + python = pythonVenv.getPythonEnv, + }), + }, + }) + end, + keys = { + { + '', + function() + require('neotest').run.run() + end, + desc = 'Run nearest test', + }, + { + '', + function() + require('neotest').run.run({ strategy = 'dap' }) + end, + desc = 'Run nearest test', + }, + }, +} diff --git a/lua/plugins/nvim-highlight-colors.lua b/lua/plugins/nvim-highlight-colors.lua index 01f957f..54b27ad 100644 --- a/lua/plugins/nvim-highlight-colors.lua +++ b/lua/plugins/nvim-highlight-colors.lua @@ -5,5 +5,5 @@ return { render = 'background', -- or 'foreground' or 'virtual', enable_named_colors = true, }, - cmd = { 'HighlightColors' } + cmd = { 'HighlightColors' }, } diff --git a/lua/plugins/nvim-lint.lua b/lua/plugins/nvim-lint.lua index 9ecf62e..99f2353 100644 --- a/lua/plugins/nvim-lint.lua +++ b/lua/plugins/nvim-lint.lua @@ -2,7 +2,7 @@ return { 'mfussenegger/nvim-lint', config = function() require('lint').linters_by_ft = { - cpp = { 'clangtidy', } + cpp = { 'clangtidy' }, } vim.api.nvim_create_autocmd({ 'BufWritePost' }, { callback = function() @@ -15,5 +15,5 @@ return { -- require('lint').try_lint('cspell') end, }) - end + end, } diff --git a/lua/plugins/nvim-rooter.lua b/lua/plugins/nvim-rooter.lua index 543d424..0a11b49 100644 --- a/lua/plugins/nvim-rooter.lua +++ b/lua/plugins/nvim-rooter.lua @@ -1,7 +1,8 @@ return { 'notjedi/nvim-rooter.lua', opts = { - rooter_patterns = { '.git', + rooter_patterns = { + '.git', '_darcs', '.hg', '.bzr', @@ -10,6 +11,7 @@ return { 'package.json', 'build_nvim', 'real_path.txt', - 'conaninfo.txt' }, - } + 'conaninfo.txt', + }, + }, } diff --git a/lua/plugins/nvim-surround.lua b/lua/plugins/nvim-surround.lua index 4ffa1e9..540f49c 100644 --- a/lua/plugins/nvim-surround.lua +++ b/lua/plugins/nvim-surround.lua @@ -1,10 +1,10 @@ return { 'kylechui/nvim-surround', - version = '*', -- Use for stability; omit to use `main` branch for the latest features + version = '*', -- Use for stability; omit to use `main` branch for the latest features event = 'VeryLazy', config = function() require('nvim-surround').setup({ -- Configuration here, or leave empty to use defaults }) - end + end, } diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua index a711a98..51ea973 100644 --- a/lua/plugins/oil.lua +++ b/lua/plugins/oil.lua @@ -26,6 +26,6 @@ return { require('oil').open() end, desc = 'Open oil', - } - } + }, + }, } diff --git a/lua/plugins/overseer.lua b/lua/plugins/overseer.lua index af9a5b5..f3953fe 100644 --- a/lua/plugins/overseer.lua +++ b/lua/plugins/overseer.lua @@ -28,6 +28,6 @@ return { 'OverseerBuild', 'OverseerQuickAction', 'OverseerTaskAction', - 'OverseerClearCache' - } + 'OverseerClearCache', + }, } diff --git a/lua/plugins/pretty_hover.lua b/lua/plugins/pretty_hover.lua index a4476f9..2a0b85d 100644 --- a/lua/plugins/pretty_hover.lua +++ b/lua/plugins/pretty_hover.lua @@ -1,5 +1,5 @@ -return { - 'Fildo7525/pretty_hover', - event = 'LspAttach', - opts = {}, -} +return { + 'Fildo7525/pretty_hover', + event = 'LspAttach', + opts = {}, +} diff --git a/lua/plugins/rainbow-delimiters.lua b/lua/plugins/rainbow-delimiters.lua index 285a558..08b01d3 100644 --- a/lua/plugins/rainbow-delimiters.lua +++ b/lua/plugins/rainbow-delimiters.lua @@ -1,5 +1,5 @@ -return { - 'HiPhish/rainbow-delimiters.nvim', - dependencies = 'nvim-treesitter/nvim-treesitter', - event = 'VeryLazy' -} +return { + 'HiPhish/rainbow-delimiters.nvim', + dependencies = 'nvim-treesitter/nvim-treesitter', + event = 'VeryLazy', +} diff --git a/lua/plugins/rustaceanvim.lua b/lua/plugins/rustaceanvim.lua index d3e079c..7821ed2 100644 --- a/lua/plugins/rustaceanvim.lua +++ b/lua/plugins/rustaceanvim.lua @@ -6,8 +6,9 @@ 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' }, { @@ -31,14 +32,14 @@ return { buffer = bufnr, callback = function() vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { + vim.api.nvim_clear_autocmds({ group = group, - buffer = bufnr - } + buffer = bufnr, + }) end, }) - end - } + end, + }, } - end + end, } diff --git a/lua/plugins/toggleterm.lua b/lua/plugins/toggleterm.lua index 83d91d8..e18d299 100644 --- a/lua/plugins/toggleterm.lua +++ b/lua/plugins/toggleterm.lua @@ -3,7 +3,7 @@ return { config = function() function _G.set_terminal_keymaps(term) local opts = { noremap = true } - if (term.cmd ~= 'lazygit') then + if term.cmd ~= 'lazygit' then vim.api.nvim_buf_set_keymap(term.bufnr, 't', '', [[]], opts) end vim.api.nvim_buf_set_keymap(term.bufnr, 't', 'jk', [[]], opts) @@ -14,7 +14,7 @@ return { end require('toggleterm').setup({ - on_open = set_terminal_keymaps + on_open = set_terminal_keymaps, }) local Terminal = require('toggleterm.terminal').Terminal @@ -46,8 +46,8 @@ return { function() _lazygit_toggle() end, - desc = 'LazyGit' - } + desc = 'LazyGit', + }, }, cmd = 'ToggleTerm', } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index adcbe35..afbe747 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,55 +1,55 @@ -return { - 'nvim-treesitter/nvim-treesitter', - version = '*', - build = ':TSUpdate', - config = function() - require('nvim-treesitter.install').compilers = { 'clang' } - require('nvim-treesitter.configs').setup({ - ensure_installed = '', - modules = {}, - sync_install = true, - auto_install = true, - ignore_install = {}, - highlight = { - enable = true, - additional_vim_regex_highlighting = { 'markdown' } - }, - rainbow = { - enable = true, - extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean - max_file_lines = nil, -- Do not enable for files with more than n lines, int - -- colors = {}, -- table of hex strings - -- termcolors = {} -- table of colour name strings - }, - indent = { - enable = false -- maybe buggy - }, - textobjects = { - select = { - enable = true, - - -- Automatically jump forward to textobj, similar to targets.vim - lookahead = true, - - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - }, - }, - lsp_interop = { - enable = true, - border = 'none', - peek_definition_code = { - ['df'] = '@function.outer', - ['dF'] = '@class.outer', - }, - }, - }, - }) - vim.treesitter.language.register('groovy', 'java') - require('nvim-treesitter.install').prefer_git = false - end -} +return { + 'nvim-treesitter/nvim-treesitter', + version = '*', + build = ':TSUpdate', + config = function() + require('nvim-treesitter.install').compilers = { 'clang' } + require('nvim-treesitter.configs').setup({ + ensure_installed = '', + modules = {}, + sync_install = true, + auto_install = true, + ignore_install = {}, + highlight = { + enable = true, + additional_vim_regex_highlighting = { 'markdown' }, + }, + rainbow = { + enable = true, + extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean + max_file_lines = nil, -- Do not enable for files with more than n lines, int + -- colors = {}, -- table of hex strings + -- termcolors = {} -- table of colour name strings + }, + indent = { + enable = false, -- maybe buggy + }, + textobjects = { + select = { + enable = true, + + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + lsp_interop = { + enable = true, + border = 'none', + peek_definition_code = { + ['df'] = '@function.outer', + ['dF'] = '@class.outer', + }, + }, + }, + }) + vim.treesitter.language.register('groovy', 'java') + require('nvim-treesitter.install').prefer_git = false + end, +} diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua index feba445..e894c23 100644 --- a/lua/plugins/which-key.lua +++ b/lua/plugins/which-key.lua @@ -1,13 +1,13 @@ -return { - 'folke/which-key.nvim', - version = '*', - opts = { - plugins = { - marks = false, - registers = false, - presets = { - operators = false - } - } - } -} +return { + 'folke/which-key.nvim', + version = '*', + opts = { + plugins = { + marks = false, + registers = false, + presets = { + operators = false, + }, + }, + }, +} diff --git a/lua/plugins/workspaces.lua b/lua/plugins/workspaces.lua index adce631..601dfb2 100644 --- a/lua/plugins/workspaces.lua +++ b/lua/plugins/workspaces.lua @@ -1,45 +1,44 @@ -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 - } - } -} +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, + }, + }, +} diff --git a/lua/themes/astrodark.lua b/lua/themes/astrodark.lua index 0c0e405..1811821 100644 --- a/lua/themes/astrodark.lua +++ b/lua/themes/astrodark.lua @@ -5,11 +5,11 @@ return { config = function() local C = require('astrotheme.palettes.astrodark') require('astrotheme').setup({ - palette = 'astrodark', -- String of the default palette to use when calling `:colorscheme astrotheme` + palette = 'astrodark', -- String of the default palette to use when calling `:colorscheme astrotheme` - termguicolors = true, -- Bool value, toggles if termguicolors are set by AstroTheme. + termguicolors = true, -- Bool value, toggles if termguicolors are set by AstroTheme. - terminal_color = true, -- Bool value, toggles if terminal_colors are set by AstroTheme. + terminal_color = true, -- Bool value, toggles if terminal_colors are set by AstroTheme. plugin_default = 'auto', -- Sets how all plugins will be loaded -- "auto": Uses lazy / packer enabled plugins to load highlights. @@ -21,15 +21,12 @@ return { }, palettes = { - global = { - }, - astrodark = { - }, + global = {}, + astrodark = {}, }, highlights = { global = { - modify_hl_groups = function(hl, c) - end, + modify_hl_groups = function(hl, c) end, }, astrodark = { modify_hl_groups = function(hl, c) -- modify_hl_groups function allows you to modify hl groups, @@ -57,10 +54,10 @@ return { ['TelescopeTitle'] = { bg = C.surface0 }, ['TelescopePromptNormal'] = { bg = C.surface0 }, ['TelescopePromptBorder'] = { link = 'TelescopeBorder' }, - } - } + }, + }, }) vim.cmd('colorscheme astrodark') end, - enabled = true + enabled = true, } diff --git a/lua/themes/bamboo.lua b/lua/themes/bamboo.lua index be312f0..ff82a25 100644 --- a/lua/themes/bamboo.lua +++ b/lua/themes/bamboo.lua @@ -4,7 +4,7 @@ return { priority = 1000, config = function() local colors = require('bamboo.palette') - require('bamboo').setup { + require('bamboo').setup({ dim_inactive = true, -- Dim inactive windows/buffers cmp_itemkind_reverse = true, lualine = { @@ -33,8 +33,8 @@ return { ['LspReferenceText'] = { bg = colors.vulgaris.cyan, fg = colors.vulgaris.bg1, fmt = 'nocombine' }, ['Delimiter'] = { fg = colors.vulgaris.fg }, }, - } + }) require('bamboo').load() end, - enabled = true + enabled = true, } diff --git a/lua/themes/catppuccin.lua b/lua/themes/catppuccin.lua index 3ba7131..d4fbbcb 100644 --- a/lua/themes/catppuccin.lua +++ b/lua/themes/catppuccin.lua @@ -1,5 +1,4 @@ -return -{ +return { 'catppuccin/nvim', name = 'catppuccin', lazy = true, @@ -63,7 +62,7 @@ return ['@namespace'] = { fg = colors.red }, ['@function.builtin'] = { link = 'Function' }, ['@property'] = { fg = colors.pink }, - Macro = { fg = colors.rosewater } + Macro = { fg = colors.rosewater }, } end, }, @@ -100,5 +99,5 @@ return }) vim.cmd('colorscheme catppuccin') end, - enabled = true + enabled = true, } diff --git a/lua/themes/everforest.lua b/lua/themes/everforest.lua index 897712b..2248446 100644 --- a/lua/themes/everforest.lua +++ b/lua/themes/everforest.lua @@ -11,5 +11,5 @@ return { }) require('everforest').load() end, - enabled = true + enabled = true, } diff --git a/lua/themes/github-theme.lua b/lua/themes/github-theme.lua index f3202dc..91219cf 100644 --- a/lua/themes/github-theme.lua +++ b/lua/themes/github-theme.lua @@ -1,7 +1,6 @@ -return -{ +return { 'projekt0n/github-nvim-theme', - lazy = false, -- make sure we load this during startup if it is your main colorscheme + lazy = false, -- make sure we load this during startup if it is your main colorscheme priority = 1000, -- make sure to load this before all the other start plugins config = function() require('github-theme').setup({ @@ -32,7 +31,7 @@ return 'treesitter', 'treesitter_context', 'whichkey', - } + }, }, }) diff --git a/lua/themes/gruvbox-baby.lua b/lua/themes/gruvbox-baby.lua index 512579d..7e2497b 100644 --- a/lua/themes/gruvbox-baby.lua +++ b/lua/themes/gruvbox-baby.lua @@ -5,5 +5,5 @@ return { config = function() vim.cmd('colorscheme gruvbox-baby') end, - enabled = true + enabled = true, } diff --git a/lua/themes/gruvbox.lua b/lua/themes/gruvbox.lua index d80c622..cb67c99 100644 --- a/lua/themes/gruvbox.lua +++ b/lua/themes/gruvbox.lua @@ -33,5 +33,5 @@ return { }) vim.cmd('colorscheme gruvbox') end, - enabled = true + enabled = true, } diff --git a/lua/themes/gruvbox_flat.lua b/lua/themes/gruvbox_flat.lua index fbdcfa5..d4de67a 100644 --- a/lua/themes/gruvbox_flat.lua +++ b/lua/themes/gruvbox_flat.lua @@ -1,19 +1,19 @@ -return { - 'eddyekofo94/gruvbox-flat.nvim', - priority = 1000, - config = function() - local colors = require('gruvbox.colors') - vim.g.gruvbox_flat_style = 'dark' - vim.g.gruvbox_colors = { - bg_search = 'purple', - fg_search = 'black', - } - vim.g.gruvbox_theme = { - Pmenu = { bg = 'bg_visual' }, - NormalFloat = { bg = 'bg_visual' } - } - vim.g.gruvbox_dark_float = false - vim.cmd('colorscheme gruvbox-flat') - end, - enabled = false -} +return { + 'eddyekofo94/gruvbox-flat.nvim', + priority = 1000, + config = function() + local colors = require('gruvbox.colors') + vim.g.gruvbox_flat_style = 'dark' + vim.g.gruvbox_colors = { + bg_search = 'purple', + fg_search = 'black', + } + vim.g.gruvbox_theme = { + Pmenu = { bg = 'bg_visual' }, + NormalFloat = { bg = 'bg_visual' }, + } + vim.g.gruvbox_dark_float = false + vim.cmd('colorscheme gruvbox-flat') + end, + enabled = false, +} diff --git a/lua/themes/gruvbox_material.lua b/lua/themes/gruvbox_material.lua index e8d8c99..c8a7629 100644 --- a/lua/themes/gruvbox_material.lua +++ b/lua/themes/gruvbox_material.lua @@ -1,42 +1,42 @@ -return { - 'sainnhe/gruvbox-material', - priority = 1000, - config = function() - -- local colors = require('gruvbox.colors') - -- vim.g.gruvbox_flat_style = "dark" - -- vim.g.gruvbox_colors = { - -- bg_search = 'purple', - -- fg_search = 'black', - -- } - -- vim.g.gruvbox_theme = { - -- Pmenu = { bg = 'bg_visual' }, - -- NormalFloat = { bg = 'bg_visual' } - -- } - -- vim.g.gruvbox_dark_float = false - vim.g.gruvbox_material_ui_contrast = 'high' - vim.g.gruvbox_material_dim_inactive_windows = 1 -- Dim inactive windows. Only works in neovim currently. - vim.g.gruvbox_material_disable_terminal_colors = 0 - local links = { - ['@lsp.type.namespace'] = '@namespace', - ['@lsp.type.type'] = '@type', - ['@lsp.type.class'] = '@type', - ['@lsp.type.enum'] = '@type', - ['@lsp.type.interface'] = '@type', - ['@lsp.type.struct'] = '@structure', - ['@lsp.type.parameter'] = '@parameter', - ['@lsp.type.variable'] = '@variable', - ['@lsp.type.property'] = '@property', - ['@lsp.type.enumMember'] = '@constant', - ['@lsp.type.function'] = '@function', - ['@lsp.type.method'] = '@method', - ['@lsp.type.macro'] = '@macro', - ['@lsp.type.decorator'] = '@function', - } - -- for newgroup, oldgroup in pairs(links) do - -- vim.api.nvim_set_hl(0, newgroup, { link = oldgroup, default = true }) - -- end - vim.cmd('colorscheme gruvbox-material') - vim.api.nvim_set_hl(0, '@lsp.mod.readonly', { italic = true, fg = 'Purple' }) - end, - enabled = false -} +return { + 'sainnhe/gruvbox-material', + priority = 1000, + config = function() + -- local colors = require('gruvbox.colors') + -- vim.g.gruvbox_flat_style = "dark" + -- vim.g.gruvbox_colors = { + -- bg_search = 'purple', + -- fg_search = 'black', + -- } + -- vim.g.gruvbox_theme = { + -- Pmenu = { bg = 'bg_visual' }, + -- NormalFloat = { bg = 'bg_visual' } + -- } + -- vim.g.gruvbox_dark_float = false + vim.g.gruvbox_material_ui_contrast = 'high' + vim.g.gruvbox_material_dim_inactive_windows = 1 -- Dim inactive windows. Only works in neovim currently. + vim.g.gruvbox_material_disable_terminal_colors = 0 + local links = { + ['@lsp.type.namespace'] = '@namespace', + ['@lsp.type.type'] = '@type', + ['@lsp.type.class'] = '@type', + ['@lsp.type.enum'] = '@type', + ['@lsp.type.interface'] = '@type', + ['@lsp.type.struct'] = '@structure', + ['@lsp.type.parameter'] = '@parameter', + ['@lsp.type.variable'] = '@variable', + ['@lsp.type.property'] = '@property', + ['@lsp.type.enumMember'] = '@constant', + ['@lsp.type.function'] = '@function', + ['@lsp.type.method'] = '@method', + ['@lsp.type.macro'] = '@macro', + ['@lsp.type.decorator'] = '@function', + } + -- for newgroup, oldgroup in pairs(links) do + -- vim.api.nvim_set_hl(0, newgroup, { link = oldgroup, default = true }) + -- end + vim.cmd('colorscheme gruvbox-material') + vim.api.nvim_set_hl(0, '@lsp.mod.readonly', { italic = true, fg = 'Purple' }) + end, + enabled = false, +} diff --git a/lua/themes/kanagawa.lua b/lua/themes/kanagawa.lua index 2922d11..9948a3b 100644 --- a/lua/themes/kanagawa.lua +++ b/lua/themes/kanagawa.lua @@ -3,15 +3,15 @@ return { lazy = true, config = function() require('kanagawa').setup({ - compile = false, -- enable compiling the colorscheme + compile = false, -- enable compiling the colorscheme undercurl = true, -- enable undercurls commentStyle = { italic = true }, functionStyle = {}, keywordStyle = { italic = true }, statementStyle = { bold = true }, typeStyle = {}, - transparent = false, -- do not set background color - dimInactive = true, -- dim inactive window `:h hl-NormalNC` + transparent = false, -- do not set background color + dimInactive = true, -- dim inactive window `:h hl-NormalNC` terminalColors = true, -- define vim.g.terminal_color_{0,17} colors = { -- add/modify theme and palette colors @@ -28,11 +28,11 @@ return { background = { -- map the value of 'background' option to a theme dark = 'wave', -- try "dragon" ! - light = 'lotus' + light = 'lotus', }, }) vim.cmd('colorscheme kanagawa') end, - enabled = true + enabled = true, } diff --git a/lua/themes/material.lua b/lua/themes/material.lua index fe1d337..d8ceaf2 100644 --- a/lua/themes/material.lua +++ b/lua/themes/material.lua @@ -2,7 +2,7 @@ return { 'marko-cerovac/material.nvim', priority = 1000, config = function() - local colors = require 'material.colors' + local colors = require('material.colors') require('material').setup({ contrast = { @@ -15,10 +15,14 @@ return { }, styles = { -- Give comments style such as bold, italic, underline etc. - comments = { --[[ italic = true ]] }, - strings = { --[[ bold = true ]] }, - keywords = { --[[ underline = true ]] }, - functions = { --[[ bold = true, undercurl = true ]] }, + comments = { --[[ italic = true ]] + }, + strings = { --[[ bold = true ]] + }, + keywords = { --[[ underline = true ]] + }, + functions = { --[[ bold = true, undercurl = true ]] + }, variables = {}, operators = {}, types = {}, @@ -26,23 +30,23 @@ return { plugins = { -- Uncomment the plugins that you use to highlight them -- Available plugins: - "dap", + 'dap', -- "dashboard", - "gitsigns", + 'gitsigns', -- "hop", - "indent-blankline", + 'indent-blankline', -- "lspsaga", -- "mini", -- "neogit", -- "neorg", - "nvim-cmp", - "nvim-navic", + 'nvim-cmp', + 'nvim-navic', -- "nvim-tree", - "nvim-web-devicons", + 'nvim-web-devicons', -- "sneak", - "telescope", + 'telescope', -- "trouble", - "which-key", + 'which-key', }, disable = { @@ -50,12 +54,12 @@ return { borders = false, -- Disable borders between verticaly split windows background = false, -- Prevent the theme from setting the background (NeoVim then uses your terminal background) term_colors = false, -- Prevent the theme from setting terminal colors - eob_lines = false -- Hide the end-of-buffer lines + eob_lines = false, -- Hide the end-of-buffer lines }, high_visibility = { lighter = false, -- Enable higher contrast text for lighter style - darker = true-- Enable higher contrast text for darker style + darker = true, -- Enable higher contrast text for darker style }, lualine_style = 'default', -- Lualine style ( can be 'stealth' or 'default' ) @@ -66,8 +70,8 @@ return { custom_highlights = {}, -- Overwrite highlights with your own }) - vim.g.material_style = "darker" + vim.g.material_style = 'darker' vim.cmd('colorscheme material') end, - enabled = false + enabled = false, } diff --git a/lua/themes/monokai-pro.lua b/lua/themes/monokai-pro.lua index 1894913..8b05f2a 100644 --- a/lua/themes/monokai-pro.lua +++ b/lua/themes/monokai-pro.lua @@ -43,9 +43,9 @@ return { -- ["@lsp.typemod.interface"] = {}, -- ["@lsp.typemod.macro"] = {}, -- ["@lsp.typemod.method"] = {}, - ["@lsp.typemod.namespace"] = { fg = c.base.red }, + ['@lsp.typemod.namespace'] = { fg = c.base.red }, -- ['@lsp.typemod.parameter.declaration'] = { fg = c.base.blue, italic = styles.parameter.italic }, - ["@lsp.typemod.property"] = { fg = '#9699f2' }, + ['@lsp.typemod.property'] = { fg = '#9699f2' }, -- ["@lsp.typemod.struct"] = {}, -- ["@lsp.typemod.type"] = {}, -- ["@lsp.typemod.typeParameter"] = {}, @@ -60,5 +60,5 @@ return { }) vim.cmd('colorscheme monokai-pro') end, - enabled = true + enabled = true, } diff --git a/lua/utils/python_venv.lua b/lua/utils/python_venv.lua index 21b0b85..d3090f2 100644 --- a/lua/utils/python_venv.lua +++ b/lua/utils/python_venv.lua @@ -62,14 +62,14 @@ function M.getPythonEnvs() if venv ~= nil then table.insert(venvs, { name = 'VIRTUAL_ENV', - path = string.format('%s/%s', venv, M.getVenvSuffix()) + path = string.format('%s/%s', venv, M.getVenvSuffix()), }) end local conda = os.getenv('CONDA_PREFIX') if conda ~= nil then table.insert(venvs, { name = 'CONDA_PREFIX', - path = string.format('%s/%s', conda, 'python.exe') + path = string.format('%s/%s', conda, 'python.exe'), }) end @@ -79,7 +79,7 @@ function M.getPythonEnvs() if jsonVenv ~= nil then table.insert(venvs, { name = 'pyrightconfig.json', - path = jsonVenv .. '/' .. M.getVenvSuffix() + path = jsonVenv .. '/' .. M.getVenvSuffix(), }) end @@ -88,20 +88,20 @@ function M.getPythonEnvs() if vim.fn.executable(cwd .. '/' .. envDir .. '/' .. M.getVenvSuffix()) == 1 then table.insert(venvs, { name = envDir, - path = cwd .. '/' .. envDir .. '/' .. M.getVenvSuffix() + path = cwd .. '/' .. envDir .. '/' .. M.getVenvSuffix(), }) end end if vim.loop.os_uname().sysname == 'Linux' then table.insert(venvs, { name = 'system', - path = '/usr/bin/python' + path = '/usr/bin/python', }) end if vim.loop.os_uname().sysname == 'Windows_NT' then table.insert(venvs, { name = 'system', - path = os.getenv('SCOOP') .. '/apps/python/current/python.exe' + path = os.getenv('SCOOP') .. '/apps/python/current/python.exe', }) end return venvs @@ -110,7 +110,9 @@ 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 255bfd9..56619e8 100644 --- a/stylua.toml +++ b/stylua.toml @@ -1,4 +1,4 @@ -column_width = 120 +column_width = 160 line_endings = "Unix" indent_type = "Spaces" indent_width = 2