diff --git a/etc/atuin/config.toml b/etc/atuin/config.toml index fd64fe39..d703c1a6 100644 --- a/etc/atuin/config.toml +++ b/etc/atuin/config.toml @@ -27,7 +27,7 @@ search_mode = "skim" ## which filter mode to use ## possible values: global, host, session, directory -filter_mode = "global" +filter_mode = "host" ## With workspace filtering enabled, Atuin will filter for commands executed ## in any directory within a git repository tree (default: false) diff --git a/lua/_lazy.lua b/lua/_lazy.lua index 59156afb..ab120cf1 100644 --- a/lua/_lazy.lua +++ b/lua/_lazy.lua @@ -18,6 +18,7 @@ local plugins = { { import = "plugins.colorscheme" }, { import = "plugins.suda" }, { import = "plugins.mini" }, + { import = "plugins.snacks" }, { import = "plugins.misc" }, -- editor {{{ @@ -48,7 +49,7 @@ local plugins = { { "fcying/vim-plugin-AnsiEsc", cmd = { "AnsiEsc", "AnsiEscClear" } }, { "stevearc/dressing.nvim", opts = {} }, -- { import = "plugins.noice" }, - { import = "plugins.nvim_notify" }, + -- { import = "plugins.nvim_notify" }, -- { import = "plugins.ZFVimIM" }, -- { import = "plugins.ZFVimDirDiff" }, { import = "plugins.fugitive" }, diff --git a/lua/keymap.lua b/lua/keymap.lua index d7dd4fbb..b450efc5 100644 --- a/lua/keymap.lua +++ b/lua/keymap.lua @@ -21,7 +21,7 @@ map("", "", function() if vim.v.hlsearch == 1 then vim.cmd("noh") end - require("notify").dismiss({}) + -- require("notify").dismiss({}) end) -- cmd-line window dd {{{ @@ -152,12 +152,6 @@ noremap 9 :tabn 9 noremap 0 :tabn 10 ]]) - -map("n", "", ":set number! number?") -map("n", "", ":set list! list?") -map("n", "", ":set wrap! wrap?") -map("n", "", ":exec exists('syntax_on') ? 'syn off' : 'syn on'") - -- quickfix {{{ map("n", "]q", ":cnext") map("n", "[q", ":cprev") diff --git a/lua/lsp.lua b/lua/lsp.lua index 57128560..f6900598 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -25,18 +25,6 @@ Formats = { }, } -local diagnostics_on = true -function M.diagnostic_toggle() - if diagnostics_on then - vim.notify("disable diagnostics") - vim.diagnostic.enable(false) - else - vim.notify("enable diagnostics") - vim.diagnostic.enable(true) - end - diagnostics_on = not diagnostics_on -end - ---@diagnostic disable-next-line unused-local local function diagnostics_config(enable) if enable == nil then @@ -306,7 +294,6 @@ function M.setup() map("n", "la", function() require("actions-preview").code_actions() end, opts) map("n", "ld", "Telescope diagnostics bufnr=0", opts) map("n", "ls", "Telescope lsp_workspace_symbols", opts) - map("n", "ltd", 'lua require("lsp").diagnostic_toggle()', opts) map("n", "lr", "LspRestart", opts) map("n", "lf", "lua require('lsp').format()", opts) map("v", "lf", "lua require('lsp').format()", opts) diff --git a/lua/option.lua b/lua/option.lua index 75a9de4e..85e4eeaf 100644 --- a/lua/option.lua +++ b/lua/option.lua @@ -240,17 +240,3 @@ else } -- end end - --- large file {{{ -vim.cmd([[ -let g:LargeFile = 1024 * 1024 * 10 -autocmd myau BufReadPre * let f=getfsize(expand("")) | if f > g:LargeFile || f == -2 | call LargeFile() | endif -function! LargeFile() - "set binary - setlocal eventignore+=FileType "no syntax highlighting etc - setlocal bufhidden=unload "save memory when other file is viewed - setlocal undolevels=-1 "no undo possible - " display message - autocmd myau VimEnter * echo "The file is larger than " . (g:LargeFile / 1024 / 1024) . " MB, so some options are changed (see vim config for details)." -endfunction -]]) diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua index 05c836a9..55de9254 100644 --- a/lua/plugins/mini.lua +++ b/lua/plugins/mini.lua @@ -1,11 +1,4 @@ return { - { - "echasnovski/mini.bufremove", - keys = { { "q", function() require("mini.bufremove").delete() end, desc = "Quit Buffer" } }, - config = function() - require("mini.bufremove").setup() - end - }, { "echasnovski/mini.surround", keys = { "s" }, diff --git a/lua/plugins/misc.lua b/lua/plugins/misc.lua index 64c43539..4fa599b4 100644 --- a/lua/plugins/misc.lua +++ b/lua/plugins/misc.lua @@ -1,6 +1,5 @@ return { { "wsdjeg/vim-fetch", lazy = false }, - -- { "ojroques/nvim-osc52", opts = { silent = true, trim = false } }, { "mbbill/fencview", cmd = { "FencView", "FencAutoDetect" }, @@ -10,21 +9,12 @@ return { end, }, { - "ethanholz/nvim-lastplace", - lazy = false, - config = function() - require("nvim-lastplace").setup { - lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, - lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" }, - lastplace_open_folds = true - } + "farmergreg/vim-lastplace", + init = function () + vim.g.lastplace_ignore = "gitcommit,gitrebase,hgcommit,svn,xxd" + vim.g.lastplace_ignore_buftype = "help,nofile,quickfix" + vim.g.lastplace_open_folds = 0 end }, - -- { - -- "karb94/neoscroll.nvim", - -- config = function() - -- require("neoscroll").setup({}) - -- end - -- }, --{ 'simnalamburt/vim-mundo', event = 'VimEnter' }, } diff --git a/lua/plugins/multicursor.lua b/lua/plugins/multicursor.lua index b1048299..03188b54 100644 --- a/lua/plugins/multicursor.lua +++ b/lua/plugins/multicursor.lua @@ -22,7 +22,7 @@ return { if vim.v.hlsearch == 1 then vim.cmd("noh") end - require("notify").dismiss({}) + -- require("notify").dismiss({}) end end) diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua new file mode 100644 index 00000000..5e0b043e --- /dev/null +++ b/lua/plugins/snacks.lua @@ -0,0 +1,81 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + keys = { + { "un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" }, + { "q", function() Snacks.bufdelete() end, desc = "Delete Buffer" }, + { "gg", function() Snacks.lazygit() end, desc = "Lazygit" }, + { "gb", function() Snacks.git.blame_line() end, desc = "Git Blame Line" }, + { "gB", function() Snacks.gitbrowse() end, desc = "Git Browse" }, + { "gf", function() Snacks.lazygit.log_file() end, desc = "Lazygit Current File History" }, + { "gl", function() Snacks.lazygit.log() end, desc = "Lazygit Log (cwd)" }, + { + "N", + desc = "Neovim News", + function() + Snacks.win({ + file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], + width = 0.6, + height = 0.6, + wo = { spell = false, wrap = false, signcolumn = "yes", statuscolumn = " ", conceallevel = 3, }, + }) + end, + } + }, + ---@module 'snacks' + ---@type snacks.Config + opts = { + bigfile = { + notify = true, + size = 1.5 * 1024 * 1024, + ---@param ctx {buf: number, ft:string} + setup = function(ctx) + vim.b.minianimate_disable = true + vim.schedule(function() + vim.bo[ctx.buf].syntax = ctx.ft + end) + end, + }, + notifier = { + enabled = true, + timeout = 3000, + }, + quickfile = { enabled = true }, + statuscolumn = { enabled = true }, + words = { enabled = false }, + styles = { + notification = { + wo = { wrap = true } -- Wrap notifications + } + } + }, + init = function() + vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + -- Setup some globals for debugging (lazy-loaded) + _G.dd = function(...) + Snacks.debug.inspect(...) + end + _G.bt = function() + Snacks.debug.backtrace() + end + vim.print = _G.dd -- Override print to use snacks for `:=` command + + -- Create some toggle mappings + Snacks.toggle.option("spell", { name = "Spelling" }):map("us") + Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") + Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") + Snacks.toggle.diagnostics():map("ud") + Snacks.toggle.line_number():map("ul") + Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }) + :map("uc") + Snacks.toggle.treesitter():map("uT") + Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map( + "ub") + Snacks.toggle.inlay_hints():map("uh") + end, + }) + end, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 129e54f4..04177c69 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -149,7 +149,7 @@ M.setup = { --{{{ { "fl", "Telescope current_buffer_fuzzy_find", desc = "line" }, { "fo", "Telescope oldfiles", desc = "mru" }, { "fm", "Telescope marks", desc = "marks" }, - { "fn", "Telescope notify", desc = "notify" }, + { "fn", "lua Snacks.notifier.show_history({})", desc = "notify" }, { "fr", "Telescope resume", desc = "resume" }, { "ft", "Telescope tags", desc = "tag" }, { "f/", function() require("util").live_grep() end, mode = {"n", "x"}, desc = "live grep" }, @@ -218,7 +218,7 @@ M.setup = { --{{{ }, }, }) - require("telescope").load_extension("notify") + -- require("telescope").load_extension("notify") require("telescope").load_extension("fzf") require("telescope").load_extension("ctags_outline") require("telescope").load_extension("live_grep_args") diff --git a/lua/plugins/toggleterm.lua b/lua/plugins/toggleterm.lua index f3066f07..b5a9c3d0 100644 --- a/lua/plugins/toggleterm.lua +++ b/lua/plugins/toggleterm.lua @@ -13,16 +13,6 @@ return { float_opts = float_opts, clear_env = true, }) - local lazygit = require("toggleterm.terminal").Terminal:new { - cmd = "lazygit", - hidden = true, - direction = "float", - float_opts = float_opts, - on_create = function(t) - local bufnr = t.bufnr - vim.keymap.set("t", "", "", { buffer = bufnr }) - end, - } local toggle = function() if vim.bo.filetype == "toggleterm" then vim.cmd("ToggleTerm direction=float") @@ -43,7 +33,6 @@ return { { "tt", "ToggleTerm", desc = "ToggleTerm" }, { "tf", "ToggleTerm direction=float", desc = "ToggleTerm float" }, { "gt", function() tig:toggle() end, desc = "tig" }, - { "gl", function() lazygit:toggle() end, desc = "lazygit" }, } end, config = function()