diff options
Diffstat (limited to 'nvim')
36 files changed, 580 insertions, 235 deletions
diff --git a/nvim/.config/nvim/.github/README.md b/nvim/.config/nvim/.github/README.md index 54bdad8..12d91e7 100644 --- a/nvim/.config/nvim/.github/README.md +++ b/nvim/.config/nvim/.github/README.md @@ -84,6 +84,8 @@ AstroNvim is an aesthetic and feature-rich neovim config that is extensible and ## 🛠️ Installation +### Linux/Mac OS (Unix) + #### Make a backup of your current nvim and shared folder ```shell @@ -98,6 +100,22 @@ git clone --depth 1 https://github.com/AstroNvim/AstroNvim ~/.config/nvim nvim ``` +### Windows (Powershell) + +#### Make a backup of your current nvim and nvim-data folder + +```pwsh +Rename-Item -Path $env:LOCALAPPDATA\nvim -NewName $env:LOCALAPPDATA\nvim.bak +Rename-Item -Path $env:LOCALAPPDATA\nvim-data -NewName $env:LOCALAPPDATA\nvim-data.bak +``` + +#### Clone the repository + +```pwsh +git clone --depth 1 https://github.com/AstroNvim/AstroNvim $env:LOCALAPPDATA\nvim +nvim +``` + ## 📦 Basic Setup #### Install LSP diff --git a/nvim/.config/nvim/.github/workflows/conventional_commit.yml b/nvim/.config/nvim/.github/workflows/conventional_commit.yml index 76819c4..c8d3558 100644 --- a/nvim/.config/nvim/.github/workflows/conventional_commit.yml +++ b/nvim/.config/nvim/.github/workflows/conventional_commit.yml @@ -2,7 +2,7 @@ name: Conventional Commits on: pull_request: - branches: [ main ] + branches: [main] jobs: build: @@ -10,4 +10,4 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: webiny/action-conventional-commits@v1.0.3 + - uses: webiny/action-conventional-commits@v1.1.0 diff --git a/nvim/.config/nvim/.github/workflows/docs.yml b/nvim/.config/nvim/.github/workflows/docs.yml index 67a997d..47ce3b6 100644 --- a/nvim/.config/nvim/.github/workflows/docs.yml +++ b/nvim/.config/nvim/.github/workflows/docs.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Lua uses: leafo/gh-actions-lua@v8 with: diff --git a/nvim/.config/nvim/.github/workflows/luacheck.yml b/nvim/.config/nvim/.github/workflows/luacheck.yml index f8d48a7..87111d6 100644 --- a/nvim/.config/nvim/.github/workflows/luacheck.yml +++ b/nvim/.config/nvim/.github/workflows/luacheck.yml @@ -9,5 +9,5 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: lunarmodules/luacheck@v1 diff --git a/nvim/.config/nvim/.github/workflows/spell.yml b/nvim/.config/nvim/.github/workflows/spell.yml index 7bae68e..463606f 100644 --- a/nvim/.config/nvim/.github/workflows/spell.yml +++ b/nvim/.config/nvim/.github/workflows/spell.yml @@ -11,4 +11,4 @@ jobs: - name: Checkout Actions Repository uses: actions/checkout@v3 - name: Check spelling - uses: crate-ci/typos@v1.13.26 + uses: crate-ci/typos@v1.14.5 diff --git a/nvim/.config/nvim/.github/workflows/style.yml b/nvim/.config/nvim/.github/workflows/style.yml index 3473f5e..f666542 100644 --- a/nvim/.config/nvim/.github/workflows/style.yml +++ b/nvim/.config/nvim/.github/workflows/style.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: JohnnyMorganz/stylua-action@v2 + - uses: JohnnyMorganz/stylua-action@v3 with: token: ${{ secrets.GITHUB_TOKEN }} version: latest diff --git a/nvim/.config/nvim/.gitignore b/nvim/.config/nvim/.gitignore index 11b67c8..9ed7e4c 100644 --- a/nvim/.config/nvim/.gitignore +++ b/nvim/.config/nvim/.gitignore @@ -1,9 +1,46 @@ +# Project gitignore !colors/astronvim.lua colors/* docs ginit.vim -lua/user plugin ftplugin spell +.github .luarc.json + +# Global gitignore +# ---------------- + +# Mac OS X +.DS_Store +.AppleDouble +.LSOverride +._* + +# Windoze +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db +$RECYCLE.BIN/ + +# (Neo)Vim +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] +Session.vim +Sessionx.vim +.netrwhist +*~ +tags +[._]*.un~ + +# VS Code +.vscode +.history + +# JetBrains +.idea diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index a887f21..4f67424 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -11,7 +11,10 @@ end if astronvim.default_colorscheme then if not pcall(vim.cmd.colorscheme, astronvim.default_colorscheme) then - require("astronvim.utils").notify("Error setting up colorscheme: " .. astronvim.default_colorscheme, "error") + require("astronvim.utils").notify( + "Error setting up colorscheme: " .. astronvim.default_colorscheme, + vim.log.levels.ERROR + ) end end diff --git a/nvim/.config/nvim/lua/astronvim/autocmds.lua b/nvim/.config/nvim/lua/astronvim/autocmds.lua index c3b1734..7b47b6e 100644 --- a/nvim/.config/nvim/lua/astronvim/autocmds.lua +++ b/nvim/.config/nvim/lua/astronvim/autocmds.lua @@ -15,7 +15,7 @@ vim.on_key(function(char) end, namespace "auto_hlsearch") local bufferline_group = augroup("bufferline", { clear = true }) -autocmd({ "BufAdd", "BufEnter" }, { +autocmd({ "BufAdd", "BufEnter", "TabNewEntered" }, { desc = "Update buffers when adding new buffers", group = bufferline_group, callback = function(args) @@ -151,6 +151,8 @@ if is_available "alpha-nvim" then vim.opt.showtabline = 0 vim.opt_local.winbar = nil autocmd("BufUnload", { + desc = "Reenable status and tablines for alpha", + group = group_name, pattern = "<buffer>", callback = function() vim.opt.laststatus = prev_status @@ -179,6 +181,18 @@ if is_available "alpha-nvim" then }) end +if is_available "resession.nvim" then + autocmd("VimLeavePre", { + desc = "Save session on close", + group = augroup("resession_auto_save", { clear = true }), + callback = function() + local save = require("resession").save + save "Last Session" + save(vim.fn.getcwd(), { dir = "dirsession", notify = false }) + end, + }) +end + if is_available "neo-tree.nvim" then autocmd("BufEnter", { desc = "Open Neo-Tree on startup with directory", @@ -214,6 +228,7 @@ autocmd({ "VimEnter", "ColorScheme" }, { }) autocmd({ "BufReadPost", "BufNewFile" }, { + desc = "AstroNvim user events for file detection (AstroFile and AstroGitFile)", group = augroup("file_user_events", { clear = true }), callback = function(args) if not (vim.fn.expand "%" == "" or vim.api.nvim_get_option_value("buftype", { buf = args.buf }) == "nofile") then @@ -236,3 +251,4 @@ cmd( cmd("AstroRollback", function() require("astronvim.utils.updater").rollback() end, { desc = "Rollback AstroNvim" }) cmd("AstroUpdate", function() require("astronvim.utils.updater").update() end, { desc = "Update AstroNvim" }) cmd("AstroVersion", function() require("astronvim.utils.updater").version() end, { desc = "Check AstroNvim Version" }) +cmd("AstroReload", function() require("astronvim.utils").reload() end, { desc = "Reload AstroNvim (Experimental)" }) diff --git a/nvim/.config/nvim/lua/astronvim/health.lua b/nvim/.config/nvim/lua/astronvim/health.lua index 9e48adf..d1fa8a6 100644 --- a/nvim/.config/nvim/lua/astronvim/health.lua +++ b/nvim/.config/nvim/lua/astronvim/health.lua @@ -1,17 +1,26 @@ local M = {} +-- TODO: remove deprecated method check after dropping support for neovim v0.9 +local health = { + start = vim.health.start or vim.health.report_start, + ok = vim.health.ok or vim.health.report_ok, + warn = vim.health.warn or vim.health.report_warn, + error = vim.health.error or vim.health.report_error, + info = vim.health.info or vim.health.report_info, +} + function M.check() - vim.health.report_start "AstroNvim" + health.start "AstroNvim" - vim.health.report_info("AstroNvim Version: " .. require("astronvim.utils.updater").version(true)) - vim.health.report_info("Neovim Version: v" .. vim.fn.matchstr(vim.fn.execute "version", "NVIM v\\zs[^\n]*")) + health.info("AstroNvim Version: " .. require("astronvim.utils.updater").version(true)) + health.info("Neovim Version: v" .. vim.fn.matchstr(vim.fn.execute "version", "NVIM v\\zs[^\n]*")) if vim.version().prerelease then - vim.health.report_warn "Neovim nightly is not officially supported and may have breaking changes" + health.warn "Neovim nightly is not officially supported and may have breaking changes" elseif vim.fn.has "nvim-0.8" == 1 then - vim.health.report_ok "Using stable Neovim >= 0.8.0" + health.ok "Using stable Neovim >= 0.8.0" else - vim.health.report_error "Neovim >= 0.8.0 is required" + health.error "Neovim >= 0.8.0 is required" end local programs = { @@ -41,9 +50,9 @@ function M.check() end if found then - vim.health.report_ok(("`%s` is installed: %s"):format(name, program.msg)) + health.ok(("`%s` is installed: %s"):format(name, program.msg)) else - vim.health["report_" .. program.type](("`%s` is not installed: %s"):format(name, program.msg)) + health[program.type](("`%s` is not installed: %s"):format(name, program.msg)) end end end diff --git a/nvim/.config/nvim/lua/astronvim/icons/nerd_font.lua b/nvim/.config/nvim/lua/astronvim/icons/nerd_font.lua index d6f7f47..8b0a91f 100644 --- a/nvim/.config/nvim/lua/astronvim/icons/nerd_font.lua +++ b/nvim/.config/nvim/lua/astronvim/icons/nerd_font.lua @@ -3,17 +3,17 @@ return { ActiveTS = "", ArrowLeft = "", ArrowRight = "", - BufferClose = "", + BufferClose = "", DapBreakpoint = "", DapBreakpointCondition = "", DapBreakpointRejected = "", DapLogPoint = ".>", - DapStopped = "", - DefaultFile = "", - Diagnostic = "裂", + DapStopped = "", + DefaultFile = "", + Diagnostic = "", DiagnosticError = "", - DiagnosticHint = "", - DiagnosticInfo = "", + DiagnosticHint = "", + DiagnosticInfo = "", DiagnosticWarn = "", Ellipsis = "…", FileModified = "", @@ -24,7 +24,7 @@ return { FolderClosed = "", FolderEmpty = "", FolderOpen = "", - Git = "", + Git = "", GitAdd = "", GitBranch = "", GitChange = "", @@ -37,12 +37,12 @@ return { GitUntracked = "★", LSPLoaded = "", LSPLoading1 = "", - LSPLoading2 = "", + LSPLoading2 = "", LSPLoading3 = "", MacroRecording = "", - Paste = "", + Paste = "", Search = "", Selected = "❯", - Spellcheck = "暈", - TabClose = "", + Spellcheck = "", + TabClose = "", } diff --git a/nvim/.config/nvim/lua/astronvim/lazy.lua b/nvim/.config/nvim/lua/astronvim/lazy.lua index 0a5bd32..d918c24 100644 --- a/nvim/.config/nvim/lua/astronvim/lazy.lua +++ b/nvim/.config/nvim/lua/astronvim/lazy.lua @@ -37,7 +37,7 @@ require("lazy").setup(astronvim.user_opts("lazy", { performance = { rtp = { paths = astronvim.supported_configs, - disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" }, + disabled_plugins = { "tohtml", "gzip", "zipPlugin", "netrwPlugin", "tarPlugin" }, }, }, lockfile = vim.fn.stdpath "data" .. "/lazy-lock.json", diff --git a/nvim/.config/nvim/lua/astronvim/mappings.lua b/nvim/.config/nvim/lua/astronvim/mappings.lua index b7a486a..7301d7b 100644 --- a/nvim/.config/nvim/lua/astronvim/mappings.lua +++ b/nvim/.config/nvim/lua/astronvim/mappings.lua @@ -10,8 +10,9 @@ local sections = { l = { desc = " LSP" }, u = { desc = " UI" }, b = { desc = " Buffers" }, + bs = { desc = " Sort Buffers" }, d = { desc = " Debugger" }, - g = { desc = " Git" }, + g = { desc = " Git" }, S = { desc = " Session" }, t = { desc = " Terminal" }, } @@ -19,10 +20,8 @@ if not vim.g.icons_enabled then vim.tbl_map(function(opts) opts.desc = opts.desc -- Normal -- -- Standard Operations -maps.n["j"] = { "v:count ? 'j' : 'gj'", expr = true, desc = "Move cursor down" } -maps.n["k"] = { "v:count ? 'k' : 'gk'", expr = true, desc = "Move cursor up" } -maps.v["j"] = maps.n.j -maps.v["k"] = maps.n.k +maps.n["j"] = { "v:count == 0 ? 'gj' : 'j'", expr = true, desc = "Move cursor down" } +maps.n["k"] = { "v:count == 0 ? 'gk' : 'k'", expr = true, desc = "Move cursor up" } maps.n["<leader>w"] = { "<cmd>w<cr>", desc = "Save" } maps.n["<leader>q"] = { "<cmd>confirm q<cr>", desc = "Quit" } maps.n["<leader>n"] = { "<cmd>enew<cr>", desc = "New File" } @@ -50,7 +49,7 @@ maps.n["<leader>pl"] = { "<cmd>AstroChangelog<cr>", desc = "AstroNvim Changelog" maps.n["<leader>c"] = { function() require("astronvim.utils.buffer").close() end, desc = "Close buffer" } maps.n["<leader>C"] = { function() require("astronvim.utils.buffer").close(0, true) end, desc = "Force close buffer" } maps.n["]b"] = -{ function() require("astronvim.utils.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end, desc = "Next buffer" } + { function() require("astronvim.utils.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end, desc = "Next buffer" } maps.n["[b"] = { function() require("astronvim.utils.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end, desc = "Previous buffer", @@ -66,7 +65,7 @@ maps.n["<b"] = { maps.n["<leader>b"] = sections.b maps.n["<leader>bc"] = -{ function() require("astronvim.utils.buffer").close_all(true) end, desc = "Close all buffers except current" } + { function() require("astronvim.utils.buffer").close_all(true) end, desc = "Close all buffers except current" } maps.n["<leader>bC"] = { function() require("astronvim.utils.buffer").close_all() end, desc = "Close all buffers" } maps.n["<leader>bb"] = { function() @@ -82,6 +81,21 @@ maps.n["<leader>bd"] = { end, desc = "Delete buffer from tabline", } +maps.n["<leader>bl"] = + { function() require("astronvim.utils.buffer").close_left() end, desc = "Close all buffers to the left" } +maps.n["<leader>br"] = + { function() require("astronvim.utils.buffer").close_right() end, desc = "Close all buffers to the right" } +maps.n["<leader>bs"] = sections.bs +maps.n["<leader>bse"] = + { function() require("astronvim.utils.buffer").sort "extension" end, desc = "Sort by extension (buffers)" } +maps.n["<leader>bsr"] = + { function() require("astronvim.utils.buffer").sort "unique_path" end, desc = "Sort by relative path (buffers)" } +maps.n["<leader>bsp"] = + { function() require("astronvim.utils.buffer").sort "full_path" end, desc = "Sort by full path (buffers)" } +maps.n["<leader>bsi"] = + { function() require("astronvim.utils.buffer").sort "bufnr" end, desc = "Sort by buffer number (buffers)" } +maps.n["<leader>bsm"] = + { function() require("astronvim.utils.buffer").sort "modified" end, desc = "Sort by modification (buffers)" } maps.n["<leader>b\\"] = { function() require("astronvim.utils.status").heirline.buffer_picker(function(bufnr) @@ -126,7 +140,7 @@ if is_available "Comment.nvim" then desc = "Comment line", } maps.v["<leader>/"] = - { "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", desc = "Toggle comment line" } + { "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", desc = "Toggle comment line" } end -- GitSigns @@ -168,7 +182,19 @@ if is_available "neovim-session-manager" then maps.n["<leader>Sd"] = { "<cmd>SessionManager! delete_session<cr>", desc = "Delete session" } maps.n["<leader>Sf"] = { "<cmd>SessionManager! load_session<cr>", desc = "Search sessions" } maps.n["<leader>S."] = - { "<cmd>SessionManager! load_current_dir_session<cr>", desc = "Load current directory session" } + { "<cmd>SessionManager! load_current_dir_session<cr>", desc = "Load current directory session" } +end +if is_available "resession.nvim" then + maps.n["<leader>S"] = sections.S + maps.n["<leader>Sl"] = { function() require("resession").load "Last Session" end, desc = "Load last session" } + maps.n["<leader>Ss"] = { function() require("resession").save() end, desc = "Save this session" } + maps.n["<leader>St"] = { function() require("resession").save_tab() end, desc = "Save this tab's session" } + maps.n["<leader>Sd"] = { function() require("resession").delete() end, desc = "Delete a session" } + maps.n["<leader>Sf"] = { function() require("resession").load() end, desc = "Load a session" } + maps.n["<leader>S."] = { + function() require("resession").load(vim.fn.getcwd(), { dir = "dirsession" }) end, + desc = "Load current directory session", + } end -- Package Manager @@ -217,11 +243,11 @@ if is_available "telescope.nvim" then function() local cwd = vim.fn.stdpath "config" .. "/.." local search_dirs = {} - for _, dir in ipairs(astronvim.supported_configs) do -- search all supported config locations - if dir == astronvim.install.home then dir = dir .. "/lua/user" end -- don't search the astronvim core files + for _, dir in ipairs(astronvim.supported_configs) do -- search all supported config locations + if dir == astronvim.install.home then dir = dir .. "/lua/user" end -- don't search the astronvim core files if vim.fn.isdirectory(dir) == 1 then table.insert(search_dirs, dir) end -- add directory to search if exists end - if vim.tbl_isempty(search_dirs) then -- if no config folders found, show warning + if vim.tbl_isempty(search_dirs) then -- if no config folders found, show warning utils.notify("No user configuration files found", vim.log.levels.WARN) else if #search_dirs == 1 then cwd = search_dirs[1] end -- if only one directory, focus cwd @@ -236,7 +262,7 @@ if is_available "telescope.nvim" then } maps.n["<leader>fb"] = { function() require("telescope.builtin").buffers() end, desc = "Find buffers" } maps.n["<leader>fc"] = - { function() require("telescope.builtin").grep_string() end, desc = "Find for word under cursor" } + { function() require("telescope.builtin").grep_string() end, desc = "Find for word under cursor" } maps.n["<leader>fC"] = { function() require("telescope.builtin").commands() end, desc = "Find commands" } maps.n["<leader>ff"] = { function() require("telescope.builtin").find_files() end, desc = "Find files" } maps.n["<leader>fF"] = { @@ -248,12 +274,12 @@ if is_available "telescope.nvim" then maps.n["<leader>fm"] = { function() require("telescope.builtin").man_pages() end, desc = "Find man" } if is_available "nvim-notify" then maps.n["<leader>fn"] = - { function() require("telescope").extensions.notify.notify() end, desc = "Find notifications" } + { function() require("telescope").extensions.notify.notify() end, desc = "Find notifications" } end maps.n["<leader>fo"] = { function() require("telescope.builtin").oldfiles() end, desc = "Find history" } maps.n["<leader>fr"] = { function() require("telescope.builtin").registers() end, desc = "Find registers" } maps.n["<leader>ft"] = - { function() require("telescope.builtin").colorscheme { enable_preview = true } end, desc = "Find themes" } + { function() require("telescope.builtin").colorscheme { enable_preview = true } end, desc = "Find themes" } maps.n["<leader>fw"] = { function() require("telescope.builtin").live_grep() end, desc = "Find words" } maps.n["<leader>fW"] = { function() @@ -308,14 +334,19 @@ end if is_available "nvim-dap" then maps.n["<leader>d"] = sections.d + maps.v["<leader>d"] = sections.d -- modified function keys found with `showkey -a` in the terminal to get key code -- run `nvim -V3log +quit` and search through the "Terminal info" in the `log` file for the correct keyname - maps.n["<F1>"] = { function() require("dap").continue() end, desc = "Debugger: Start" } - maps.n["<F3>"] = { - function() require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, - desc = "Toggle Conditional Breakpoint" + maps.n["<F5>"] = { function() require("dap").continue() end, desc = "Debugger: Start" } + maps.n["<F17>"] = { function() require("dap").terminate() end, desc = "Debugger: Stop" } -- Shift+F5 + maps.n["<F21>"] = { + function() + vim.ui.input({ prompt = "Condition: " }, function(condition) + if condition then require("dap").set_breakpoint(condition) end + end) + end, + desc = "Debugger: Conditional Breakpoint", } - maps.n["<F17>"] = { function() require("dap").terminate() end, desc = "Debugger: Stop" } -- Shift+F5 maps.n["<F29>"] = { function() require("dap").restart_frame() end, desc = "Debugger: Restart" } -- Control+F5 maps.n["<F6>"] = { function() require("dap").pause() end, desc = "Debugger: Pause" } maps.n["<F9>"] = { function() require("dap").toggle_breakpoint() end, desc = "Debugger: Toggle Breakpoint" } @@ -323,12 +354,16 @@ if is_available "nvim-dap" then maps.n["<F11>"] = { function() require("dap").step_into() end, desc = "Debugger: Step Into" } maps.n["<F23>"] = { function() require("dap").step_out() end, desc = "Debugger: Step Out" } -- Shift+F11 maps.n["<leader>db"] = { function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint (F9)" } - maps.n["<leader>dbc"] = { - function() require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, - desc = "Toggle Conditional Breakpoint" - } maps.n["<leader>dB"] = { function() require("dap").clear_breakpoints() end, desc = "Clear Breakpoints" } maps.n["<leader>dc"] = { function() require("dap").continue() end, desc = "Start/Continue (F5)" } + maps.n["<leader>dC"] = { + function() + vim.ui.input({ prompt = "Condition: " }, function(condition) + if condition then require("dap").set_breakpoint(condition) end + end) + end, + desc = "Conditional Breakpoint (S-F9)", + } maps.n["<leader>di"] = { function() require("dap").step_into() end, desc = "Step Into (F11)" } maps.n["<leader>do"] = { function() require("dap").step_over() end, desc = "Step Over (F10)" } maps.n["<leader>dO"] = { function() require("dap").step_out() end, desc = "Step Out (S-F11)" } @@ -337,7 +372,18 @@ if is_available "nvim-dap" then maps.n["<leader>dp"] = { function() require("dap").pause() end, desc = "Pause (F6)" } maps.n["<leader>dr"] = { function() require("dap").restart_frame() end, desc = "Restart (C-F5)" } maps.n["<leader>dR"] = { function() require("dap").repl.toggle() end, desc = "Toggle REPL" } + maps.n["<leader>ds"] = { function() require("dap").run_to_cursor() end, desc = "Run To Cursor" } + if is_available "nvim-dap-ui" then + maps.n["<leader>dE"] = { + function() + vim.ui.input({ prompt = "Expression: " }, function(expr) + if expr then require("dapui").eval(expr) end + end) + end, + desc = "Evaluate Input", + } + maps.v["<leader>dE"] = { function() require("dapui").eval() end, desc = "Evaluate Input" } maps.n["<leader>du"] = { function() require("dapui").toggle() end, desc = "Toggle Debugger UI" } maps.n["<leader>dh"] = { function() require("dap.ui.widgets").hover() end, desc = "Debugger Hover" } end @@ -374,7 +420,7 @@ maps.n["<leader>ud"] = { ui.toggle_diagnostics, desc = "Toggle diagnostics" } maps.n["<leader>ug"] = { ui.toggle_signcolumn, desc = "Toggle signcolumn" } maps.n["<leader>ui"] = { ui.set_indent, desc = "Change indent setting" } maps.n["<leader>ul"] = { ui.toggle_statusline, desc = "Toggle statusline" } -maps.n["<leader>uL"] = { ui.toggle_codelens, desc = "Toggle CodeLens refresh" } +maps.n["<leader>uL"] = { ui.toggle_codelens, desc = "Toggle CodeLens" } maps.n["<leader>un"] = { ui.change_number, desc = "Change line numbering" } maps.n["<leader>uN"] = { ui.toggle_ui_notifications, desc = "Toggle UI notifications" } maps.n["<leader>up"] = { ui.toggle_paste, desc = "Toggle paste mode" } diff --git a/nvim/.config/nvim/lua/astronvim/options.lua b/nvim/.config/nvim/lua/astronvim/options.lua index 0fce646..2a94c75 100644 --- a/nvim/.config/nvim/lua/astronvim/options.lua +++ b/nvim/.config/nvim/lua/astronvim/options.lua @@ -38,7 +38,6 @@ local options = astronvim.user_opts("options", { smartcase = true, -- Case sensitivie searching smartindent = true, -- Smarter autoindentation splitbelow = true, -- Splitting a new window below the current one - splitkeep = vim.fn.has "nvim-0.9" == 1 and "screen" or nil, -- Maintain code view when splitting splitright = true, -- Splitting a new window at the right of the current one tabstop = 2, -- Number of space in a tab termguicolors = true, -- Enable 24-bit RGB color in the TUI @@ -61,7 +60,7 @@ local options = astronvim.user_opts("options", { icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available) ui_notifications_enabled = true, -- disable notifications when toggling UI elements }, - t = { bufs = vim.api.nvim_list_bufs() }, -- initialize buffers for the current tab + t = vim.t.bufs and vim.t.bufs or { bufs = vim.api.nvim_list_bufs() }, -- initialize buffers for the current tab }) for scope, table in pairs(options) do diff --git a/nvim/.config/nvim/lua/astronvim/utils/buffer.lua b/nvim/.config/nvim/lua/astronvim/utils/buffer.lua index cc8249c..8a2a1ab 100644 --- a/nvim/.config/nvim/lua/astronvim/utils/buffer.lua +++ b/nvim/.config/nvim/lua/astronvim/utils/buffer.lua @@ -69,7 +69,7 @@ function M.close(bufnr, force) if require("astronvim.utils").is_available "bufdelete.nvim" then require("bufdelete").bufdelete(bufnr, force) else - vim.cmd((force and "bd!" or "confirm bd") .. bufnr) + vim.cmd((force and "bd!" or "confirm bd") .. (bufnr == nil and "" or bufnr)) end end @@ -77,18 +77,49 @@ end ---@param keep_current? boolean Whether or not to keep the current buffer (default: false) ---@param force? boolean Whether or not to foce close the buffers or confirm changes (default: false) function M.close_all(keep_current, force) - if force == nil then force = false end if keep_current == nil then keep_current = false end local current = vim.api.nvim_get_current_buf() for _, bufnr in ipairs(vim.t.bufs) do - if not keep_current or bufnr ~= current then - if require("astronvim.utils").is_available "bufdelete.nvim" then - require("bufdelete").bufdelete(bufnr, force) |
