init: new dotfile configuration
Remove all org files using a new script to more config over, The old org file configuaration were great but required org. This new version only requires the scripts that is included in the repo. The configuration are all done but have not ported the theming system yet. Signed-off-by: Steve Beaulac <steve@sagacity.ca> Change-Id: I14cd7fe058a71c8ba9d6d35397dc8d7e6a6a6964
This commit is contained in:
@@ -0,0 +1,441 @@
|
||||
return {
|
||||
|
||||
{ "nvim-lua/plenary.nvim", lazy = true },
|
||||
|
||||
{ "nvim-tree/nvim-web-devicons", lazy = true, opts = {} },
|
||||
|
||||
{
|
||||
'nvim-mini/mini.extra',
|
||||
lazy = true,
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-mini/mini.ai',
|
||||
lazy = false,
|
||||
version = '*',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
},
|
||||
config = function()
|
||||
local MiniExtra = require('mini.extra')
|
||||
local ai = require('mini.ai')
|
||||
local spec_treesitter = ai.gen_spec.treesitter
|
||||
ai.setup({
|
||||
custom_textobjects = {
|
||||
B = MiniExtra.gen_ai_spec.buffer(),
|
||||
I = MiniExtra.gen_ai_spec.indent(),
|
||||
L = MiniExtra.gen_ai_spec.line(),
|
||||
N = MiniExtra.gen_ai_spec.number(),
|
||||
F = spec_treesitter({ a = '@function.outer', i = '@function.inner' }),
|
||||
C = spec_treesitter({ a = '@comment.outer', i = '@comment.inner' }),
|
||||
P = spec_treesitter({ a = '@parameter.outer', i = '@parameter.inner' }),
|
||||
O = spec_treesitter({ a = '@block.outter', i = '@block.inner' }),
|
||||
k = spec_treesitter({ a = '@class.outer', i = '@class.inner' }),
|
||||
o = spec_treesitter({
|
||||
a = { '@conditional.outer', '@loop.outer' },
|
||||
i = { '@conditional.inner', '@loop.inner' },
|
||||
})
|
||||
}
|
||||
})
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-mini/mini.move',
|
||||
lazy = false,
|
||||
version = '*',
|
||||
opts = {}
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-mini/mini.align',
|
||||
lazy = false,
|
||||
version = '*',
|
||||
opts = {}
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-mini/mini.bracketed',
|
||||
lazy = false,
|
||||
version = '*',
|
||||
opts = {}
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-mini/mini.operators',
|
||||
lazy = false,
|
||||
version = '*',
|
||||
opts = {
|
||||
evaluate = { prefix = 'g|', func = nil, },
|
||||
exchange = { prefix = 'g.', reindent_linewise = true, },
|
||||
multiply = { prefix = 'gm', func = nil, },
|
||||
replace = { prefix = 'gk', reindent_linewise = true, },
|
||||
sort = { prefix = 'gs', func = nil, }
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-mini/mini.surround',
|
||||
lazy = false,
|
||||
version = '*',
|
||||
opts = {
|
||||
-- Add custom surroundings to be used on top of builtin ones. For more
|
||||
-- information with examples, see `:h MiniSurround.config`.
|
||||
-- custom_surroundings = {
|
||||
-- s = { input = { '%[%[().-()%]%]' }, output = { left = '[[', right = ']]' } },
|
||||
-- },
|
||||
mappings = {
|
||||
add = 'sa', -- Add surrounding in Normal and Visual modes
|
||||
delete = 'sd', -- Delete surrounding
|
||||
find = 'sf', -- Find surrounding (to the right)
|
||||
find_left = 'sF', -- Find surrounding (to the left)
|
||||
highlight = 'sh', -- Highlight surrounding
|
||||
replace = 'sr', -- Replace surrounding
|
||||
update_n_lines = 'sn', -- Update `n_lines`
|
||||
|
||||
suffix_last = 'l', -- Suffix to search with "prev" method
|
||||
suffix_next = 'n', -- Suffix to search with "next" method
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-mini/mini.splitjoin',
|
||||
lazy = false,
|
||||
version = false,
|
||||
config = function()
|
||||
require('mini.splitjoin').setup()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-mini/mini.hipatterns",
|
||||
lazy = false,
|
||||
event = "BufReadPre",
|
||||
config = function()
|
||||
local MiniExtra = require("mini.extra")
|
||||
local hi_words = MiniExtra.gen_highlighter.words
|
||||
require('mini.hipatterns').setup({
|
||||
highlighters = {
|
||||
-- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE'
|
||||
fixme = hi_words({ 'FIXME', 'Fixme', 'fixme' }, "MiniHipatternsFixme"),
|
||||
hack = hi_words({ 'HACK', 'Hack', 'hack' }, "MiniHipatternsHack"),
|
||||
todo = hi_words({ 'TODO', 'Todo', 'todo' }, "MiniHipatternsTodo"),
|
||||
note = hi_words({ 'NOTE', 'Note', 'note' }, "MiniHipatternsNote"),
|
||||
done = hi_words({ 'DONE', 'Done', 'done' }, "MiniHipatternsFixme"),
|
||||
|
||||
-- Highlight hex color strings (`#rrggbb`) using that color
|
||||
-- hex_color = hipatterns.gen_highlighter.hex_color(),
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-mini/mini.files',
|
||||
event = 'VeryLazy',
|
||||
version = '*',
|
||||
keys = {
|
||||
{ "-", function() require("mini.files").open(vim.api.nvim_buf_get_name(0)) end, desc = "Open parent directory", mode = "n" },
|
||||
{ "<leader>-", function() require("mini.files").open() end, desc = "File Explore", mode = "n" },
|
||||
},
|
||||
opts = {
|
||||
mappings = {
|
||||
go_in = "<CR>", -- Map both Enter and L to enter directories or open files
|
||||
go_in_plus = "L",
|
||||
go_out = "-",
|
||||
go_out_plus = "H",
|
||||
close = "<Esc>",
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-mini/mini.sessions',
|
||||
version = '*',
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('mini.sessions').setup()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
animate = {
|
||||
enabled = false,
|
||||
duration = { step = 1, total = 1 },
|
||||
easing = "linear",
|
||||
},
|
||||
bigfile = { enabled = true },
|
||||
dashboard = { enabled = false },
|
||||
explorer = { enabled = false },
|
||||
image = {
|
||||
enabled = true,
|
||||
inline = false,
|
||||
scale = 3, -- nil | 1 (default) | 2 | 3 | ...
|
||||
doc = {
|
||||
inline = true,
|
||||
enabled = true,
|
||||
max_width = nil,
|
||||
max_height = nil,
|
||||
conceal = true,
|
||||
},
|
||||
math = {
|
||||
enabled = true,
|
||||
}
|
||||
},
|
||||
terminal = {
|
||||
bo = {
|
||||
filetype = "snacks_terminal",
|
||||
},
|
||||
win = { style = "terminal" },
|
||||
wo = {},
|
||||
keys = {
|
||||
q = "hide",
|
||||
gf = function(self)
|
||||
local f = vim.fn.findfile(vim.fn.expand("<cfile>"), "**")
|
||||
if f == "" then
|
||||
Snacks.notify.warn("No file under cursor")
|
||||
else
|
||||
self:hide()
|
||||
vim.schedule(function()
|
||||
vim.cmd("e " .. f)
|
||||
end)
|
||||
end
|
||||
end,
|
||||
term_normal = {
|
||||
"<esc><esc>",
|
||||
function(self)
|
||||
self.esc_timer = self.esc_timer or (vim.uv or vim.loop).new_timer()
|
||||
if self.esc_timer:is_active() then
|
||||
self.esc_timer:stop()
|
||||
vim.cmd("stopinsert")
|
||||
else
|
||||
self.esc_timer:start(250, 0, function() end)
|
||||
return "<esc>"
|
||||
end
|
||||
end,
|
||||
mode = "t",
|
||||
expr = true,
|
||||
desc = "Double escape to normal mode",
|
||||
},
|
||||
},
|
||||
},
|
||||
indent = { enabled = false },
|
||||
notifier = {
|
||||
enabled = true,
|
||||
timeout = 1000,
|
||||
},
|
||||
picker = {
|
||||
enabled = true,
|
||||
layout = { preset = "ivy", layout = { position = "bottom" } },
|
||||
frecency = true,
|
||||
history_bonus = true,
|
||||
projects = {
|
||||
dev = { "~/Projects", },
|
||||
},
|
||||
win = {
|
||||
input = {
|
||||
keys = {
|
||||
['<c-e>'] = { 'layout_right', mode = { 'i', 'n' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
sources = {
|
||||
files = {
|
||||
-- add a custom action
|
||||
actions = {
|
||||
create_if_missing = function(picker, item)
|
||||
-- When typing in the input, item may be nil.
|
||||
-- We'll use the input text as the intended file path.
|
||||
local input = picker.input and picker.input:get() or ""
|
||||
if input == "" then return end
|
||||
|
||||
-- Make it relative to picker cwd if it’s not absolute
|
||||
local cwd = picker.opts.cwd or vim.loop.cwd()
|
||||
local path = input
|
||||
if not path:match("^/") and not path:match("^%a:[/\\]") then
|
||||
path = cwd .. "/" .. path
|
||||
end
|
||||
|
||||
-- Normalize path (optional)
|
||||
path = vim.fn.fnamemodify(path, ":p")
|
||||
|
||||
-- If file exists, just open it
|
||||
if vim.loop.fs_stat(path) then
|
||||
picker:close()
|
||||
vim.cmd.edit(path)
|
||||
return
|
||||
end
|
||||
|
||||
-- Ensure parent dirs exist (optional but nice)
|
||||
vim.fn.mkdir(vim.fn.fnamemodify(path, ":h"), "p")
|
||||
|
||||
-- Open a new buffer at that path (creates buffer even if file missing)
|
||||
picker:close()
|
||||
vim.cmd.edit(path)
|
||||
-- At this point buffer is new + unnamed-on-disk until you :w
|
||||
end,
|
||||
},
|
||||
|
||||
-- bind the action to a key in the picker UI
|
||||
win = {
|
||||
input = {
|
||||
keys = {
|
||||
["<M-n>"] = { "create_if_missing", mode = { "i", "n" }, desc = "Create file from input" },
|
||||
},
|
||||
},
|
||||
list = {
|
||||
keys = {
|
||||
["<M-n>"] = { "create_if_missing", mode = { "n" }, desc = "Create file from input" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
scope = { enabled = false },
|
||||
scratch = {
|
||||
ft = "markdown",
|
||||
},
|
||||
statuscolumn = { enabled = true },
|
||||
styles = {
|
||||
notification = {
|
||||
-- wo = { wrap = true } -- Wrap notifications
|
||||
}
|
||||
}
|
||||
},
|
||||
keys = {
|
||||
-- Org Search
|
||||
{ "<leader>o/", function() Snacks.picker.grep({dirs = { os.getenv("HOME") .. "/Documents/notes" }}) end, desc = "Search Org Files" },
|
||||
-- { "<leader>o/", function() Snacks.picker.files({ cwd = os.getenv("HOME") .. "/Documents/notes" }) end, desc = "Find Document" },
|
||||
-- Top Pickers & Explorer
|
||||
{ "<leader><Space>", function() Snacks.picker.smart() end, desc = "Smart Find Files" },
|
||||
{ "<leader>j", function() Snacks.picker.files({args = { "--no-require-git" }}) end, desc = "Find Files" },
|
||||
{ "<leader>,", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
||||
{ "<leader>/", function() Snacks.picker.grep() end, desc = "Grep" },
|
||||
{ "<leader>:", function() Snacks.picker.command_history() end, desc = "Command History" },
|
||||
{ "<leader>n", function() Snacks.picker.notifications() end, desc = "Notification History" },
|
||||
{ "<leader>i", function() Snacks.picker.lsp_symbols() end, desc = "Symbols" },
|
||||
{ "<leader>I", function() Snacks.picker.lsp_workspace_symbols() end, desc = "LSP Workspace Symbols" },
|
||||
-- { "<leader>e", function() Snacks.explorer() end, desc = "File Explorer" },
|
||||
-- find
|
||||
{ "<leader>fb", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
||||
{ "<leader>fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" },
|
||||
{ "<leader>ff", function() Snacks.picker.files() end, desc = "Find Files" },
|
||||
{ "<leader>fg", function() Snacks.picker.git_files() end, desc = "Find Git Files" },
|
||||
{ "<leader>fp", function() Snacks.picker.projects() end, desc = "Projects" },
|
||||
{ "<leader>fr", function() Snacks.picker.recent() end, desc = "Recent" },
|
||||
-- git
|
||||
{ "<leader>gb", function() Snacks.picker.git_branches() end, desc = "Git Branches" },
|
||||
{ "<leader>gl", function() Snacks.picker.git_log() end, desc = "Git Log" },
|
||||
{ "<leader>gL", function() Snacks.picker.git_log_line() end, desc = "Git Log Line" },
|
||||
{ "<leader>gs", function() Snacks.picker.git_status() end, desc = "Git Status" },
|
||||
{ "<leader>gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" },
|
||||
{ "<leader>gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (Hunks)" },
|
||||
{ "<leader>gf", function() Snacks.picker.git_log_file() end, desc = "Git Log File" },
|
||||
-- Grep
|
||||
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
|
||||
{ "<leader>sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" },
|
||||
{ "<leader>sg", function() Snacks.picker.grep() end, desc = "Grep" },
|
||||
{ "<leader>sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" } },
|
||||
-- search
|
||||
{ '<leader>s"', function() Snacks.picker.registers() end, desc = "Registers" },
|
||||
{ '<leader>s/', function() Snacks.picker.search_history() end, desc = "Search History" },
|
||||
{ "<leader>sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" },
|
||||
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
|
||||
{ "<leader>sc", function() Snacks.picker.command_history() end, desc = "Command History" },
|
||||
{ "<leader>sC", function() Snacks.picker.commands() end, desc = "Commands" },
|
||||
{ "<leader>sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
|
||||
{ "<leader>sD", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" },
|
||||
{ "<leader>sh", function() Snacks.picker.help() end, desc = "Help Pages" },
|
||||
{ "<leader>sH", function() Snacks.picker.highlights() end, desc = "Highlights" },
|
||||
{ "<leader>si", function() Snacks.picker.icons() end, desc = "Icons" },
|
||||
{ "<leader>sj", function() Snacks.picker.jumps() end, desc = "Jumps" },
|
||||
{ "<leader>sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
|
||||
{ "<leader>sl", function() Snacks.picker.loclist() end, desc = "Location List" },
|
||||
{ "<leader>sm", function() Snacks.picker.marks() end, desc = "Marks" },
|
||||
{ "<leader>sM", function() Snacks.picker.man() end, desc = "Man Pages" },
|
||||
{ "<leader>sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" },
|
||||
{ "<leader>sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" },
|
||||
{ "<leader>sR", function() Snacks.picker.resume() end, desc = "Resume" },
|
||||
{ "<leader>su", function() Snacks.picker.undo() end, desc = "Undo History" },
|
||||
{ "<leader>sz", function() Snacks.picker.zoxide() end, desc = "Zoxide" },
|
||||
{ "<leader>uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" },
|
||||
-- LSP
|
||||
{ "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition" },
|
||||
{ "gD", function() Snacks.picker.lsp_declarations() end, desc = "Goto Declaration" },
|
||||
{ "grr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" },
|
||||
{ "gri", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" },
|
||||
{ "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" },
|
||||
{ "<leader>ss", function() Snacks.picker.lsp_symbols() end, desc = "LSP Symbols" },
|
||||
{ "<leader>sS", function() Snacks.picker.lsp_workspace_symbols() end, desc = "LSP Workspace Symbols" },
|
||||
-- Other
|
||||
{ "<leader>Z", function() Snacks.zen() end, desc = "Toggle Zen Mode" },
|
||||
{ "<leader>z", function() Snacks.zen.zoom() end, desc = "Toggle Zoom" },
|
||||
{ "<leader>.", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" },
|
||||
{ "<leader>S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" },
|
||||
-- { "<leader>n", function() Snacks.notifier.show_history() end, desc = "Notification History" },
|
||||
{ "<leader>bd", function() Snacks.bufdelete() end, desc = "Delete Buffer" },
|
||||
{ "<leader>bR", function() Snacks.rename.rename_file() end, desc = "Rename File" },
|
||||
{ "<leader>gB", function() Snacks.gitbrowse() end, desc = "Git Browse", mode = { "n", "v" } },
|
||||
{ "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" },
|
||||
{ "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" },
|
||||
{ "<c-_>", function() Snacks.terminal.toggle() end, desc = "Toggle Terminal", mode = { "n", "t" } },
|
||||
-- { "<Esc>", "<C-\\><C-n>", desc = "Exit Terminal Mode", mode = { "t" } },
|
||||
{ "]]", function() Snacks.words.jump(vim.v.count1) end, desc = "Next Reference", mode = { "n", "t" } },
|
||||
{ "[[", function() Snacks.words.jump(-vim.v.count1) end, desc = "Prev Reference", mode = { "n", "t" } },
|
||||
{
|
||||
"<leader>xN",
|
||||
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,
|
||||
}
|
||||
},
|
||||
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("<leader>us")
|
||||
Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw")
|
||||
Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL")
|
||||
Snacks.toggle.diagnostics():map("<leader>ud")
|
||||
Snacks.toggle.line_number():map("<leader>ul")
|
||||
Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map("<leader>uc")
|
||||
Snacks.toggle.treesitter():map("<leader>uT")
|
||||
Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map("<leader>ub")
|
||||
Snacks.toggle.inlay_hints():map("<leader>uh")
|
||||
Snacks.toggle.indent():map("<leader>ug")
|
||||
Snacks.toggle.dim():map("<leader>uD")
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user