lazyvim branch

This commit is contained in:
Zacharias-Brohn
2025-04-07 16:25:04 +02:00
commit e157e8985f
24 changed files with 1237 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
local autocmd = vim.api.nvim_create_autocmd
-- autocmd({ "BufEnter", "QuitPre" }, {
-- nested = false,
-- callback = function(e)
-- local tree = require("nvim-tree.api").tree
--
-- -- Nothing to do if tree is not opened
-- if not tree.is_visible() then
-- return
-- end
--
-- local winCount = 0
-- for _, winId in ipairs(vim.api.nvim_list_wins()) do
-- if vim.api.nvim_win_get_config(winId).focusable then
-- winCount = winCount + 1
-- end
-- end
--
-- -- We want to quit and only one window besides tree is left
-- if e.event == "QuitPre" and winCount == 2 then
-- vim.api.nvim_cmd({ cmd = "qall" }, {})
-- end
--
-- -- :bd was probably issued an only tree window is left
-- -- Behave as if tree was closed (see `:h :bd`)
-- if e.event == "BufEnter" and winCount == 1 then
-- -- Required to avoid "Vim:E444: Cannot close last window"
-- vim.defer_fn(function()
-- -- close nvim-tree: will go to the last buffer used before closing
-- tree.toggle({ find_file = true, focus = true })
-- -- re-open nivm-tree
-- tree.toggle({ find_file = true, focus = false })
-- end, 10)
-- end
-- end,
-- })
autocmd("VimEnter", {
callback = function()
--NVIM_ENTER=1
vim.cmd([[call chansend(v:stderr, "\033]1337;SetUserVar=NVIM_ENTER=MQ==\007")]])
end,
})
autocmd("VimLeavePre", {
callback = function()
--NVIM_ENTER=0
vim.cmd([[call chansend(v:stderr, "\033]1337;SetUserVar=NVIM_ENTER=MA==\007")]])
end,
})
autocmd("VimLeave", {
pattern = "*",
command = "set guicursor=a:ver25",
})
+23
View File
@@ -0,0 +1,23 @@
vim.keymap.del("n", "<leader>ur")
vim.keymap.del("n", "<leader>uf")
vim.keymap.del("n", "<leader>uF")
vim.keymap.del("n", "<leader>us")
vim.keymap.del("n", "<leader>uw")
vim.keymap.del("n", "<leader>uL")
vim.keymap.del("n", "<leader>ud")
vim.keymap.del("n", "<leader>ul")
vim.keymap.del("n", "<leader>uc")
vim.keymap.del("n", "<leader>uA")
vim.keymap.del("n", "<leader>uT")
vim.keymap.del("n", "<leader>ub")
vim.keymap.del("n", "<leader>uD")
vim.keymap.del("n", "<leader>ua")
vim.keymap.del("n", "<leader>ug")
-- vim.keymap.del("n", "<leader>uG")
vim.keymap.del("n", "<leader>up")
vim.keymap.del("n", "<leader>uS")
vim.keymap.del("n", "<leader>uh")
vim.keymap.del("n", "<leader>ui")
vim.keymap.del("n", "<leader>uI")
vim.keymap.del("n", "<leader>uZ")
vim.keymap.del("n", "<leader>uz")
+23
View File
@@ -0,0 +1,23 @@
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.g.base46_cache = vim.fn.stdpath("data") .. "/base46/"
vim.g.mapleader = " "
vim.g.gruvbox_material_background = "medium"
vim.g.coq_settings = { keymap = { recommended = false } }
vim.g.gruvbox_material_foreground = "original"
vim.api.nvim_set_hl(0, "GitGutterAdd", { fg = "#009900", ctermfg = 2 })
vim.api.nvim_set_hl(0, "GitGutterChange", { fg = "#bbbb00", ctermfg = 3 })
vim.api.nvim_set_hl(0, "GitGutterDelete", { fg = "#ff2222", ctermfg = 1 })
local bg_color = vim.api.nvim_get_hl(0, { name = "Normal" }).bg or "NONE"
vim.api.nvim_set_hl(
0,
"WinSeparator",
{ fg = vim.api.nvim_get_hl(0, { name = "NvimTreeEndOfBuffer" }).fg or "NONE", bg = "NONE" }
)
vim.api.nvim_set_hl(0, "WinSeparator", { fg = bg_color, bg = "NONE" })
vim.api.nvim_set_hl(0, "CursorLine", { bg = vim.api.nvim_get_hl(0, { name = "CursorLine" }).bg or "NONE" })
vim.api.nvim_set_hl(0, "LspReferenceWrite", { bg = vim.api.nvim_get_hl(0, { name = "CursorLine" }).bg or "NONE" })
vim.api.nvim_set_hl(0, "LspReferenceText", { bg = vim.api.nvim_get_hl(0, { name = "CursorLine" }).bg or "NONE" })
vim.api.nvim_set_hl(0, "LspReferenceRead", { bg = vim.api.nvim_get_hl(0, { name = "CursorLine" }).bg or "NONE" })
+79
View File
@@ -0,0 +1,79 @@
local map = vim.keymap.set
require("config.disable-default-keybinds")
map("n", "<Tab>", "<Cmd>BufferLineCycleNext<CR>")
map("n", "<S-Tab>", "<Cmd>BufferLineCyclePrev<CR>")
map("n", ";", ":", { desc = "CMD enter command mode" })
-- Move selected text up
map("v", "<C-Up>", ":m '<-2<CR>gv=gv", { desc = "Move selected text up" })
map("v", "<C-Down>", ":m '>+1<CR>gv=gv", { desc = "Move selected text down" })
-- Alt + Arrow Key to change buffer
map("n", "<A-Left>", "<C-w>h", { desc = "Move to left split" })
map("n", "<A-Down>", "<C-w>j", { desc = "Move to bottom split" })
map("n", "<A-Up>", "<C-w>k", { desc = "Move to top split" })
map("n", "<A-Right>", "<C-w>l", { desc = "Move to right split" })
-- Copilot Chat buffer
map("n", "<A-c>", vim.cmd.CopilotChatToggle)
map("i", "<A-c>", vim.cmd.CopilotChatToggle)
map("v", "<A-c>", vim.cmd.CopilotChatToggle)
-- map('n', '<leader>e', vim.cmd.NvimTreeToggle)
map("n", "<leader>e", function()
Snacks.explorer()
end)
map("n", "<leader>u", require("undotree").toggle, { noremap = true, silent = true })
map("n", "<A-->", ":bdelete<CR>")
-- map("n", "<SA-->", ":BufferRestore<CR>")
map("n", "<C-a>", "ggVG", { noremap = true, silent = true })
map("n", "<leader>pv", vim.cmd.Ex)
map("v", "J", ":m '>+1<CR>gv=gv")
map("v", "K", ":m '<-2<CR>gv=gv")
map("n", "J", "mzJ`z")
map("n", "<C-d>", "<C-d>zz")
map("n", "<C-u>", "<C-u>zz")
map("n", "n", "nzzzv")
map("n", "N", "Nzzzv")
map("n", "<leader>zig", "<cmd>LspRestart<cr>")
-- greatest remap ever
map("x", "<leader>p", [["_dP]])
-- next greatest remap ever : asbjornHaland
map({ "n", "v" }, "<leader>y", [["+y]])
map("n", "<leader>Y", [["+Y]])
map({ "n", "v" }, "<leader>d", '"_d')
-- This is going to get me cancelled
map("i", "<C-c>", "<Esc>")
map("n", "<leader>mr", "<cmd>CellularAutomaton make_it_rain<CR>")
map("n", "<leader><leader>", function()
vim.cmd("so")
end)
-- Tmux binds
map("n", "<C-A-Left>", "<cmd>lua require('tmux').move_left()<CR>")
map("n", "<C-A-Down>", "<cmd>lua require('tmux').move_bottom()<CR>")
map("n", "<C-A-Up>", "<cmd>lua require('tmux').move_top()<CR>")
map("n", "<C-A-Right>", "<cmd>lua require('tmux').move_right()<CR>")
map("n", "<A-S-Left>", "<cmd>lua require('tmux').resize_left()<CR>")
map("n", "<A-S-Down>", "<cmd>lua require('tmux').resize_bottom()<CR>")
map("n", "<A-S-Up>", "<cmd>lua require('tmux').resize_top()<CR>")
map("n", "<A-S-Right>", "<cmd>lua require('tmux').resize_right()<CR>")
map("n", "<leader><Left>", "<cmd>lua require('tmux').swap_left()<CR>")
map("n", "<leader><Down>", "<cmd>lua require('tmux').swap_bottom()<CR>")
map("n", "<leader><Up>", "<cmd>lua require('tmux').swap_top()<CR>")
map("n", "<leader><Right>", "<cmd>lua require('tmux').swap_right()<CR>")
+42
View File
@@ -0,0 +1,42 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "plugins" },
},
defaults = {
lazy = false,
version = false,
},
install = { colorscheme = { "tokyonight", "habamax" } },
checker = {
enabled = true,
notify = false,
},
performance = {
rtp = {
disabled_plugins = {
"gzip",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})
+52
View File
@@ -0,0 +1,52 @@
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = true
vim.opt.linebreak = true
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes:1"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "80"
vim.opt.textwidth = 80
vim.opt.formatoptions = "tcrqnj"
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
vim.o.laststatus = 3
vim.o.clipboard = "unnamedplus"
vim.o.cursorline = true
vim.o.cursorlineopt = "number"
vim.opt.fillchars = { eob = " " }
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.mouse = "a"
vim.o.number = true
vim.o.numberwidth = 3
vim.o.ruler = false
vim.o.showmode = false
vim.opt.shortmess:append("sI")
vim.o.splitbelow = true
vim.o.splitright = true
vim.o.timeoutlen = 400
vim.opt.whichwrap:append("<>[]hl")
vim.g.loaded_node_provider = 0
vim.g.loaded_python3_provider = 0
vim.g.loaded_perl_provider = 0
vim.g.loaded_ruby_provider = 0
local is_windows = vim.fn.has("win32") ~= 0
local sep = is_windows and "\\" or "/"
local delim = is_windows and ";" or ":"
vim.env.PATH = table.concat({ vim.fn.stdpath("data"), "mason", "bin" }, sep) .. delim .. vim.env.PATH
vim.g.snacks_animate = false
vim.g.autoformat = false
vim.g.lazyvim_cmp = "nvim-cmp"