This commit is contained in:
Greg 2026-03-02 14:24:36 +02:00
parent 3105e5e930
commit 518bd0673a
5 changed files with 72 additions and 50 deletions

View file

@ -1,4 +1,3 @@
function cfg --wraps='/usr/bin/git --git-dir=$HOME/.cfgstore/ --work-tree=$HOME' --description 'alias cfg=/usr/bin/git --git-dir=$HOME/.cfgstore/ --work-tree=$HOME'
/usr/bin/git --git-dir=$HOME/.cfgstore/ --work-tree=$HOME $argv
function cfg --wraps='/usr/bin/git --git-dir=$HOME/.cfgstore/ --work-tree=$HOME' --wraps='lg --git-dir=$HOME/.cfgstore/ --work-tree=$HOME' --description 'alias cfg=lg --git-dir=$HOME/.cfgstore/ --work-tree=$HOME'
lg --git-dir=$HOME/.cfgstore/ --work-tree=$HOME $argv
end

View file

@ -384,44 +384,44 @@ quitOnTopLevelReturn: false
# Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc
os:
# Command for editing a file. Should contain "{{filename}}".
edit: ""
# edit: ""
# Command for editing a file at a given line number. Should contain
# "{{filename}}", and may optionally contain "{{line}}".
editAtLine: ""
# editAtLine: ""
# Same as EditAtLine, except that the command needs to wait until the
# window is closed.
editAtLineAndWait: ""
# editAtLineAndWait: ""
# Whether lazygit suspends until an edit process returns
editInTerminal: false
# editInTerminal: false
# For opening a directory in an editor
openDirInEditor: ""
# openDirInEditor: ""
# A built-in preset that sets all of the above settings. Supported presets
# are defined in the getPreset function in editor_presets.go.
editPreset: ""
# editPreset: ""
# Command for opening a file, as if the file is double-clicked. Should
# contain "{{filename}}", but doesn't support "{{line}}".
open: ""
# open: ""
# Command for opening a link. Should contain "{{link}}".
openLink: ""
# openLink: ""
# CopyToClipboardCmd is the command for copying to clipboard.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard
copyToClipboardCmd: ""
# copyToClipboardCmd: ""
# ReadFromClipboardCmd is the command for reading the clipboard.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard
readFromClipboardCmd: ""
# readFromClipboardCmd: ""
# A shell startup file containing shell aliases or shell functions. This will be sourced before running any shell commands, so that shell functions are available in the `:` command prompt or even in custom commands.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#using-aliases-or-functions-in-shell-commands
shellFunctionsFile: ""
# shellFunctionsFile: ""
# If true, don't display introductory popups upon opening Lazygit.
disableStartupPopups: false

View file

