Compare commits

..

No commits in common. "3f08c78c134c6c577b64d6b4161999ff459bd394" and "fe912ab5fb5e4df9e5f2c073a5294ec108d84095" have entirely different histories.

19 changed files with 131 additions and 471 deletions

9
.github/README.md vendored
View File

@ -15,7 +15,7 @@
<div align="center">
[![Neovim Minimum Version](https://img.shields.io/badge/Neovim-0.9.0-blueviolet.svg?style=flat-square&logo=Neovim&color=90E59A&logoColor=white)](https://github.com/neovim/neovim)
[![Neovim Minimum Version](https://img.shields.io/badge/Neovim-0.8.3-blueviolet.svg?style=flat-square&logo=Neovim&color=90E59A&logoColor=white)](https://github.com/neovim/neovim)
[![GitHub Issues](https://img.shields.io/github/issues/NvChad/NvChad.svg?style=flat-square&label=Issues&color=d77982)](https://github.com/NvChad/NvChad/issues)
[![Discord](https://img.shields.io/discord/869557815780470834?color=738adb&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/gADmkJb9Fb)
[![Matrix](https://img.shields.io/badge/Matrix-40aa8b.svg?style=flat-square&logo=Matrix&logoColor=white)](https://matrix.to/#/#nvchad:matrix.org)
@ -37,7 +37,7 @@
- Lazy loading is done 93% of the time meaning that plugins will not be loaded by default, they will be loaded only when required also at specific commands, events etc. This lowers the startuptime and it was like 0.07~ secs tested on an old pentium machine 1.4ghz + 4gb ram & HDD.
- NvChad isn't a framework! It's supposed to be used as a "base" config, so users can tweak the defaults well, and also remove the things they don't like in the default config and build their config on top of it. Users can tweak the entire default config while staying in their custom config (lua/custom dir). This is the control center of the user's config and gitignored so the users can stay up-to-date with NvChad's latest config (main branch) while still controlling it with their chadrc (file that controls entire custom dir).
- NvChad isnt a framework! Its supposed to be used as a "base" config, so users could tweak the defaults well, can also remove the things they dont like in the default config and build their config on top of it. Users can tweak the entire default config while staying in their custom config (lua/custom dir). This is the control center of the user's config and gitignored so the users can stay update to-date with NvChad's latest config (main branch) while still controlling it with their chadrc (file that controls entire custom dir)
## Theme Showcase
@ -88,7 +88,8 @@ A fuzzy file finder, picker, sorter, previewer and much more:
- Many beautiful themes, theme toggler by our [base46 plugin](https://github.com/NvChad/base46)
- Inbuilt terminal toggling & management with [Nvterm](https://github.com/NvChad/nvterm)
- Lightweight & performant ui plugin with [NvChad UI](https://github.com/NvChad/ui) It provides statusline modules, tabufline ( tabs + buffer manager) , beautiful cheatsheets, NvChad updater, hide & unhide terminal buffers, theme switcher and much more!
- NvChad updater, hide & unhide terminal buffers with [NvChad extensions](https://github.com/NvChad/extensions)
- Lightweight & performant ui plugin with [NvChad UI](https://github.com/NvChad/ui) It provides statusline modules, tabufline ( tabs + buffer manager) , beautiful cheatsheets and much more!
- File navigation with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua)
- Beautiful and configurable icons with [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons)
- Git diffs and more with [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)
@ -112,7 +113,7 @@ A fuzzy file finder, picker, sorter, previewer and much more:
If you like NvChad and would like to support & appreciate it via donation then I'll gladly accept it.
[![kofi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/siduck)
[![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/siduck13)
[![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/siduck76)
[![buymeacoffee](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/siduck)
[![patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://www.patreon.com/siduck)

3
.gitignore vendored
View File

@ -1,8 +1,5 @@
spell
ftplugin
syntax
coc-settings.json
.luarc.json
lazy-lock.json
after
**/.DS_Store

View File

@ -1 +0,0 @@
!/lua/custom/

View File

@ -1,24 +1,18 @@
local M = {}
local fn = vim.fn
M.echo = function(str)
vim.cmd "redraw"
vim.api.nvim_echo({ { str, "Bold" } }, true, {})
end
local function shell_call(args)
local output = fn.system(args)
assert(vim.v.shell_error == 0, "External call failed with error code: " .. vim.v.shell_error .. "\n" .. output)
end
M.lazy = function(install_path)
------------- base46 ---------------
local lazy_path = fn.stdpath "data" .. "/lazy/base46"
local lazy_path = vim.fn.stdpath "data" .. "/lazy/base46"
M.echo " Compiling base46 theme to bytecode ..."
local base46_repo = "https://github.com/NvChad/base46"
shell_call { "git", "clone", "--depth", "1", "-b", "v2.0", base46_repo, lazy_path }
vim.fn.system { "git", "clone", "--depth", "1", "-b", "v2.0", base46_repo, lazy_path }
vim.opt.rtp:prepend(lazy_path)
require("base46").compile()
@ -26,26 +20,32 @@ M.lazy = function(install_path)
--------- lazy.nvim ---------------
M.echo " Installing lazy.nvim & plugins ..."
local repo = "https://github.com/folke/lazy.nvim.git"
shell_call { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path }
vim.fn.system { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path }
vim.opt.rtp:prepend(install_path)
-- install plugins
require "plugins"
-- mason packages & show post_bootstrap screen
require "nvchad.post_install"()
-- mason packages & show post_boostrap screen
require "nvchad.post_bootstrap"()
end
M.gen_chadrc_template = function()
local path = fn.stdpath "config" .. "/lua/custom"
if not vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1] then
local path = vim.fn.stdpath "config" .. "/lua/custom/"
local input = vim.fn.input "Do you want to install example custom config? (y/N) : "
if fn.isdirectory(path) ~= 1 then
-- use very minimal chadrc
fn.mkdir(path, "p")
-- clone example_config repo
if input == "y" then
M.echo "cloning example custom config repo ..."
vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path }
vim.fn.delete(path .. ".git", "rf")
else
-- use very minimal chadrc
vim.fn.mkdir(path, "p")
local file = io.open(path .. "/chadrc.lua", "w")
if file then
file:write "---@type ChadrcConfig\nlocal M = {}\n\nM.ui = { theme = 'onedark' }\n\nreturn M"
local file = io.open(path .. "chadrc.lua", "w")
file:write "---@type ChadrcConfig \n local M = {}\n M.ui = {theme = 'onedark'}\n return M"
file:close()
end
end

View File

@ -90,6 +90,6 @@ M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file
M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options
M.mappings = require "core.mappings"
M.mappings = {}
return M

View File

@ -44,8 +44,6 @@ opt.timeoutlen = 400
opt.undofile = true
opt.scrolloff = 15
opt.wildignore:append "tags,Session.vim"
-- interval for writing swap file to disk, also used by gitsigns
opt.updatetime = 250
@ -61,8 +59,8 @@ 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
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
local is_windows = vim.loop.os_uname().sysname == "Windows_NT"
vim.env.PATH = vim.env.PATH .. (is_windows and ";" or ":") .. vim.fn.stdpath "data" .. "/mason/bin"
-------------------------------------- autocmds ------------------------------------------
local autocmd = vim.api.nvim_create_autocmd
@ -76,10 +74,11 @@ autocmd("FileType", {
})
-- reload some chadrc options on-save
autocmd("BufWritePost", {
pattern = vim.tbl_map(function(path)
return vim.fs.normalize(vim.loop.fs_realpath(path))
end, vim.fn.glob(vim.fn.stdpath "config" .. "/lua/custom/**/*.lua", true, true, true)),
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = vim.tbl_map(
vim.fs.normalize,
vim.fn.glob(vim.fn.stdpath "config" .. "/lua/custom/**/*.lua", true, true, true)
),
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
callback = function(opts)
@ -98,49 +97,17 @@ autocmd("BufWritePost", {
vim.g.transparency = true
-- statusline
require("plenary.reload").reload_module("nvchad.statusline." .. config.ui.statusline.theme)
vim.opt.statusline = "%!v:lua.require('nvchad.statusline." .. config.ui.statusline.theme .. "').run()"
-- tabufline
if config.ui.tabufline.enabled then
require("plenary.reload").reload_module "nvchad.tabufline.modules"
vim.opt.tabline = "%!v:lua.require('nvchad.tabufline.modules').run()"
end
require("plenary.reload").reload_module("nvchad_ui.statusline." .. config.ui.statusline.theme)
vim.opt.statusline = "%!v:lua.require('nvchad_ui.statusline." .. config.ui.statusline.theme .. "').run()"
require("base46").load_all_highlights()
-- vim.cmd("redraw!")
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
new_cmd("NvChadUpdate", function()
require "nvchad.updater"()
require "nvchad.update"()
end, {})

View File

@ -18,7 +18,6 @@ M.general = {
n = {
["<leader>n"] = { ":noh <CR>", "Clear highlights" },
["<leader>rr"] = { ":source $MYVIMRC<CR>", "Reload config file" },
["<Esc>"] = { "<cmd> noh <CR>", "Clear highlights" },
-- switch between windows
["<C-h>"] = { "<C-w>h", "Window left" },
["<C-l>"] = { "<C-w>l", "Window right" },
@ -62,13 +61,6 @@ M.general = {
-- 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",
},
},
t = {
@ -78,8 +70,6 @@ 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" },
},
x = {
@ -104,18 +94,11 @@ M.customstuffs = {
["<C-t>"] = { "<cmd> TagbarToggle<CR>", "Show tagbar" },
["<leader>ra"] = { "<cmd> call VrcQuery()<CR>", "Call REST endpoint" },
["<leader>dl"] = { "0d$", "Delete line from start" },
["<leader>gpu"] = { "<cmd> Git pull<CR>", "Git pull" },
["<leader>gpf"] = { ":Git push ", "Git push with option" },
["<leader>gmm"] = { "<cmd> Git merge master<CR>", "Git merge master" },
["<leader>gmi"] = { ":Git merge ", "Git merge ..." },
["<leader>ga"] = { ":Git commit -a --amend --no-edit --no-verify", "Git commit -a --amend --no-edit --no-verify" },
["<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>grm"] = { ":Git rebase -i master", "Git rebase interactive from master" },
["<leader>grr"] = { ":Git rebase -i ", "Git rebase interactive from <select>" },
-- ["<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" },
["<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" },
@ -129,49 +112,14 @@ M.customstuffs = {
-- Mappings: TODO
-- "trim(system('git branch --show-current 2>/dev/null'))"
-- ["<leader>ct"] = { ":call append(line('.') - 1, repeat(' ', indent('.')) . '# TODO-' . trim(system('git branch --show-current 2>/dev/null')) . ': ' . input('Comment >'))<CR>", "Add TODO comment + add to qflist" },
["<leader>ct"] = { ":call append(line('.') - 1, repeat(' ', indent('.')) . '# TODO: ' . input('Comment >'))<CR>", "Add TODO comment + add to qflist" },
-- ["<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" },
["<leader>tt"] = { ":call append(line('.') - 1, repeat(' ', indent('.')) . '# TODO: ' . input('Comment >'))<CR>", "Add TODO comment + add to quickfix list" },
["<leader>ww"] = { ":lua require('nvim-window').pick()<CR>", "Pick window to goto" },
["<leader>wm"] = { ":WinShift<CR>", "Enter move window mode" },
["<leader>ws"] = { ":WinShift swap<CR>", "Swap window, with selection" },
["<leader>gg"] = { ":LazyGit<CR>", "Open lazygit" },
["gf"] = { ":call search('[A-Z]', 'W')<CR>", "Go to next uppercase" },
["fg"] = { ":call search('[A-Z]', 'bW')<CR>", "Go to last uppercase" },
["glb"] = { ":lua require('gitlab').choose_merge_request()<CR>", "Gitlab: Choose merge request" },
["glr"] = { ":lua require('gitlab').review()<CR>", "Gitlab: review" },
["gls"] = { ":lua require('gitlab').summary()<CR>", "Gitlab: summary" },
["glo"] = { ":lua require('gitlab').open_in_browser()<CR>", "Gitlab: open in browser" },
["glu"] = { ":lua require('gitlab').copy_mr_url()<CR>", "Gitlab: open in browser" },
["glO"] = { ":lua require('gitlab').create_mr()<CR>", "Gitlab: create MR" },
["glaa"] = { ":lua require('gitlab').add_assignee()<CR>", "Gitlab: add_assignee" },
-- vim.keymap.set("n", "glb", gitlab.choose_merge_request)
-- vim.keymap.set("n", "glr", gitlab.review)
-- vim.keymap.set("n", "gls", gitlab.summary)
-- vim.keymap.set("n", "glA", gitlab.approve)
-- vim.keymap.set("n", "glR", gitlab.revoke)
-- vim.keymap.set("n", "glc", gitlab.create_comment)
-- vim.keymap.set("v", "glc", gitlab.create_multiline_comment)
-- vim.keymap.set("v", "glC", gitlab.create_comment_suggestion)
-- vim.keymap.set("n", "glO", gitlab.create_mr)
-- vim.keymap.set("n", "glm", gitlab.move_to_discussion_tree_from_diagnostic)
-- vim.keymap.set("n", "gln", gitlab.create_note)
-- vim.keymap.set("n", "gld", gitlab.toggle_discussions)
-- vim.keymap.set("n", "glaa", gitlab.add_assignee)
-- vim.keymap.set("n", "glad", gitlab.delete_assignee)
-- vim.keymap.set("n", "glla", gitlab.add_label)
-- vim.keymap.set("n", "glld", gitlab.delete_label)
-- vim.keymap.set("n", "glra", gitlab.add_reviewer)
-- vim.keymap.set("n", "glrd", gitlab.delete_reviewer)
-- vim.keymap.set("n", "glp", gitlab.pipeline)
-- vim.keymap.set("n", "glM", gitlab.merge)
-- vim.keymap.set("n", "glu", gitlab.copy_mr_url)
-- vim.keymap.set("n", "glP", gitlab.publish_all_drafts)
},
v = {
["n"] = { "nzz", "Next + auto center" },
@ -192,14 +140,14 @@ M.tabufline = {
-- cycle through buffers
["<tab>"] = {
function()
require("nvchad.tabufline").tabuflineNext()
require("nvchad_ui.tabufline").tabuflineNext()
end,
"Goto next buffer",
},
["<S-tab>"] = {
function()
require("nvchad.tabufline").tabuflinePrev()
require("nvchad_ui.tabufline").tabuflinePrev()
end,
"Goto prev buffer",
},
@ -207,7 +155,7 @@ M.tabufline = {
-- close buffer + hide terminal buffer
["<leader>x"] = {
function()
require("nvchad.tabufline").close_buffer()
require("nvchad_ui.tabufline").close_buffer()
end,
"Close buffer",
},
@ -285,7 +233,7 @@ M.lspconfig = {
["<leader>ra"] = {
function()
require("nvchad.renamer").open()
require("nvchad_ui.renamer").open()
end,
"LSP rename",
},
@ -304,7 +252,7 @@ M.lspconfig = {
"LSP references",
},
["<leader>lf"] = {
["<leader>f"] = {
function()
vim.diagnostic.open_float { border = "rounded" }
end,
@ -313,14 +261,14 @@ M.lspconfig = {
["[d"] = {
function()
vim.diagnostic.goto_prev { float = { border = "rounded" } }
vim.diagnostic.goto_prev({ float = { border = "rounded" }})
end,
"Goto prev",
},
["]d"] = {
function()
vim.diagnostic.goto_next { float = { border = "rounded" } }
vim.diagnostic.goto_next({ float = { border = "rounded" }})
end,
"Goto next",
},
@ -332,6 +280,13 @@ M.lspconfig = {
-- "Diagnostic setloclist",
-- },
["<leader>fm"] = {
function()
vim.lsp.buf.format { async = true }
end,
"LSP formatting",
},
["<leader>wa"] = {
function()
vim.lsp.buf.add_workspace_folder()
@ -353,15 +308,6 @@ M.lspconfig = {
"List workspace folders",
},
},
v = {
["<leader>ca"] = {
function()
vim.lsp.buf.code_action()
end,
"LSP code action",
},
},
}
M.nvimtree = {
@ -388,52 +334,24 @@ M.telescope = {
["<C-f>"] = { "<cmd> Telescope live_grep <CR>", "Live grep" },
["<C-b>"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
["<leader>ff"] = { "<cmd> lua require('telescope.builtin').live_grep({default_text='<<<<<<< HEAD'}) <CR>", "Search for git conflicts" },
["<leader>fg"] = { "<cmd> lua require('telescope.builtin').live_grep({default_text=vim.fn.getreg('/')}) <CR>", "Live grep with actual search value as prefix" },
["<leader>gf"] = { "<cmd> lua require('telescope.builtin').find_files({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>qr"] = { ":execute 'cdo' '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >', getreg('')) . '/g | update' <CR>", "Replace pattern in all quickfix list" },
["<leader>qr"] = { ":cdo '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >', '') . '/g | update' <CR>", "Replace pattern in all quickfix list" },
["<leader>br"] = { ":execute '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >', '') . '/g | update' <CR>", "Replace pattern in current buffer" },
["<leader>fg<CR>"] = { "<cmd> lua require('telescope.builtin').live_grep({}) <CR>", "Live grep" },
["<leader>fg/"] = { "<cmd> lua require('telescope.builtin').live_grep({default_text=vim.fn.getreg('/')}) <CR>", "Live grep with search term" },
["<leader>fgw"] = { "<cmd> lua require('telescope.builtin').live_grep({default_text=vim.fn.expand('<cword>')}) <CR>", "Live grep with current word" },
["<leader>ql"] = { "<cmd> Telescope quickfix <CR>", "Show quickfix list" },
["<leader>qn"] = { ":cnext<CR>", "Jump to next in quickfix list" },
["<leader>qp"] = { ":cprevious<CR>", "Jump to previous in quickfix list" },
["<leader>gf<CR>"] = { "<cmd> lua require('telescope.builtin').find_files({}) <CR>", "Find files" },
["<leader>gf/"] = { "<cmd> lua require('telescope.builtin').find_files({default_text=vim.fn.getreg('/')}) <CR>", "Find files with search term" },
["<leader>gfw"] = { "<cmd> lua require('telescope.builtin').find_files({default_text=vim.fn.expand('<cword>')}) <CR>", "Find files with current word" },
["<leader>br<CR>"] = { ":execute '%s/' . input('Search term >') . '/' . input('Replace by >', '') . '/g | update' <CR>", "Replace pattern in current buffer" },
["<leader>br/"] = { ":execute '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >', '') . '/g | update' <CR>", "Replace search term pattern in current buffer" },
["<leader>brw"] = { ":execute '%s/' . input('Search term >', expand('<cword>')) . '/' . input('Replace by >', '') . '/g | update' <CR>", "Replace current word pattern in current buffer" },
-- Quickfix list
["<leader>ql"] = { "<cmd> Telescope quickfix <CR>", "Show qflist" },
["<leader>qn"] = { ":cnext<CR>", "Jump to next in qflist" },
["]q"] = { ":cnext<CR>", "Jump to next in qflist" },
["<leader>qp"] = { ":cprevious<CR>", "Jump to previous in qflist" },
["[q"] = { ":cprevious<CR>", "Jump to previous in qflist" },
["<leader>qc"] = { ":call setqflist([]) | cclose<CR>", "Clear qflist" },
-- Quickfix replace all
["<leader>qr<CR>"] = { ":execute 'cfdo' '%s/' . input('Search term >') . '/' . input('Replace by >') . '/gI | update' <CR>", "Replace pattern in all qflist" },
["<leader>qr/"] = { ":execute 'cfdo' '%s/' . input('Search term >', getreg('/')) . '/' . input('Replace by >') . '/gI | update' <CR>", "Replace search term in all qflist" },
["<leader>qrw"] = { ":execute 'cfdo' '%s/' . input('Search term >', expand('<cword>')) . '/' . input('Replace by >') . '/gI | update' <CR>", "Replace current word in all qflist" },
-- Quickfix "search"
["<leader>qs<CR>"] = { ":execute 'vimgrep' '/' . input('Pattern >') . '\\C/' '**/*' <CR>", "Add <> files in qflist" },
["<leader>qs/"] = { ":execute 'vimgrep' '/' . input('Pattern >', getreg('/')) . '\\C/' '**/*' <CR>", "Add search term files in qflist" },
["<leader>qsw"] = { ":execute 'vimgrep' '/' . input('Pattern >', expand('<cword>')) . '\\C/' '**/*' <CR>", "Add current word files in qflist" },
-- Loclist list
["<leader>ll"] = { "<cmd> Telescope loclist <CR>", "Show loclist" },
["<leader>ll"] = { "<cmd> Telescope loclist <CR>", "Show loclist list" },
["<leader>ln"] = { ":lnext<CR>", "Jump to next in loclist" },
["]l"] = { ":lnext<CR>", "Jump to next in loclist" },
["<leader>lp"] = { ":lprevious<CR>", "Jump to previous in loclist" },
["[l"] = { ":lprevious<CR>", "Jump to previous in loclist" },
["<leader>lc"] = { ":call setloclist([]) | lclose<CR>", "Clear loclist" },
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "Help page" },
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "Find oldfiles" },
["<leader>fx<CR>"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
["<leader>fx/"] = { "<cmd> lua require('telescope.builtin').current_buffer_fuzzy_find({default_text=vim.fn.getreg('/')}) <CR>", "Fuzzy find in current buffer with actual search" },
["<leader>fxw"] = { "<cmd> lua require('telescope.builtin').current_buffer_fuzzy_find({default_text=vim.fn.expand('<cword>')}) <CR>", "Fuzzy find in current buffer with current word" },
["<leader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
["<leader>wl"] = { "<cmd> Telescope workspaces <CR>", "Find workspaces" },
@ -461,10 +379,8 @@ M.telescope = {
["<leader>/"] = { "<cmd> Telescope search_history <CR>", "telescope search history" },
-- Diaglist: LSP diagnostics in quick/loc list
["<leader>dw"] = { "<cmd>lua require('diaglist').open_all_diagnostics()<CR>", "Open all open buffers diagnostics in qflist" },
["<leader>d0"] = { "<cmd>lua require('diaglist').open_buffer_diagnostics()<CR>", "Open current buffer diagnostics in loclist" },
["<leader>;"] = { "<cmd> Telescope <CR>", "Open Telescope" },
["<leader>dw"] = { "<cmd>lua require('diaglist').open_all_diagnostics()<CR>", "Open all open buffers diagnostics in quickfix list" },
["<leader>d0"] = { "<cmd>lua require('diaglist').open_buffer_diagnostics()<CR>", "Open current buffer diagnostics in loclist list" },
},
}

View File

@ -8,11 +8,11 @@ M.load_config = function()
if chadrc_path then
local chadrc = dofile(chadrc_path)
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
config.mappings = M.remove_disabled_keys(chadrc.mappings, require "core.mappings")
config = merge_tb("force", config, chadrc)
config.mappings.disabled = nil
end
config.mappings.disabled = nil
return config
end

View File

@ -2,7 +2,6 @@
local previewers = require('telescope.previewers')
local builtin = require('telescope.builtin')
local E = {}
local delta = previewers.new_termopen_previewer {

View File

@ -15,7 +15,7 @@ local formatting_style = {
fields = field_arrangement[cmp_style] or { "abbr", "kind", "menu" },
format = function(_, item)
local icons = require "nvchad.icons.lspkind"
local icons = require("nvchad_ui.icons").lspkind
local icon = (cmp_ui.icons and icons[item.kind]) or ""
if cmp_style == "atom" or cmp_style == "atom_colored" then
@ -52,7 +52,7 @@ local options = {
window = {
completion = {
side_padding = (cmp_style ~= "atom" and cmp_style ~= "atom_colored") and 1 or 0,
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:None",
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel",
scrollbar = false,
},
documentation = {
@ -76,8 +76,8 @@ local options = {
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then

View File

@ -1,138 +0,0 @@
local M = {
port = nil, -- The port of the Go server, which runs in the background, if omitted or `nil` the port will be chosen automatically
log_path = vim.fn.stdpath("cache") .. "/gitlab.nvim.log", -- Log path for the Go server
config_path = nil, -- Custom path for `.gitlab.nvim` file, please read the "Connecting to Gitlab" section
debug = {
go_request = false,
go_response = false,
},
attachment_dir = nil, -- The local directory for files (see the "summary" section)
reviewer_settings = {
diffview = {
imply_local = false, -- If true, will attempt to use --imply_local option when calling |:DiffviewOpen|
},
},
connection_settings = {
insecure = false, -- Like curl's --insecure option, ignore bad x509 certificates on connection
},
help = "g?", -- Opens a help popup for local keymaps when a relevant view is focused (popup, discussion panel, etc)
popup = { -- The popup for comment creation, editing, and replying
keymaps = {
next_field = "<Tab>", -- Cycle to the next field. Accepts count.
prev_field = "<S-Tab>", -- Cycle to the previous field. Accepts count.
},
perform_action = "<leader>s", -- Once in normal mode, does action (like saving comment or editing description, etc)
perform_linewise_action = "<leader>l", -- Once in normal mode, does the linewise action (see logs for this job, etc)
width = "50%",
height = "80%",
border = "rounded", -- One of "
opacity = 1.0, -- From 0.0 (fully transparent) to 1.0 (fully opaque)
comment = nil, -- Individual popup overrides, e.g. { width = "60%", height = "80%", border = "single", opacity = 0.85 },
edit = nil,
note = nil,
pipeline = nil,
reply = nil,
squash_message = nil,
temp_registers = {}, -- List of registers for backing up popup content (see `:h gitlab.nvim.temp-registers`)
},
discussion_tree = { -- The discussion tree that holds all comments
auto_open = true, -- Automatically open when the reviewer is opened
switch_view = "S", -- Toggles between the notes and discussions views
default_view = "discussions", -- Show "discussions" or "notes" by default
blacklist = {}, -- List of usernames to remove from tree (bots, CI, etc)
jump_to_file = "o", -- Jump to comment location in file
jump_to_reviewer = "m", -- Jump to the location in the reviewer window
edit_comment = "e", -- Edit comment
delete_comment = "dd", -- Delete comment
reply = "r", -- Reply to comment
toggle_node = "t", -- Opens or closes the discussion
add_emoji = "Ea", -- Add an emoji to the note/comment
-- add_emoji = "Ed", -- Remove an emoji from a note/comment
toggle_all_discussions = "T", -- Open or close separately both resolved and unresolved discussions
toggle_resolved_discussions = "R", -- Open or close all resolved discussions
toggle_unresolved_discussions = "U", -- Open or close all unresolved discussions
keep_current_open = false, -- If true, current discussion stays open even if it should otherwise be closed when toggling
publish_draft = "P", -- Publishes the currently focused note/comment
toggle_resolved = "p", -- Toggles the resolved status of the whole discussion
position = "left", -- "top", "right", "bottom" or "left"
open_in_browser = "b", -- Jump to the URL of the current note/discussion
copy_node_url = "u", -- Copy the URL of the current node to clipboard
size = "30%", -- Size of split
relative = "editor", -- Position of tree split relative to "editor" or "window"
resolved = '', -- Symbol to show next to resolved discussions
unresolved = '', -- Symbol to show next to unresolved discussions
tree_type = "by_file_name", -- Type of discussion tree - "simple" means just list of discussions, "by_file_name" means file tree with discussions under file
toggle_tree_type = "i", -- Toggle type of discussion tree - "simple", or "by_file_name"
draft_mode = false, -- Whether comments are posted as drafts as part of a review
toggle_draft_mode = "D", -- Toggle between draft mode (comments posted as drafts) and live mode (comments are posted immediately)
winbar = nil, -- Custom function to return winbar title, should return a string. Provided with WinbarTable (defined in annotations.lua)
-- If using lualine, please add "gitlab" to disabled file types, otherwise you will not see the winbar.
},
choose_merge_request = {
open_reviewer = true, -- Open the reviewer window automatically after switching merge requests
},
info = { -- Show additional fields in the summary view
enabled = true,
horizontal = false, -- Display metadata to the left of the summary rather than underneath
fields = { -- The fields listed here will be displayed, in whatever order you choose
"author",
"created_at",
"updated_at",
"merge_status",
"draft",
"conflicts",
"assignees",
"reviewers",
"pipeline",
"branch",
"target_branch",
"delete_branch",
"squash",
"labels",
},
},
discussion_signs = {
enabled = true, -- Show diagnostics for gitlab comments in the reviewer
skip_resolved_discussion = false, -- Show diagnostics for resolved discussions
severity = vim.diagnostic.severity.INFO, -- ERROR, WARN, INFO, or HINT
virtual_text = false, -- Whether to show the comment text inline as floating virtual text
priority = 100, -- Higher will override LSP warnings, etc
icons = {
comment = "→|",
range = " |",
},
},
pipeline = {
created = "",
pending = "",
preparing = "",
scheduled = "",
running = "",
canceled = "",
skipped = "",
success = "",
failed = "",
},
create_mr = {
target = "master", -- Default branch to target when creating an MR
template_file = nil, -- Default MR template in .gitlab/merge_request_templates
delete_branch = false, -- Whether the source branch will be marked for deletion
squash = false, -- Whether the commits will be marked for squashing
title_input = { -- Default settings for MR title input window
width = 40,
border = "rounded",
},
},
colors = {
discussion_tree = {
username = "Keyword",
date = "Comment",
chevron = "DiffviewNonText",
directory = "Directory",
directory_icon = "DiffviewFolderSign",
file_name = "Normal",
}
}
}
return M

View File

@ -1,21 +1,22 @@
dofile(vim.g.base46_cache .. "lsp")
require "nvchad.lsp"
require "nvchad_ui.lsp"
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)
require("nvchad_ui.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
if not utils.load_config().ui.lsp_semantic_tokens then
client.server_capabilities.semanticTokensProvider = nil
end
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,
@ -54,7 +54,7 @@ require("lspconfig").lua_ls.setup {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
[vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types"] = true,
[vim.fn.stdpath "data" .. "/lazy/extensions/nvchad_types"] = true,
[vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
},
maxPreload = 100000,

View File

@ -1,7 +1,7 @@
local options = {
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
PATH = "prepand",
PATH = "skip",
ui = {
icons = {

View File

@ -1,46 +0,0 @@
local M = {
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
views = {
cmdline_popup = {
-- border = {
-- style = "none",
-- padding = { 2, 3 },
-- },
-- position = {
-- row = "85%",
-- col = "50%",
-- },
size = {
width = 120,
height = "auto",
},
},
popupmenu = {
-- relative = "editor",
-- position = {
-- row = 25,
-- col = "50%",
-- },
size = {
width = 120,
-- height = 10,
}
}
},
}
return M

View File

@ -51,12 +51,12 @@ end
M.gitsigns = {
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "󰍵" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" },
add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" },
change = { hl = "DiffChange", text = "", numhl = "GitSignsChangeNr" },
delete = { hl = "DiffDelete", text = "󰍵", numhl = "GitSignsDeleteNr" },
topdelete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
untracked = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
},
on_attach = function(bufnr)
utils.load_mappings("gitsigns", { buffer = bufnr })

View File

@ -18,7 +18,7 @@ local on_attach = function(client, bufnr)
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', '<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()

View File

@ -158,20 +158,10 @@ local options = {
mappings = {
i = {
["<CR>"] = custom_actions.multi_selection_open,
["<C-v>"] = custom_actions.multi_selection_vsplit,
["<C-V>"] = custom_actions.multi_selection_vsplit,
["<C-X>"] = custom_actions.multi_selection_split,
["<C-T>"] = custom_actions.multi_selection_tab,
["<C-Space>"] = actions.smart_send_to_qflist,
["<C-L>"] = actions.smart_send_to_loclist,
},
n = i,
}
},
live_grep = {
mappings = {
i = {
["<C-Space>"] = actions.smart_send_to_qflist,
["<C-L>"] = actions.smart_send_to_loclist,
["<C-SPACE>"] = actions.send_selected_to_qflist,
},
n = i,
}

View File

@ -1,5 +1,5 @@
local options = {
ensure_installed = { "lua", "vim", "vimdoc" },
ensure_installed = { "lua" },
highlight = {
enable = true,

View File

@ -20,26 +20,6 @@ local default_plugins = {
{"preservim/tagbar", lazy=false},
{"ludovicchabant/vim-gutentags", lazy=false},
{"emaniacs/vim-rest-console", lazy=false},
{"harrisoncramer/gitlab.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"sindrets/diffview.nvim",
"stevearc/dressing.nvim", -- Recommended but not required. Better UI for pickers.
"nvim-tree/nvim-web-devicons" -- Recommended but not required. Icons in discussion tree.
},
enabled = true,
lazy = false,
build = function()
require("gitlab.server").build(true)
end, -- Builds the Go binary
opts = function()
return require "plugins.configs.gitlab"
end,
config = function(_, opts)
require("gitlab").setup(opts)
end,
},
{
"sindrets/diffview.nvim",
lazy=false,
@ -50,6 +30,9 @@ local default_plugins = {
{"nvim-telescope/telescope-fzf-native.nvim", build="make"},
-- nvchad plugins
{ "NvChad/extensions", branch = "v2.0" },
{
"NvChad/base46",
branch = "v2.0",
@ -62,10 +45,13 @@ local default_plugins = {
"NvChad/ui",
branch = "v2.0",
lazy = false,
config = function()
require "nvchad_ui"
end,
},
{
"zbirenbaum/nvterm",
"NvChad/nvterm",
init = function()
require("core.utils").load_mappings "nvterm"
end,
@ -77,7 +63,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)
@ -91,7 +79,7 @@ local default_plugins = {
{
"nvim-tree/nvim-web-devicons",
opts = function()
return { override = require "nvchad.icons.devicons" }
return { override = require("nvchad_ui.icons").devicons }
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "devicons")
@ -105,7 +93,6 @@ local default_plugins = {
init = function()
require("core.utils").lazy_load "indent-blankline.nvim"
end,
event = "User FilePost",
opts = function()
return require("plugins.configs.others").blankline
end,
@ -118,7 +105,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()
@ -143,7 +132,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,
@ -156,7 +160,7 @@ local default_plugins = {
-- lsp stuff
{
"williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" },
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
opts = function()
return require "plugins.configs.mason"
end,
@ -166,9 +170,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
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
end, {})
vim.g.mason_binaries_list = opts.ensure_installed
@ -177,7 +179,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,
@ -233,19 +237,12 @@ local default_plugins = {
{
"numToStr/Comment.nvim",
keys = {
{ "gcc", mode = "n", desc = "Comment toggle current line" },
{ "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" },
{ "gc", mode = "x", desc = "Comment toggle linewise (visual)" },
{ "gbc", mode = "n", desc = "Comment toggle current block" },
{ "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" },
{ "gb", mode = "x", desc = "Comment toggle blockwise (visual)" },
},
keys = { "gcc", "gbc" },
init = function()
require("core.utils").load_mappings "comment"
end,
config = function(_, opts)
require("Comment").setup(opts)
config = function()
require("Comment").setup()
end,
},
@ -363,12 +360,12 @@ local default_plugins = {
config = function(_, opts)
dofile(vim.g.base46_cache .. "nvimtree")
require("nvim-tree").setup(opts)
vim.g.nvimtree_side = opts.view.side
end,
},
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
cmd = "Telescope",
init = function()
require("core.utils").load_mappings "telescope"
@ -392,11 +389,10 @@ local default_plugins = {
{
"folke/which-key.nvim",
lazy=false,
keys = { "<leader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
keys = { "<leader>", '"', "'", "`", "c", "v" },
init = function()
require("core.utils").load_mappings "whichkey"
end,
cmd = "WhichKey",
config = function(_, opts)
dofile(vim.g.base46_cache .. "whichkey")
require("which-key").setup(opts)
@ -407,27 +403,6 @@ local default_plugins = {
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" }
},
{
"folke/noice.nvim",
event = "VeryLazy",
opts = function()
return require "plugins.configs.noice"
end,
dependencies = {
"MunifTanjim/nui.nvim",
-- "rcarriga/nvim-notify",
},
},
{
"folke/todo-comments.nvim",
lazy=false,
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
local config = require("core.utils").load_config()