-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.lua
More file actions
73 lines (58 loc) · 1.94 KB
/
Copy pathinit.lua
File metadata and controls
73 lines (58 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
-- init.lua
vim.deprecate = function() end
-- base46 cache (for NvChad themes)
vim.g.base46_cache = vim.fn.stdpath("data") .. "/base46/"
-- Leader key
vim.g.mapleader = " "
-- Bootstrap Lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system({ "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)
-- Load plugins with Lazy.nvim
require("lazy").setup({
-- NvChad core
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
},
-- Diffview.nvim for Git diffs
{
"sindrets/diffview.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
-- You can add more plugins here
{ import = "plugins.init" },
})
-- Load NvChad theme/cache
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
-- Load general options and autocmds
require("options")
require("autocmds")
-- Load key mappings
vim.schedule(function()
require("mappings")
end)
require("configs.nvimtree_resize").setup()
-- Optional: keybinding for Diffview
vim.api.nvim_set_keymap("n", "<leader>dv", ":DiffviewOpen<CR>", { noremap = true, silent = true })
-- Permanent Shortcut: Jump to the immediate parent block based on YAML/C++ indentation
vim.keymap.set('n', '<leader>p', function()
local current_indent = vim.fn.indent('.')
if current_indent == 0 then
print("Already at root")
return
end
-- Calculate parent indentation boundary
local parent_indent = math.max(0, current_indent - 1)
-- Drop a native jump mark so Ctrl+O brings you back down instantly
vim.cmd('normal! m`🏼')
-- Search backward for the first line with less indentation
vim.fn.search('^\\s\\{0,' .. parent_indent .. '}\\S', 'bW')
vim.cmd('normal! zz') -- Center viewport on the parent header
end, { desc = "Jump to immediate parent block" })