@ -1,52 +1,57 @@
vim.keymap.set({ "n", "v" }, "<C-s>", ":w ++p<CR>", { desc = "save file" })
vim.keymap.set({ "i" }, "<C-s>", "<ESC>:w ++p<CR>a", { desc = "save file" })
vim.keymap.set("n", "<leader>;", ":", { desc = "command with ;" })
vim.keymap.set("v", "<leader>;", ":", { desc = "command with ;" })
vim.keymap.set("n", "q", ":bd<cr>", { desc = "close buffer" })
vim.keymap.set("n", "Q", ":%bd<cr>", { desc = "close all buffers" })
vim.keymap.set({ "n", "v" }, "d", '"_d', { desc = "delete without cut" })
vim.keymap.set({ "n", "v" }, "c", '"_c', { desc = "delete without cut" })
vim.keymap.set({ "v", "n" }, "vv", "<C-v>", { desc = "vv for visual block" })
vim.keymap.set("i", "jj", "<ESC>", { silent = true, desc = "back to normal with jj" })
vim.keymap.set("v", "p", '"_dP', { desc = "do not overwrite 0 register when pasting over selection" })
local map = vim.keymap.set
map({ "n", "v" }, "<C-s>", ":w ++p<CR>", { desc = "save file" })
map({ "i" }, "<C-s>", "<ESC>:w ++p<CR>a", { desc = "save file" })
map("n", "<leader>;", ":", { desc = "command with ;" })
map("v", "<leader>;", ":", { desc = "command with ;" })
map("n", "q", ":bd<cr>", { desc = "close buffer" })
map("n", "Q", ":%bd<cr>", { desc = "close all buffers" })
map({ "n", "v" }, "d", '"_d', { desc = "delete without cut" })
map({ "n", "v" }, "c", '"_c', { desc = "delete without cut" })
map({ "v", "n" }, "vv", "<C-v>", { desc = "vv for visual block" })
map("i", "jj", "<ESC>", { silent = true, desc = "back to normal with jj" })
map("v", "p", '"_dP', { desc = "do not overwrite 0 register when pasting over selection" })
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to pres <C-\><C-n>, which
-- is not what someone will guess without a bit more experience.
--
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
map("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
-- TIP: Disable arrow keys in normal mode
vim.keymap.set("n", "<left>", function()
map("n", "<left>", function()
vim.notify("Use h to move!!")
end)
vim.keymap.set("n", "<right>", function()
map("n", "<right>", function()
vim.notify("Use l to move!!")
end)
vim.keymap.set("n", "<up>", function()
map("n", "<up>", function()
vim.notify("Use k to move!!")
end)
vim.keymap.set("n", "<down>", function()
map("n", "<down>", function()
vim.notify("Use j to move!!")
end)
vim.keymap.set("n", "<X1Mouse>", "<C-O>", { silent = true, desc = "go back with mouse" })
vim.keymap.set("n", "<X2Mouse>", "<C-I>", { silent = true, desc = "go forward with mouse" })
map("n", "<X1Mouse>", "<C-O>", { silent = true, desc = "go back with mouse" })
map("n", "<X2Mouse>", "<C-I>", { silent = true, desc = "go forward with mouse" })
map("n", "<leader>bb", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
map("n", "<leader>`", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
-- Keybindings to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
--
-- See `:help wincmd` for a list of all window commands
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
map("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
map("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
map("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
map("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
vim.keymap.set("n", "<S-h>", ":bprevious<CR>", { desc = "Previous buffer" })
vim.keymap.set("n", "<S-l>", ":bnext<CR>", { desc = "Next buffer" })
map("n", "<S-h>", ":bprevious<CR>", { desc = "Previous buffer" })
map("n", "<S-l>", ":bnext<CR>", { desc = "Next buffer" })
vim.keymap.set("v", "<C-r>", function()
map("v", "<C-r>", function()
-- get contents of visual selection
-- handle unpack deprecation
table.unpack = table.unpack or unpack
@ -75,21 +80,30 @@ local default_diagnostics = function()
})
end
vim.keymap.set("n", "<leader>dd", function()
map("n", "<leader>dd", function()
vim.diagnostic.config({ virtual_lines = { current_line = true }, virtual_text = false })
default_diagnostics()
end, { desc = "show diagnostics in virtual lines" })
vim.keymap.set("n", "<leader>df", function()
map("n", "<leader>df", function()
vim.diagnostic.config({ virtual_text = false })
vim.diagnostic.open_float({ scope = "line" })
default_diagnostics()
end, { desc = "show diagnostics in floating window" })
vim.keymap.set("n", "<leader>j", ":try | cprev | catch | clast | catch | endtry<cr>zz", { desc = "quickfix prev" })
vim.keymap.set("n", "<leader>k", ":try | cnext | catch | cfirst | catch | endtry<cr>zz", { desc = "quickfix next" })
vim.keymap.set("n", "<leader>qf", ":Cfilter! ", { desc = "quickfix filter" })
map("n", "<leader>j", ":try | cprev | catch | clast | catch | endtry<cr>zz", { desc = "quickfix prev" })
map("n", "<leader>k", ":try | cnext | catch | cfirst | catch | endtry<cr>zz", { desc = "quickfix next" })
map("n", "<leader>qf", ":Cfilter! ", { desc = "quickfix filter" })
vim.keymap.set("n", "K", function()
map("n", "K", function()
vim.lsp.buf.hover({ border = "rounded" })
end, { buffer = bufnr, desc = "vim.lsp.buf.hover()" })
end, { desc = "vim.lsp.buf.hover()" })
-- Move lines
map("n", "<A-k>", ":execute 'move .-' . (v:count1 + 1)<cr>==", { desc = "Move Up" })
map("n", "<A-j>", ":execute 'move .+' . v:count1<cr>==", { desc = "Move Down" })
map("v", "<A-j>", ":<C-u>execute \"'<,'>move '>+\" . v:count1<cr>gv=gv", { desc = "Move Down" })
map("v", "<A-k>", ":<C-u>execute \"'<,'>move '<-\" . (v:count1 + 1)<cr>gv=gv", { desc = "Move Up" })
map("v", "<", "<gv")
map("v", ">", ">gv")

View file

@ -47,8 +47,10 @@ vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entere
vim.g.clipboard = "wl-copy"
vim.opt.clipboard:append("unnamedplus")
-- Save undo history
vim.opt.undofile = true
vim.opt.backup = false -- Don't create backup files
vim.opt.writebackup = false -- Don't create backup before writing
vim.opt.swapfile = false -- Don't create swap files
vim.opt.undofile = true -- Persistent undo
-- Off signcolumn on by default
vim.opt.signcolumn = "no"

View file

@ -3,6 +3,8 @@ vim.pack.add({ "https://github.com/folke/snacks.nvim" })
local Snacks = require("snacks")
local exclude = {
-- "**/home/**",
-- "**/media/**",
"**/.git/*",
"**/.next/*",
"**/.cursor/*",
@ -49,7 +51,12 @@ Snacks.setup({
layout = { fullscreen = true },
sources = {
select = { layout = { fullscreen = false } },
files = vim.tbl_deep_extend("force", { layout = { preset = "select", fullscreen = false } }, files),
files = {
ignored = true,
hidden = true,
exclude = exclude,
layout = { preset = "select", fullscreen = false },
},
grep = files,
lsp_symbols = files,
explorer = {
@ -116,7 +123,7 @@ local keys = {
{
"<leader>sf",
function()
Snacks.picker.files()
Snacks.picker.files({ exclude = exclude })
end,
desc = "Find Files",
},