Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fe9fda7cd | ||
|
|
8d2bf49223 | ||
|
|
8d535ad186 | ||
|
|
25bc8e05c4 | ||
|
|
29a0d2ee30 | ||
|
|
722044c88a | ||
|
|
b933fbe1d9 |
@@ -1,5 +1,3 @@
|
||||
plugin
|
||||
custom
|
||||
spell
|
||||
ftplugin
|
||||
syntax
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
" hi DiffAdd gui=none guifg=NONE guibg=#bada9f
|
||||
" hi DiffChange gui=none guifg=NONE guibg=#e5d5ac
|
||||
" hi DiffDelete gui=bold guifg=#ff8080 guibg=#ffb0b0
|
||||
" hi DiffText gui=none guifg=NONE guibg=#8cbee2
|
||||
hi DiffAdd gui=none guifg=NONE guibg=#003200
|
||||
hi DiffChange gui=none guifg=NONE guibg=#000032
|
||||
hi DiffDelete gui=bold guifg=#ff8080 guibg=#602020
|
||||
hi DiffText gui=bold guifg=NONE guibg=#102040
|
||||
hi link @text.diff.add DiffAdd
|
||||
hi link @text.diff.delete DiffDelete
|
||||
hi link @text.diff.change DiffChange
|
||||
@@ -40,6 +40,13 @@ M.gen_chadrc_template = function()
|
||||
local path = fn.stdpath "config" .. "/lua/custom"
|
||||
|
||||
if fn.isdirectory(path) ~= 1 then
|
||||
local input = fn.input "Do you want to install example custom config? (y/N): "
|
||||
|
||||
if input:lower() == "y" then
|
||||
M.echo "Cloning example custom config repo..."
|
||||
shell_call { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path }
|
||||
fn.delete(path .. "/.git", "rf")
|
||||
else
|
||||
-- use very minimal chadrc
|
||||
fn.mkdir(path, "p")
|
||||
|
||||
@@ -50,5 +57,6 @@ M.gen_chadrc_template = function()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -10,9 +10,9 @@ M.ui = {
|
||||
hl_add = {},
|
||||
hl_override = {},
|
||||
changed_themes = {},
|
||||
theme_toggle = { "onedark", "one_light" },
|
||||
theme = "onedark", -- default theme
|
||||
transparency = false,
|
||||
theme_toggle = { "gatekeeper", "one_light" },
|
||||
theme = "gatekeeper", -- default theme
|
||||
transparency = true,
|
||||
lsp_semantic_tokens = false, -- needs nvim v0.9, just adds highlight groups for lsp semantic tokens
|
||||
|
||||
-- https://github.com/NvChad/base46/tree/v2.0/lua/base46/extended_integrations
|
||||
@@ -36,6 +36,9 @@ M.ui = {
|
||||
-- round and block will work for minimal theme only
|
||||
separator_style = "default",
|
||||
overriden_modules = nil,
|
||||
fileInfo = function()
|
||||
return require("nvchad_ui.statusline.default.fileInfo").run()
|
||||
end
|
||||
},
|
||||
|
||||
-- lazyload it when there are 1+ buffers
|
||||
@@ -65,7 +68,7 @@ M.ui = {
|
||||
buttons = {
|
||||
{ " Find File", "Spc f f", "Telescope find_files" },
|
||||
{ " Recent Files", "Spc f o", "Telescope oldfiles" },
|
||||
{ " Find Word", "Spc f w", "Telescope live_grep" },
|
||||
{ " Find Word", "Spc f w", "Telescope find_grep" },
|
||||
{ " Bookmarks", "Spc m a", "Telescope marks" },
|
||||
{ " Themes", "Spc t h", "Telescope themes" },
|
||||
{ " Mappings", "Spc c h", "NvCheatsheet" },
|
||||
|
||||
+8
-31
@@ -6,7 +6,7 @@ local config = require("core.utils").load_config()
|
||||
g.nvchad_theme = config.ui.theme
|
||||
g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
|
||||
g.toggle_theme_icon = " "
|
||||
g.transparency = config.ui.transparency
|
||||
g.transparency = true
|
||||
|
||||
-------------------------------------- options ------------------------------------------
|
||||
opt.laststatus = 3 -- global statusline
|
||||
@@ -17,10 +17,10 @@ opt.cursorline = true
|
||||
|
||||
-- Indenting
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 2
|
||||
opt.shiftwidth = 4
|
||||
opt.smartindent = true
|
||||
opt.tabstop = 2
|
||||
opt.softtabstop = 2
|
||||
opt.tabstop = 4
|
||||
opt.softtabstop = 4
|
||||
|
||||
opt.fillchars = { eob = " " }
|
||||
opt.ignorecase = true
|
||||
@@ -31,6 +31,7 @@ opt.mouse = "a"
|
||||
opt.number = true
|
||||
opt.numberwidth = 2
|
||||
opt.ruler = false
|
||||
opt.relativenumber = true
|
||||
|
||||
-- disable nvim intro
|
||||
opt.shortmess:append "sI"
|
||||
@@ -41,6 +42,7 @@ opt.splitright = true
|
||||
opt.termguicolors = true
|
||||
opt.timeoutlen = 400
|
||||
opt.undofile = true
|
||||
opt.scrolloff = 15
|
||||
|
||||
-- interval for writing swap file to disk, also used by gitsigns
|
||||
opt.updatetime = 250
|
||||
@@ -57,7 +59,7 @@ for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
|
||||
end
|
||||
|
||||
-- add binaries installed by mason.nvim to path
|
||||
local is_windows = vim.fn.has("win32") ~= 0
|
||||
local is_windows = vim.loop.os_uname().sysname == "Windows_NT"
|
||||
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
|
||||
|
||||
-------------------------------------- autocmds ------------------------------------------
|
||||
@@ -91,6 +93,7 @@ autocmd("BufWritePost", {
|
||||
|
||||
vim.g.nvchad_theme = config.ui.theme
|
||||
vim.g.transparency = config.ui.transparency
|
||||
vim.g.transparency = true
|
||||
|
||||
-- statusline
|
||||
require("plenary.reload").reload_module("nvchad.statusline." .. config.ui.statusline.theme)
|
||||
@@ -107,32 +110,6 @@ autocmd("BufWritePost", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- user event that loads after UIEnter + only if file buf is there
|
||||
vim.api.nvim_create_autocmd({ "UIEnter", "BufReadPost", "BufNewFile" }, {
|
||||
group = vim.api.nvim_create_augroup("NvFilePost", { clear = true }),
|
||||
callback = function(args)
|
||||
local file = vim.api.nvim_buf_get_name(args.buf)
|
||||
local buftype = vim.api.nvim_buf_get_option(args.buf, "buftype")
|
||||
|
||||
if not vim.g.ui_entered and args.event == "UIEnter" then
|
||||
vim.g.ui_entered = true
|
||||
end
|
||||
|
||||
if file ~= "" and buftype ~= "nofile" and vim.g.ui_entered then
|
||||
vim.api.nvim_exec_autocmds("User", { pattern = "FilePost", modeline = false })
|
||||
vim.api.nvim_del_augroup_by_name "NvFilePost"
|
||||
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_exec_autocmds("FileType", {})
|
||||
|
||||
if vim.g.editorconfig then
|
||||
require("editorconfig").config(args.buf)
|
||||
end
|
||||
end, 0)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-------------------------------------- commands ------------------------------------------
|
||||
local new_cmd = vim.api.nvim_create_user_command
|
||||
|
||||
|
||||
+125
-48
@@ -16,42 +16,51 @@ M.general = {
|
||||
},
|
||||
|
||||
n = {
|
||||
["<Esc>"] = { "<cmd> noh <CR>", "Clear highlights" },
|
||||
["<leader>n"] = { ":noh <CR>", "Clear highlights" },
|
||||
["<leader>rr"] = { ":source $MYVIMRC<CR>", "Reload config file" },
|
||||
-- switch between windows
|
||||
["<C-h>"] = { "<C-w>h", "Window left" },
|
||||
["<C-l>"] = { "<C-w>l", "Window right" },
|
||||
["<C-j>"] = { "<C-w>j", "Window down" },
|
||||
["<C-k>"] = { "<C-w>k", "Window up" },
|
||||
|
||||
-- ["<C-d>"] = { "<cmd> tab Git diff %<CR>", "Git diff this file" },
|
||||
["<C-d>"] = { "<cmd> DiffviewOpen -- %<CR>", "Git diff this file" },
|
||||
["<C-o>"] = { "<cmd> DiffviewFileHistory %<CR>", "Git history diff this file" },
|
||||
["<C-a-d>"] = { "<cmd> DiffviewClose<CR>", "Close git diff" },
|
||||
-- ["<C-p>"] = { "<cmd> tab Git diff<CR>", "Git diff global" },
|
||||
["<C-p>"] = { "<cmd> DiffviewOpen<CR>", "Git diff global" },
|
||||
["<a-p>"] = { ":DiffviewOpen HEAD~", "Show last N commits" },
|
||||
["<leader>gd"] = { "<cmd> DiffviewClose<CR>", "Git diff close" },
|
||||
|
||||
-- save
|
||||
["<C-s>"] = { "<cmd> w <CR>", "Save file" },
|
||||
|
||||
-- Copy all
|
||||
["<C-c>"] = { "<cmd> %y+ <CR>", "Copy whole file" },
|
||||
-- ["<C-c>"] = { "<cmd> %y+ <CR>", "Copy whole file" },
|
||||
|
||||
-- Quit
|
||||
["<C-q>"] = { "<cmd> q! <CR>", "Force quit window" },
|
||||
|
||||
-- line numbers
|
||||
["<leader>n"] = { "<cmd> set nu! <CR>", "Toggle line number" },
|
||||
["<leader>rn"] = { "<cmd> set rnu! <CR>", "Toggle relative number" },
|
||||
-- ["<leader>n"] = { "<cmd> set nu! <CR>", "Toggle line number" },
|
||||
-- ["<leader>rn"] = { "<cmd> set rnu! <CR>", "Toggle relative number" },
|
||||
|
||||
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
||||
-- allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
||||
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||
-- empty mode is same as using <cmd> :map
|
||||
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
|
||||
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
-- ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
-- ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
-- ["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
-- ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
|
||||
["<leader>y"] = {"<cmd> :w! /tmp/vimtmp<CR>", "Save into a global tmp file"},
|
||||
["<leader>p"] = {"<cmd> :r! cat /tmp/vimtmp<CR>", "Restore from the global tmp file"},
|
||||
|
||||
-- new buffer
|
||||
["<leader>b"] = { "<cmd> enew <CR>", "New buffer" },
|
||||
["<leader>ch"] = { "<cmd> NvCheatsheet <CR>", "Mapping cheatsheet" },
|
||||
|
||||
["<leader>fm"] = {
|
||||
function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end,
|
||||
"LSP formatting",
|
||||
},
|
||||
-- ["<leader>b"] = { "<cmd> enew <CR>", "New buffer" },
|
||||
-- ["<leader>ch"] = { "<cmd> NvCheatsheet <CR>", "Mapping cheatsheet" },
|
||||
},
|
||||
|
||||
t = {
|
||||
@@ -59,21 +68,66 @@ M.general = {
|
||||
},
|
||||
|
||||
v = {
|
||||
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
["<"] = { "<gv", "Indent line" },
|
||||
[">"] = { ">gv", "Indent line" },
|
||||
-- ["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
-- ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
-- ["<"] = { "<gv", "Indent line" },
|
||||
-- [">"] = { ">gv", "Indent line" },
|
||||
},
|
||||
|
||||
x = {
|
||||
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
-- ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
-- ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
-- Don't copy the replaced text after pasting in visual mode
|
||||
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
|
||||
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#alternative_mapping_for_paste
|
||||
["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', "Dont copy replaced text", opts = { silent = true } },
|
||||
},
|
||||
}
|
||||
|
||||
M.customstuffs = {
|
||||
|
||||
n = {
|
||||
["<Return>"] = { "o<ESC>", "Insert new line below" },
|
||||
["<BS>"] = { "O<ESC>", "Insert new line above" },
|
||||
["<C-c>"] = { "<cmd> vertical topleft Git <bar> vertical resize 50<CR>", "Show Git status on a left pane" },
|
||||
["<F1>"] = { "<cmd> tabprevious<CR>", "Previous tab" },
|
||||
["<F2>"] = { "<cmd> tabnext<CR>", "Next tab" },
|
||||
["<F3>"] = { "<cmd> Flog -all<CR>", "Show git tree" },
|
||||
["<F4>"] = { "<cmd> tab Git show -", "Git show N last commits" },
|
||||
["<C-t>"] = { "<cmd> TagbarToggle<CR>", "Show tagbar" },
|
||||
["<leader>ra"] = { "<cmd> call VrcQuery()<CR>", "Call REST endpoint" },
|
||||
["<leader>dl"] = { "0d$", "Delete line from start" },
|
||||
["<leader>gp"] = { "<cmd> Git pull<CR>", "Git pull" },
|
||||
["<leader>gnb"] = { ":Git checkout -b ", "Checkout to a new branch" },
|
||||
["<leader>gri"] = { ":Git rebase -i HEAD~", "Git rebase interactive from HEAD" },
|
||||
["<leader>mkd"] = { "<cmd>lua vim.api.nvim_create_user_command('PeekOpen', require('peek').open, {})<CR>", "Open markdown preview" },
|
||||
["<leader>mkc"] = { "<cmd>lua vim.api.nvim_create_user_command('PeekClose', require('peek').close, {})<CR>", "Open markdown preview" },
|
||||
|
||||
["n"] = { "nzz", "Next + auto center" },
|
||||
["N"] = { "Nzz", "Previous + auto center" },
|
||||
["("] = { "(zz", "Previous + auto center" },
|
||||
[")"] = { ")zz", "Previous + auto center" },
|
||||
["{"] = { "{zz", "Previous + auto center" },
|
||||
["}"] = { "}zz", "Previous + auto center" },
|
||||
["[["] = { "[[zz", "Previous + auto center" },
|
||||
["]]"] = { "]]zz", "Previous + auto center" },
|
||||
|
||||
-- Mappings: TODO
|
||||
|
||||
-- "trim(system('git branch --show-current 2>/dev/null'))"
|
||||
["<leader>tt"] = { ":call append(line('.') - 1, repeat(' ', indent('.')) . '# TODO-' . trim(system('git branch --show-current 2>/dev/null')) . ': ' . input('Comment >'))<CR>", "Add TODO comment + add to quickfix list" },
|
||||
},
|
||||
v = {
|
||||
["n"] = { "nzz", "Next + auto center" },
|
||||
["N"] = { "Nzz", "Previous + auto center" },
|
||||
["("] = { "(zz", "Previous + auto center" },
|
||||
[")"] = { ")zz", "Previous + auto center" },
|
||||
["{"] = { "{zz", "Previous + auto center" },
|
||||
["}"] = { "}zz", "Previous + auto center" },
|
||||
["[["] = { "[[zz", "Previous + auto center" },
|
||||
["]]"] = { "]]zz", "Previous + auto center" },
|
||||
},
|
||||
}
|
||||
|
||||
M.tabufline = {
|
||||
plugin = true,
|
||||
|
||||
@@ -108,7 +162,7 @@ M.comment = {
|
||||
|
||||
-- toggle comment in both modes
|
||||
n = {
|
||||
["<leader>/"] = {
|
||||
["<leader>ci"] = {
|
||||
function()
|
||||
require("Comment.api").toggle.linewise.current()
|
||||
end,
|
||||
@@ -117,7 +171,7 @@ M.comment = {
|
||||
},
|
||||
|
||||
v = {
|
||||
["<leader>/"] = {
|
||||
["<leader>ci"] = {
|
||||
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
|
||||
"Toggle comment",
|
||||
},
|
||||
@@ -214,18 +268,18 @@ M.lspconfig = {
|
||||
"Goto next",
|
||||
},
|
||||
|
||||
["<leader>q"] = {
|
||||
function()
|
||||
vim.diagnostic.setloclist()
|
||||
end,
|
||||
"Diagnostic setloclist",
|
||||
},
|
||||
-- ["<leader>q"] = {
|
||||
-- function()
|
||||
-- vim.diagnostic.setloclist()
|
||||
-- end,
|
||||
-- "Diagnostic setloclist",
|
||||
-- },
|
||||
|
||||
["<leader>wa"] = {
|
||||
function()
|
||||
vim.lsp.buf.add_workspace_folder()
|
||||
end,
|
||||
"Add workspace folder",
|
||||
"add workspace folder",
|
||||
},
|
||||
|
||||
["<leader>wr"] = {
|
||||
@@ -269,18 +323,37 @@ M.telescope = {
|
||||
plugin = true,
|
||||
|
||||
n = {
|
||||
-- Resume
|
||||
["<a-f>"] = { "<cmd> Telescope resume <CR>", "Resume" },
|
||||
-- find
|
||||
["<leader>ff"] = { "<cmd> Telescope find_files <CR>", "Find files" },
|
||||
["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "Find all" },
|
||||
["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", "Live grep" },
|
||||
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
|
||||
["<C-g>"] = { "<cmd> Telescope find_files <CR>", "Find files" },
|
||||
["<C-x>"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "Find all" },
|
||||
["<C-f>"] = { "<cmd> Telescope live_grep <CR>", "Live grep" },
|
||||
["<C-b>"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
|
||||
|
||||
["<leader>fg"] = { "<cmd> lua require('telescope.builtin').live_grep({default_text=vim.fn.getreg('/')}) <CR>", "Live grep with actual search value as prefix" },
|
||||
["<leader>ac"] = { ":execute 'vimgrep' input('Pattern >', getreg('/')) '**/*' <CR>", "add search term files in quickfix list" },
|
||||
["<leader>qc"] = { "<cmd> Telescope quickfix <CR>", "Show quickfix list" },
|
||||
["<leader>qr"] = { ":execute 'cdo' '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >', getreg('')) . '/g | update' <CR>", "Replace pattern in all quickfix list" },
|
||||
|
||||
["<leader>ll"] = { "<cmd> Telescope loclist <CR>", "Show loclist list" },
|
||||
["<leader>ln"] = { ":lnext<CR>", "Jump to next in loclist" },
|
||||
["<leader>lp"] = { ":lprevious<CR>", "Jump to previous in loclist" },
|
||||
|
||||
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "Help page" },
|
||||
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "Find oldfiles" },
|
||||
["<leader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
|
||||
|
||||
-- git
|
||||
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "Git commits" },
|
||||
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", "Git status" },
|
||||
--- Commits
|
||||
["<leader>gc"] = { "<cmd> lua require('custom.telescope').my_git_commits()<CR>", "Custom Git commits" },
|
||||
--- Status
|
||||
["<leader>gss"] = { "<cmd> lua require('custom.telescope').my_git_status()<CR>", "Custom Git status" },
|
||||
--- Stash
|
||||
["<leader>gsh"] = { "<cmd> Telescope git_stash<CR>", "Git stash" },
|
||||
--- Branches
|
||||
["<leader>gbb"] = { "<cmd> Telescope git_branches<CR>", "Git branches" },
|
||||
["<leader>gbc"] = { "<cmd> lua require('custom.telescope').my_git_bcommits()<CR>", "Custom Git branchs commits" },
|
||||
|
||||
-- pick a hidden term
|
||||
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
|
||||
@@ -289,6 +362,10 @@ M.telescope = {
|
||||
["<leader>th"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
|
||||
|
||||
["<leader>ma"] = { "<cmd> Telescope marks <CR>", "telescope bookmarks" },
|
||||
|
||||
-- History
|
||||
["<leader>ch"] = { "<cmd> Telescope command_history <CR>", "telescope commands history" },
|
||||
["<leader>/"] = { "<cmd> Telescope search_history <CR>", "telescope search history" },
|
||||
},
|
||||
}
|
||||
|
||||
@@ -297,21 +374,21 @@ M.nvterm = {
|
||||
|
||||
t = {
|
||||
-- toggle in terminal mode
|
||||
["<A-i>"] = {
|
||||
["<a-i>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "float"
|
||||
end,
|
||||
"Toggle floating term",
|
||||
},
|
||||
|
||||
["<A-h>"] = {
|
||||
["<a-h>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "horizontal"
|
||||
end,
|
||||
"Toggle horizontal term",
|
||||
},
|
||||
|
||||
["<A-v>"] = {
|
||||
["<a-v>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "vertical"
|
||||
end,
|
||||
@@ -321,21 +398,21 @@ M.nvterm = {
|
||||
|
||||
n = {
|
||||
-- toggle in normal mode
|
||||
["<A-i>"] = {
|
||||
["<a-i>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "float"
|
||||
end,
|
||||
"Toggle floating term",
|
||||
},
|
||||
|
||||
["<A-h>"] = {
|
||||
["<a-h>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "horizontal"
|
||||
end,
|
||||
"Toggle horizontal term",
|
||||
},
|
||||
|
||||
["<A-v>"] = {
|
||||
["<a-v>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "vertical"
|
||||
end,
|
||||
@@ -434,7 +511,7 @@ M.gitsigns = {
|
||||
opts = { expr = true },
|
||||
},
|
||||
|
||||
-- Actions
|
||||
-- actions
|
||||
["<leader>rh"] = {
|
||||
function()
|
||||
require("gitsigns").reset_hunk()
|
||||
@@ -449,7 +526,7 @@ M.gitsigns = {
|
||||
"Preview hunk",
|
||||
},
|
||||
|
||||
["<leader>gb"] = {
|
||||
["<leader>bb"] = {
|
||||
function()
|
||||
package.loaded.gitsigns.blame_line()
|
||||
end,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
---@type ChadrcConfig
|
||||
local M = {}
|
||||
|
||||
-- Path to overriding theme and highlights files
|
||||
local highlights = require "custom.highlights"
|
||||
|
||||
M.ui = {
|
||||
theme = "gatekeeper",
|
||||
theme_toggle = { "gatekeeper", "monekai" },
|
||||
|
||||
hl_override = highlights.override,
|
||||
hl_add = highlights.add,
|
||||
}
|
||||
|
||||
M.plugins = "custom.plugins"
|
||||
|
||||
-- check core.mappings for table structure
|
||||
M.mappings = require "custom.mappings"
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,17 @@
|
||||
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
-- if you just want default config for the servers then put them in a table
|
||||
local servers = { "html", "cssls", "tsserver", "clangd" }
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
--
|
||||
-- lspconfig.pyright.setup { blabla}
|
||||
@@ -0,0 +1,25 @@
|
||||
local present, null_ls = pcall(require, "null-ls")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local b = null_ls.builtins
|
||||
|
||||
local sources = {
|
||||
|
||||
-- webdev stuff
|
||||
b.formatting.deno_fmt, -- choosed deno for ts/js files cuz its very fast!
|
||||
b.formatting.prettier.with { filetypes = { "html", "markdown", "css" } }, -- so prettier works only on these filetypes
|
||||
|
||||
-- Lua
|
||||
b.formatting.stylua,
|
||||
|
||||
-- cpp
|
||||
b.formatting.clang_format,
|
||||
}
|
||||
|
||||
null_ls.setup {
|
||||
debug = true,
|
||||
sources = sources,
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
local M = {}
|
||||
|
||||
M.treesitter = {
|
||||
ensure_installed = {
|
||||
"vim",
|
||||
"lua",
|
||||
"html",
|
||||
"css",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"c",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
-- disable = {
|
||||
-- "python"
|
||||
-- },
|
||||
},
|
||||
}
|
||||
|
||||
M.mason = {
|
||||
ensure_installed = {
|
||||
-- lua stuff
|
||||
"lua-language-server",
|
||||
"stylua",
|
||||
|
||||
-- web dev stuff
|
||||
"css-lsp",
|
||||
"html-lsp",
|
||||
"typescript-language-server",
|
||||
"deno",
|
||||
"prettier",
|
||||
|
||||
-- c/cpp stuff
|
||||
"clangd",
|
||||
"clang-format",
|
||||
},
|
||||
}
|
||||
|
||||
-- git support in nvimtree
|
||||
M.nvimtree = {
|
||||
git = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
icons = {
|
||||
show = {
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,19 @@
|
||||
-- To find any highlight groups: "<cmd> Telescope highlights"
|
||||
-- Each highlight group can take a table with variables fg, bg, bold, italic, etc
|
||||
-- base30 variable names can also be used as colors
|
||||
|
||||
local M = {}
|
||||
|
||||
---@type Base46HLGroupsList
|
||||
M.override = {
|
||||
Comment = {
|
||||
italic = true,
|
||||
},
|
||||
}
|
||||
|
||||
---@type HLTable
|
||||
M.add = {
|
||||
NvimTreeOpenedFolderName = { fg = "green", bold = true },
|
||||
}
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,7 @@
|
||||
-- local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- Auto resize panes when resizing nvim window
|
||||
-- autocmd("VimResized", {
|
||||
-- pattern = "*",
|
||||
-- command = "tabdo wincmd =",
|
||||
-- })
|
||||
@@ -0,0 +1,12 @@
|
||||
---@type MappingsTable
|
||||
local M = {}
|
||||
|
||||
M.general = {
|
||||
n = {
|
||||
[";"] = { ":", "enter command mode", opts = { nowait = true } },
|
||||
},
|
||||
}
|
||||
|
||||
-- more keybinds!
|
||||
--
|
||||
return M
|
||||
@@ -0,0 +1,65 @@
|
||||
local overrides = require("custom.configs.overrides")
|
||||
|
||||
---@type NvPluginSpec[]
|
||||
local plugins = {
|
||||
|
||||
-- Override plugin definition options
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- format & linting
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
config = function()
|
||||
require "custom.configs.null-ls"
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
require "custom.configs.lspconfig"
|
||||
end, -- Override to setup mason-lspconfig
|
||||
},
|
||||
|
||||
-- override plugin configs
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = overrides.mason
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = overrides.treesitter,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
opts = overrides.nvimtree,
|
||||
},
|
||||
|
||||
-- Install a plugin
|
||||
{
|
||||
"max397574/better-escape.nvim",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("better_escape").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- To make a plugin not be loaded
|
||||
-- {
|
||||
-- "NvChad/nvim-colorizer.lua",
|
||||
-- enabled = false
|
||||
-- },
|
||||
|
||||
-- All NvChad plugins are lazy-loaded by default
|
||||
-- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
|
||||
-- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
|
||||
-- {
|
||||
-- "mg979/vim-visual-multi",
|
||||
-- lazy = false,
|
||||
-- }
|
||||
}
|
||||
|
||||
return plugins
|
||||
@@ -0,0 +1,61 @@
|
||||
-- Implement delta as previewer for diffs
|
||||
|
||||
local previewers = require('telescope.previewers')
|
||||
local builtin = require('telescope.builtin')
|
||||
local E = {}
|
||||
|
||||
local delta = previewers.new_termopen_previewer {
|
||||
get_command = function(entry)
|
||||
-- this is for status
|
||||
-- You can get the AM things in entry.status. So we are displaying file if entry.status == '??' or 'A '
|
||||
-- just do an if and return a different command
|
||||
if entry.status == '??' or 'A ' then
|
||||
return { 'git', '-c', 'core.pager=delta', '-c', 'delta.side-by-side=false', 'diff', entry.value }
|
||||
end
|
||||
|
||||
-- note we can't use pipes
|
||||
-- this command is for git_commits and git_bcommits
|
||||
return { 'git', '-c', 'core.pager=delta', '-c', 'delta.side-by-side=false', 'diff', entry.value .. '^!' }
|
||||
|
||||
end
|
||||
}
|
||||
|
||||
E.my_git_commits = function(opts)
|
||||
opts = opts or {}
|
||||
opts.previewer = delta
|
||||
|
||||
builtin.git_commits(opts)
|
||||
end
|
||||
|
||||
E.my_git_bcommits = function(opts)
|
||||
opts = opts or {}
|
||||
opts.previewer = delta
|
||||
|
||||
builtin.git_bcommits(opts)
|
||||
end
|
||||
|
||||
E.my_git_status = function(opts)
|
||||
opts = opts or {}
|
||||
opts.previewer = delta
|
||||
|
||||
builtin.git_status(opts)
|
||||
end
|
||||
|
||||
E.my_git_branches = function(opts)
|
||||
opts = opts or {}
|
||||
opts.previewer = delta
|
||||
|
||||
builtin.git_branches(opts)
|
||||
end
|
||||
|
||||
E.project_files = function()
|
||||
local opts = {} -- define here if you want to define something
|
||||
vim.fn.system('git rev-parse --is-inside-work-tree')
|
||||
if vim.v.shell_error == 0 then
|
||||
require"telescope.builtin".git_files(opts)
|
||||
else
|
||||
require"telescope.builtin".find_files(opts)
|
||||
end
|
||||
end
|
||||
|
||||
return E
|
||||
@@ -0,0 +1,5 @@
|
||||
local actions = require("diffview.actions")
|
||||
|
||||
local options = {}
|
||||
|
||||
return options
|
||||
@@ -5,16 +5,17 @@ local M = {}
|
||||
local utils = require "core.utils"
|
||||
|
||||
-- export on_attach & capabilities for custom lspconfigs
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
client.server_capabilities.documentRangeFormattingProvider = false
|
||||
|
||||
utils.load_mappings("lspconfig", { buffer = bufnr })
|
||||
|
||||
if client.server_capabilities.signatureHelpProvider then
|
||||
require("nvchad.signature").setup(client)
|
||||
end
|
||||
end
|
||||
|
||||
-- disable semantic tokens
|
||||
M.on_init = function(client, _)
|
||||
if not utils.load_config().ui.lsp_semantic_tokens and client.supports_method "textDocument/semanticTokens" then
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end
|
||||
@@ -41,7 +42,6 @@ M.capabilities.textDocument.completion.completionItem = {
|
||||
}
|
||||
|
||||
require("lspconfig").lua_ls.setup {
|
||||
on_init = M.on_init,
|
||||
on_attach = M.on_attach,
|
||||
capabilities = M.capabilities,
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
-- See: https://github.com/neovim/nvim-lspconfig/tree/54eb2a070a4f389b1be0f98070f81d23e2b1a715#suggested-configuration
|
||||
local opts = { noremap=true, silent=true }
|
||||
vim.keymap.set('n', '<space>k', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
end
|
||||
|
||||
-- Configure `ruff-lsp`.
|
||||
-- See: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#ruff_lsp
|
||||
-- For the default config, along with instructions on how to customize the settings
|
||||
require('lspconfig').ruff_lsp.setup {
|
||||
on_attach = on_attach,
|
||||
init_options = {
|
||||
settings = {
|
||||
-- Any extra CLI arguments for `ruff` go here.
|
||||
args = {},
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,96 @@
|
||||
local custom_actions = {}
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
local from_entry = require("telescope.from_entry")
|
||||
|
||||
|
||||
local entry_to_qf = function(entry)
|
||||
local text = entry.text
|
||||
|
||||
if not text then
|
||||
if type(entry.value) == "table" then
|
||||
text = entry.value.text
|
||||
else
|
||||
text = entry.value
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
bufnr = entry.bufnr,
|
||||
filename = from_entry.path(entry, false, false),
|
||||
lnum = vim.F.if_nil(entry.lnum, 1),
|
||||
col = vim.F.if_nil(entry.col, 1),
|
||||
text = text,
|
||||
}
|
||||
end
|
||||
|
||||
local send_selected_to_list_without_closing_prompt = function(prompt_bufnr, mode, target)
|
||||
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||
|
||||
local qf_entries = {}
|
||||
for _, entry in ipairs(picker:get_multi_selection()) do
|
||||
table.insert(qf_entries, entry_to_qf(entry))
|
||||
end
|
||||
|
||||
local prompt = picker:_get_prompt()
|
||||
-- actions.close(prompt_bufnr)
|
||||
|
||||
vim.api.nvim_exec_autocmds("QuickFixCmdPre", {})
|
||||
if target == "loclist" then
|
||||
vim.fn.setloclist(picker.original_win_id, qf_entries, mode)
|
||||
else
|
||||
local qf_title = string.format([[%s (%s)]], picker.prompt_title, prompt)
|
||||
vim.fn.setqflist(qf_entries, mode)
|
||||
vim.fn.setqflist({}, "a", { title = qf_title })
|
||||
end
|
||||
vim.api.nvim_exec_autocmds("QuickFixCmdPost", {})
|
||||
end
|
||||
|
||||
function custom_actions._multiopen(prompt_bufnr, cmd, cmd2, mode, list)
|
||||
-- actions.send_selected_to_loclist(prompt_bufnr)
|
||||
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||
local multi = picker:get_multi_selection()
|
||||
local single = picker:get_selection()
|
||||
|
||||
local str = ""
|
||||
|
||||
if #multi > 0 then
|
||||
|
||||
send_selected_to_list_without_closing_prompt(prompt_bufnr, mode, list)
|
||||
|
||||
for i, j in ipairs(multi) do
|
||||
if i % 2 == 1 then
|
||||
str = str..cmd.." "..j[1].." | "
|
||||
else
|
||||
str = str..cmd2.." "..j[1].." | "
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
str = cmd.." "..single[1]
|
||||
end
|
||||
|
||||
-- To avoid populating qf or doing ":edit! file", close the prompt first
|
||||
actions.close(prompt_bufnr)
|
||||
vim.api.nvim_command(str)
|
||||
end
|
||||
|
||||
function custom_actions.multi_selection_open(prompt_bufnr)
|
||||
return custom_actions._multiopen(prompt_bufnr, "edit", "edit", "a", "loclist")
|
||||
end
|
||||
|
||||
function custom_actions.multi_selection_vsplit(prompt_bufnr)
|
||||
return custom_actions._multiopen(prompt_bufnr, "vsplit", "split", "a", "loclist")
|
||||
end
|
||||
|
||||
function custom_actions.multi_selection_split(prompt_bufnr)
|
||||
return custom_actions._multiopen(prompt_bufnr, "split", "vsplit", "a", "loclist")
|
||||
end
|
||||
|
||||
function custom_actions.multi_selection_vtab(prompt_bufnr)
|
||||
return custom_actions._multiopen(prompt_bufnr, "tabe", "tabe", "a", "loclist")
|
||||
end
|
||||
|
||||
local options = {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
@@ -20,14 +113,15 @@ local options = {
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
preview_width = 0.55,
|
||||
preview_width = 0.60,
|
||||
results_width = 0.8,
|
||||
},
|
||||
vertical = {
|
||||
mirror = false,
|
||||
},
|
||||
width = 0.87,
|
||||
height = 0.80,
|
||||
preview_cutoff = 120,
|
||||
width = 0.90,
|
||||
height = 0.92,
|
||||
preview_cutoff = 200,
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||
file_ignore_patterns = { "node_modules" },
|
||||
@@ -44,11 +138,45 @@ local options = {
|
||||
-- Developer configurations: Not meant for general override
|
||||
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
mappings = {
|
||||
n = { ["q"] = require("telescope.actions").close },
|
||||
n = { ["q"] = actions.close },
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
buffers = {
|
||||
show_all_buffers = true,
|
||||
sort_lastused = true,
|
||||
mappings = {
|
||||
n = {
|
||||
["d"] = "delete_buffer",
|
||||
},
|
||||
i = {
|
||||
["<C-d>"] = "delete_buffer",
|
||||
}
|
||||
}
|
||||
},
|
||||
find_files = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<CR>"] = custom_actions.multi_selection_open,
|
||||
["<C-V>"] = custom_actions.multi_selection_vsplit,
|
||||
["<C-X>"] = custom_actions.multi_selection_split,
|
||||
["<C-T>"] = custom_actions.multi_selection_tab,
|
||||
["<C-SPACE>"] = actions.send_selected_to_qflist,
|
||||
},
|
||||
n = i,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
extensions_list = { "themes", "terms" },
|
||||
extensions_list = { "themes", "terms", "fzf" },
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local options = {
|
||||
ensure_installed = { "lua", "vim", "vimdoc" },
|
||||
ensure_installed = { "lua" },
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
||||
+57
-9
@@ -3,6 +3,32 @@
|
||||
local default_plugins = {
|
||||
|
||||
"nvim-lua/plenary.nvim",
|
||||
"rebelot/kanagawa.nvim",
|
||||
{
|
||||
"iamcco/markdown-preview.nvim",
|
||||
run = "cd app && npm install",
|
||||
lazy = false,
|
||||
setup = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
},
|
||||
{"tpope/vim-fugitive", lazy=false},
|
||||
{"rbong/vim-flog", lazy=false},
|
||||
{"tpope/vim-surround", lazy=false},
|
||||
{"tpope/vim-obsession", lazy=false},
|
||||
{"preservim/tagbar", lazy=false},
|
||||
{"ludovicchabant/vim-gutentags", lazy=false},
|
||||
{"emaniacs/vim-rest-console", lazy=false},
|
||||
{
|
||||
"sindrets/diffview.nvim",
|
||||
lazy=false,
|
||||
opts = function()
|
||||
return require "plugins.configs.diffview"
|
||||
end,
|
||||
},
|
||||
|
||||
{"nvim-telescope/telescope-fzf-native.nvim", build="make"},
|
||||
|
||||
{
|
||||
"NvChad/base46",
|
||||
@@ -19,7 +45,7 @@ local default_plugins = {
|
||||
},
|
||||
|
||||
{
|
||||
"zbirenbaum/nvterm",
|
||||
"NvChad/nvterm",
|
||||
init = function()
|
||||
require("core.utils").load_mappings "nvterm"
|
||||
end,
|
||||
@@ -31,7 +57,9 @@ local default_plugins = {
|
||||
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
event = "User FilePost",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-colorizer.lua"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("colorizer").setup(opts)
|
||||
|
||||
@@ -56,7 +84,9 @@ local default_plugins = {
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
version = "2.20.7",
|
||||
event = "User FilePost",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "indent-blankline.nvim"
|
||||
end,
|
||||
opts = function()
|
||||
return require("plugins.configs.others").blankline
|
||||
end,
|
||||
@@ -69,7 +99,9 @@ local default_plugins = {
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-treesitter"
|
||||
end,
|
||||
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
|
||||
build = ":TSUpdate",
|
||||
opts = function()
|
||||
@@ -84,7 +116,22 @@ local default_plugins = {
|
||||
-- git stuff
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "User FilePost",
|
||||
ft = { "gitcommit", "diff" },
|
||||
init = function()
|
||||
-- load gitsigns only when a git file is opened
|
||||
vim.api.nvim_create_autocmd({ "BufRead" }, {
|
||||
group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }),
|
||||
callback = function()
|
||||
vim.fn.system("git -C " .. '"' .. vim.fn.expand "%:p:h" .. '"' .. " rev-parse")
|
||||
if vim.v.shell_error == 0 then
|
||||
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
|
||||
vim.schedule(function()
|
||||
require("lazy").load { plugins = { "gitsigns.nvim" } }
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
opts = function()
|
||||
return require("plugins.configs.others").gitsigns
|
||||
end,
|
||||
@@ -107,9 +154,7 @@ local default_plugins = {
|
||||
|
||||
-- custom nvchad cmd to install all mason binaries listed
|
||||
vim.api.nvim_create_user_command("MasonInstallAll", function()
|
||||
if opts.ensure_installed and #opts.ensure_installed > 0 then
|
||||
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
|
||||
end
|
||||
end, {})
|
||||
|
||||
vim.g.mason_binaries_list = opts.ensure_installed
|
||||
@@ -118,7 +163,9 @@ local default_plugins = {
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = "User FilePost",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-lspconfig"
|
||||
end,
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
end,
|
||||
@@ -208,7 +255,7 @@ local default_plugins = {
|
||||
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" } },
|
||||
cmd = "Telescope",
|
||||
init = function()
|
||||
require("core.utils").load_mappings "telescope"
|
||||
@@ -250,3 +297,4 @@ if #config.plugins > 0 then
|
||||
end
|
||||
|
||||
require("lazy").setup(default_plugins, config.lazy_nvim)
|
||||
require "plugins.configs.ruff_lsp"
|
||||
|
||||
Reference in New Issue
Block a user