mirror of
https://github.com/NvChad/NvChad
synced 2023-10-04 09:45:13 -05:00
Compare commits
109 commits
d0b6511777
...
215aa2bb2f
Author | SHA1 | Date | |
---|---|---|---|
215aa2bb2f | |||
617dca4dc1 | |||
de85977316 | |||
456ae88fad | |||
a69e8dc591 | |||
a9bc954d02 | |||
3f1e6d71d4 | |||
9c013a6aac | |||
d3d9aa251a | |||
46a61073a8 | |||
8ea74bc23b | |||
487ca44566 | |||
05f581918a | |||
6766acefec | |||
0e27cb4b44 | |||
682b023fb3 | |||
f18488d41c | |||
720d71b546 | |||
08f3deb901 | |||
3500e7388d | |||
83aac1ecc0 | |||
10b668d98a | |||
286c951d7b | |||
4aa283119a | |||
212bb9a66f | |||
11c839f870 | |||
d3433e3c55 | |||
8ba64ff369 | |||
e3bb39106e | |||
a18d92dfa6 | |||
d73d155287 | |||
27992efc1c | |||
1d26f9dc50 | |||
c2a0bb1684 | |||
c3c349c830 | |||
f8a489ea1a | |||
d72d935b35 | |||
9c10201ef3 | |||
582dff9458 | |||
262a06776a | |||
f6229b4b46 | |||
1cb237fa78 | |||
c8a1aa2e2b | |||
a54e4e9272 | |||
914f9a400e | |||
699aeaa442 | |||
e1631629b9 | |||
3dd0fa6c5b | |||
03f93e5d75 | |||
b51065b1a8 | |||
907684efa0 | |||
56e6234363 | |||
cff182ce4b | |||
fdb3ddb806 | |||
7914da7cd3 | |||
12f26e91ef | |||
34bdca17d2 | |||
af123eee4d | |||
f873d3cc50 | |||
b5cf9fde0e | |||
907b112514 | |||
3479853e69 | |||
0619ef4e1e | |||
1754a23e65 | |||
4d45597468 | |||
a5906e48fb | |||
8ec2cb3b76 | |||
800d066aab | |||
ffdb4fc5e5 | |||
c77c086365 | |||
55de4b9c85 | |||
d7f91016a8 | |||
79805b7fea | |||
609000db5b | |||
ed03799697 | |||
432b2c1cf1 | |||
0678b329dc | |||
59cee93fce | |||
7ec4515179 | |||
84bdc2335c | |||
effec96b53 | |||
208c31f2ba | |||
d1d25231cd | |||
edb80f4e0c | |||
8214d4e858 | |||
3353abb499 | |||
3563b5af83 | |||
9dcaefd73f | |||
a5833730d7 | |||
bb87d70fd6 | |||
b2aa30b5ae | |||
7830f0334f | |||
8eaa3666dd | |||
caeec36191 | |||
9ae789b332 | |||
521e6f872f | |||
11f30badfa | |||
1e056a7eb4 | |||
08faf1d05a | |||
c205f67912 | |||
609b5450d5 | |||
5842684087 | |||
612561a195 | |||
9ed851000d | |||
acfc5626ac | |||
1dd3bf5a18 | |||
dab9171e64 | |||
1d04d70417 | |||
0aafb002b5 |
75
.github/README.md
vendored
75
.github/README.md
vendored
|
@ -1,27 +1,21 @@
|
|||
<h1 align="center">NvChad</h1>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://nvchad.github.io/">Home</a>
|
||||
<a href="https://nvchad.com/">Home</a>
|
||||
<span> • </span>
|
||||
<a href="https://nvchad.github.io/quickstart/install">Install</a>
|
||||
<a href="https://nvchad.com/docs/quickstart/install">Install</a>
|
||||
<span> • </span>
|
||||
<a href="https://nvchad.github.io/contribute">Contribute</a>
|
||||
<a href="https://nvchad.com/docs/contribute">Contribute</a>
|
||||
<span> • </span>
|
||||
<a href="https://github.com/NvChad/NvChad#gift_heart-support">Support</a>
|
||||
<span> • </span>
|
||||
<a href="https://nvchad.github.io/Features">Features</a>
|
||||
<a href="https://nvchad.com/docs/features">Features</a>
|
||||
<p></p>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[![Super Linter](https://img.shields.io/github/workflow/status/NvChad/NvChad/Super-Linter/main?style=flat-square&logo=github&label=Build&color=8DBBE9)]()
|
||||
<a href="https://github.com/NvChad/NvChad/blob/main/LICENSE"
|
||||
><img
|
||||
src="https://img.shields.io/github/license/NvChad/NvChad?style=flat-square&logo=GNU&label=License&color=df967f"
|
||||
alt="License"
|
||||
/>
|
||||
[![Neovim Minimum Version](https://img.shields.io/badge/Neovim-0.8.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.9.0-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)
|
||||
|
@ -31,13 +25,11 @@
|
|||
|
||||
## Showcase
|
||||
|
||||
<img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/screenshots/dashboard.png">
|
||||
<img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/screenshots/main2.png">
|
||||
<img src="https://nvchad.com/features/nvdash.webp">
|
||||
<img src="https://nvchad.com/banner.webp">
|
||||
|
||||
( Zoom in the screenshot )
|
||||
|
||||
<img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/screenshots/main.png">
|
||||
<img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/screenshots/rxyhn1.png">
|
||||
<img src="https://nvchad.com/screenshots/onedark.webp">
|
||||
<img src="https://nvchad.com/screenshots/rxyhn1.webp">
|
||||
|
||||
## What is it?
|
||||
|
||||
|
@ -45,18 +37,19 @@
|
|||
|
||||
- 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 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)
|
||||
- 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).
|
||||
|
||||
## Theme Showcase
|
||||
|
||||
<details><summary> <b>Images (Click to expand!)</b></summary>
|
||||
|
||||
![main themes](https://github.com/NvChad/nvchad.github.io/blob/src/static/img/screenshots/four_Themes.png)
|
||||
![radium](https://github.com/NvChad/nvchad.github.io/blob/src/static/img/screenshots/radium1.png)
|
||||
![radium](https://github.com/NvChad/nvchad.github.io/blob/src/static/img/screenshots/radium2.png)
|
||||
![radium](https://github.com/NvChad/nvchad.github.io/blob/src/static/img/screenshots/radium3.png)
|
||||
![4 themes](https://nvchad.com/screenshots/four_Themes.webp)
|
||||
![radium 1](https://nvchad.com/screenshots/radium1.webp)
|
||||
![radium 2](https://nvchad.com/screenshots/radium2.webp)
|
||||
![radium 3](https://nvchad.com/screenshots/radium3.webp)
|
||||
|
||||
(Note: these are just 4-5 themes, NvChad has around 27+ themes)
|
||||
|
||||
(Note: these are just 4-5 themes, NvChad has around 56 themes)
|
||||
</details>
|
||||
|
||||
## UI related plugins used
|
||||
|
@ -67,53 +60,37 @@
|
|||
|
||||
Fast file tree:
|
||||
|
||||
<kbd><img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/features/nvimtree.png"></kbd><hr>
|
||||
<kbd><img src="https://nvchad.com/features/nvimtree.webp"></kbd>
|
||||
|
||||
<h3> Telescope-nvim </h3>
|
||||
|
||||
A fuzzy file finder, picker, sorter, previewer and much more:
|
||||
|
||||
<kbd><img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/features/tel.png"></kbd><hr>
|
||||
|
||||
<h3> Indent-blankline.nvim </h3>
|
||||
|
||||
Adds indentline:
|
||||
|
||||
<kbd><img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/features/blanklineNvim.png"></kbd><hr>
|
||||
<kbd><img src="https://nvchad.com/features/telescope.webp"></kbd>
|
||||
|
||||
<h3> Our own statusline written from scratch </h3>
|
||||
|
||||
[NvChad UI](https://github.com/NvChad/ui)
|
||||
|
||||
<kbd><img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/features/statusline.png"></kbd><hr>
|
||||
<kbd><img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/features/statusline_modes.png"></kbd><hr>
|
||||
<kbd><img src="https://nvchad.com/features/statuslines.webp"></kbd>
|
||||
|
||||
<h3> Tabufline (our own pertab bufferline) </h3>
|
||||
|
||||
<kbd><img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/features/tabufline1.png"></kbd><hr>
|
||||
<kbd><img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/features/tabufline2.png"></kbd><hr>
|
||||
<kbd><img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/features/tabufline3.png"></kbd><hr>
|
||||
<kbd><img src="https://nvchad.com/features/tabufline.webp"></kbd>
|
||||
- Here's a [video](https://www.youtube.com/watch?v=V_9iJ96U_k8&ab_channel=siduck) that showcases it.
|
||||
|
||||
<h3> Nvim-web-devicons </h3>
|
||||
|
||||
Lua fork of Vim Devicons which offers more file icon customisability:
|
||||
|
||||
<kbd><img src="https://github.com/NvChad/nvchad.github.io/blob/src/static/img/features/devicons.png"></kbd><hr>
|
||||
|
||||
<h3> Nvim-treesitter </h3
|
||||
|
||||
NeoVim Treesitter configurations and abstraction layer. We mostly use this for syntax highlighting. The pretty syntax highlighting you see in all of our screenshots has gotten possible due to treesitter
|
||||
<h3> NvCheatsheet ( our UI Plugin ) </h3>
|
||||
<kbd> <img src="https://nvchad.com/features/nvcheatsheet.webp"/></kbd>
|
||||
|
||||
</details>
|
||||
|
||||
## Plugins list
|
||||
|
||||
- Many beautiful themes, theme toggler by [our base46 plugin](https://github.com/NvChad/base46)
|
||||
- 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)
|
||||
- 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)
|
||||
- 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)
|
||||
- Managing tabs, buffers with [bufferline.nvim](https://github.com/akinsho/bufferline.nvim)
|
||||
- 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)
|
||||
- NeoVim Lsp configuration with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) and [mason.nvim](https://github.com/williamboman/mason.nvim)
|
||||
|
@ -133,7 +110,7 @@ NeoVim Treesitter configurations and abstraction layer. We mostly use this for s
|
|||
|
||||
## :gift_heart: Support
|
||||
|
||||
I'm (@siduck) really very sorry to remove the previous charity links but I had to do it for various reasons. A lot has been going here regarding financial issues and I do need some support if it's possible from your end. I haven't graduated yet and it would be great to earn some stuff as that'd help me with daily minor expenses. If you like NvChad and would like to support & appreciate it via donation then I'll gladly accept it. Dont worry! NvChad will still stay alive & active without your donations! I will remove the sponsor button and re-add the charity links once I get a job, probably a year or two.
|
||||
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/siduck76)
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,6 +2,8 @@ plugin
|
|||
custom
|
||||
spell
|
||||
ftplugin
|
||||
syntax
|
||||
coc-settings.json
|
||||
.luarc.json
|
||||
lazy-lock.json
|
||||
after
|
||||
|
|
4
init.lua
4
init.lua
|
@ -1,5 +1,4 @@
|
|||
require "core"
|
||||
require "core.options"
|
||||
|
||||
local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1]
|
||||
|
||||
|
@ -17,7 +16,6 @@ if not vim.loop.fs_stat(lazypath) then
|
|||
require("core.bootstrap").lazy(lazypath)
|
||||
end
|
||||
|
||||
dofile(vim.g.base46_cache .. "defaults")
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
require "plugins"
|
||||
|
||||
dofile(vim.g.base46_cache .. "defaults")
|
||||
|
|
|
@ -1,55 +1,60 @@
|
|||
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)
|
||||
print "Bootstrapping lazy.nvim .."
|
||||
------------- base46 ---------------
|
||||
local lazy_path = fn.stdpath "data" .. "/lazy/base46"
|
||||
|
||||
vim.fn.system {
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
install_path,
|
||||
}
|
||||
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.opt.rtp:prepend(lazy_path)
|
||||
|
||||
require("base46").compile()
|
||||
|
||||
--------- 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.opt.rtp:prepend(install_path)
|
||||
|
||||
-- install plugins + compile their configs
|
||||
-- install plugins
|
||||
require "plugins"
|
||||
require("lazy").load { plugins = { "nvim-treesitter" } }
|
||||
|
||||
-- install binaries from mason.nvim & tsparsers on LazySync
|
||||
vim.schedule(function()
|
||||
vim.cmd "silent! MasonInstallAll"
|
||||
-- print success message
|
||||
end, 0)
|
||||
-- mason packages & show post_boostrap screen
|
||||
require "nvchad.post_install"()
|
||||
end
|
||||
|
||||
M.gen_chadrc_template = function()
|
||||
if not vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1] then
|
||||
local input = vim.fn.input "Do you want to install chadrc template? (y/n) : "
|
||||
vim.cmd "redraw|echo ''"
|
||||
local path = fn.stdpath "config" .. "/lua/custom"
|
||||
|
||||
if input == "y" then
|
||||
-- clone example_config repo
|
||||
print "cloning chadrc starter template repo...."
|
||||
if fn.isdirectory(path) ~= 1 then
|
||||
local input = fn.input "Do you want to install example custom config? (y/N): "
|
||||
|
||||
vim.fn.system {
|
||||
"git",
|
||||
"clone",
|
||||
"--depth",
|
||||
"1",
|
||||
"-b",
|
||||
"v2.0",
|
||||
"https://github.com/NvChad/example_config",
|
||||
vim.fn.stdpath "config" .. "/lua/custom",
|
||||
}
|
||||
vim.cmd "redraw|echo ''"
|
||||
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")
|
||||
|
||||
-- delete .git from that repo
|
||||
vim.loop.fs_rmdir(vim.fn.stdpath "config" .. "/lua/custom/.git")
|
||||
vim.notify "successfully installed chadrc template!"
|
||||
vim.cmd "redraw|echo ''"
|
||||
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"
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
-- Chadrc overrides this file
|
||||
|
||||
local M = {}
|
||||
|
||||
M.options = {
|
||||
nvChad = {
|
||||
update_url = "https://github.com/NvChad/NvChad",
|
||||
update_branch = "v2.0",
|
||||
},
|
||||
nvchad_branch = "v2.0",
|
||||
}
|
||||
|
||||
M.ui = {
|
||||
|
@ -18,6 +13,10 @@ M.ui = {
|
|||
theme_toggle = { "onedark", "one_light" },
|
||||
theme = "onedark", -- default theme
|
||||
transparency = false,
|
||||
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
|
||||
extended_integrations = {}, -- these aren't compiled by default, ex: "alpha", "notify"
|
||||
|
||||
-- cmp themeing
|
||||
cmp = {
|
||||
|
@ -28,6 +27,8 @@ M.ui = {
|
|||
selected_item_bg = "colored", -- colored / simple
|
||||
},
|
||||
|
||||
telescope = { style = "borderless" }, -- borderless / bordered
|
||||
|
||||
------------------------------- nvchad_ui modules -----------------------------
|
||||
statusline = {
|
||||
theme = "default", -- default/vscode/vscode_colored/minimal
|
||||
|
@ -39,6 +40,8 @@ M.ui = {
|
|||
|
||||
-- lazyload it when there are 1+ buffers
|
||||
tabufline = {
|
||||
show_numbers = false,
|
||||
enabled = true,
|
||||
lazyload = true,
|
||||
overriden_modules = nil,
|
||||
},
|
||||
|
@ -61,23 +64,29 @@ 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" },
|
||||
{ " Bookmarks", "Spc b m", "Telescope marks" },
|
||||
{ " Themes", "Spc t f", "Telescope themes" },
|
||||
{ " Recent Files", "Spc f o", "Telescope oldfiles" },
|
||||
{ " Find Word", "Spc f w", "Telescope live_grep" },
|
||||
{ " Bookmarks", "Spc m a", "Telescope marks" },
|
||||
{ " Themes", "Spc t h", "Telescope themes" },
|
||||
{ " Mappings", "Spc c h", "NvCheatsheet" },
|
||||
},
|
||||
},
|
||||
|
||||
cheatsheet = {
|
||||
theme = "grid", -- simple/grid
|
||||
cheatsheet = { theme = "grid" }, -- simple/grid
|
||||
|
||||
lsp = {
|
||||
-- show function signatures i.e args as you type
|
||||
signature = {
|
||||
disabled = false,
|
||||
silent = true, -- silences 'no signature help available' message from appearing
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.plugins = "" -- path i.e "custom.plugins" -> custom/plugins.lua only and not custom/plugins/init.lua!!!!
|
||||
M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file
|
||||
|
||||
M.lazy_nvim = {} -- config for lazy.nvim startup options
|
||||
M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options
|
||||
|
||||
-- these are default mappings, check core.mappings for table structure
|
||||
M.mappings = require "core.mappings"
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,14 +1,66 @@
|
|||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
-------------------------------------- globals -----------------------------------------
|
||||
g.nvchad_theme = config.ui.theme
|
||||
g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
|
||||
g.toggle_theme_icon = " "
|
||||
g.transparency = config.ui.transparency
|
||||
|
||||
-------------------------------------- options ------------------------------------------
|
||||
opt.laststatus = 3 -- global statusline
|
||||
opt.showmode = false
|
||||
|
||||
opt.clipboard = "unnamedplus"
|
||||
opt.cursorline = true
|
||||
|
||||
-- Indenting
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 2
|
||||
opt.smartindent = true
|
||||
opt.tabstop = 2
|
||||
opt.softtabstop = 2
|
||||
|
||||
opt.fillchars = { eob = " " }
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.mouse = "a"
|
||||
|
||||
-- Numbers
|
||||
opt.number = true
|
||||
opt.numberwidth = 2
|
||||
opt.ruler = false
|
||||
|
||||
-- disable nvim intro
|
||||
opt.shortmess:append "sI"
|
||||
|
||||
opt.signcolumn = "yes"
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.termguicolors = true
|
||||
opt.timeoutlen = 400
|
||||
opt.undofile = true
|
||||
|
||||
-- interval for writing swap file to disk, also used by gitsigns
|
||||
opt.updatetime = 250
|
||||
|
||||
-- go to previous/next line with h,l,left arrow and right arrow
|
||||
-- when cursor reaches end/beginning of line
|
||||
opt.whichwrap:append "<>[]hl"
|
||||
|
||||
g.mapleader = " "
|
||||
|
||||
-- disable some default providers
|
||||
for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
|
||||
vim.g["loaded_" .. provider .. "_provider"] = 0
|
||||
end
|
||||
|
||||
-- add binaries installed by mason.nvim to 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"
|
||||
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
|
||||
|
||||
local new_cmd = vim.api.nvim_create_user_command
|
||||
|
||||
new_cmd("NvChadUpdate", function()
|
||||
require("nvchad").update_nvchad()
|
||||
end, {})
|
||||
|
||||
-- autocmds
|
||||
-------------------------------------- autocmds ------------------------------------------
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- dont list quickfix buffers
|
||||
|
@ -19,37 +71,45 @@ autocmd("FileType", {
|
|||
end,
|
||||
})
|
||||
|
||||
local sep = vim.loop.os_uname().sysname:find "windows" and "\\" or "/"
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = vim.fn.glob(
|
||||
table.concat({
|
||||
vim.fn.stdpath "config",
|
||||
"lua",
|
||||
"custom",
|
||||
"**",
|
||||
"*.lua",
|
||||
}, sep),
|
||||
true,
|
||||
true,
|
||||
true
|
||||
),
|
||||
|
||||
-- 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)),
|
||||
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
|
||||
|
||||
callback = function(opts)
|
||||
local fp = vim.fn.fnamemodify(vim.fs.normalize(vim.api.nvim_buf_get_name(opts.buf)), ":r") --[[@as string]]
|
||||
local app_name = vim.env.NVIM_APPNAME and vim.env.NVIM_APPNAME or "nvim"
|
||||
local module = string.gsub(fp, "^.*/" .. app_name .. "/lua/", ""):gsub("/", ".")
|
||||
|
||||
require("plenary.reload").reload_module "base46"
|
||||
local file = string
|
||||
.gsub(vim.fn.fnamemodify(opts.file, ":r"), vim.fn.stdpath "config" .. sep .. "lua" .. sep, "")
|
||||
:gsub(sep, ".")
|
||||
require("plenary.reload").reload_module(file)
|
||||
require("plenary.reload").reload_module(module)
|
||||
require("plenary.reload").reload_module "custom.chadrc"
|
||||
|
||||
local config = require("core.utils").load_config().ui
|
||||
config = require("core.utils").load_config()
|
||||
|
||||
vim.opt.statusline = "%!v:lua.require('nvchad_ui.statusline." .. config.statusline.theme .. "').run()"
|
||||
vim.g.nvchad_theme = config.ui.theme
|
||||
vim.g.transparency = config.ui.transparency
|
||||
|
||||
-- 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("base46").load_all_highlights()
|
||||
-- vim.cmd("redraw!")
|
||||
end,
|
||||
})
|
||||
|
||||
-------------------------------------- commands ------------------------------------------
|
||||
local new_cmd = vim.api.nvim_create_user_command
|
||||
|
||||
new_cmd("NvChadUpdate", function()
|
||||
require "nvchad.updater"()
|
||||
end, {})
|
||||
|
|
|
@ -1,79 +1,74 @@
|
|||
-- n, v, i, t = mode names
|
||||
|
||||
local function termcodes(str)
|
||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.general = {
|
||||
i = {
|
||||
-- go to beginning and end
|
||||
["<C-b>"] = { "<ESC>^i", "beginning of line" },
|
||||
["<C-e>"] = { "<End>", "end of line" },
|
||||
["<C-b>"] = { "<ESC>^i", "Beginning of line" },
|
||||
["<C-e>"] = { "<End>", "End of line" },
|
||||
|
||||
-- navigate within insert mode
|
||||
["<C-h>"] = { "<Left>", "move left" },
|
||||
["<C-l>"] = { "<Right>", "move right" },
|
||||
["<C-j>"] = { "<Down>", "move down" },
|
||||
["<C-k>"] = { "<Up>", "move up" },
|
||||
["<C-h>"] = { "<Left>", "Move left" },
|
||||
["<C-l>"] = { "<Right>", "Move right" },
|
||||
["<C-j>"] = { "<Down>", "Move down" },
|
||||
["<C-k>"] = { "<Up>", "Move up" },
|
||||
},
|
||||
|
||||
n = {
|
||||
["<ESC>"] = { "<cmd> noh <CR>", "no highlight" },
|
||||
|
||||
["<Esc>"] = { ":noh <CR>", "Clear highlights" },
|
||||
-- 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-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" },
|
||||
|
||||
-- save
|
||||
["<C-s>"] = { "<cmd> w <CR>", "save file" },
|
||||
["<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" },
|
||||
|
||||
-- line numbers
|
||||
["<leader>n"] = { "<cmd> set nu! <CR>", "toggle line number" },
|
||||
["<leader>rn"] = { "<cmd> set rnu! <CR>", "toggle relative number" },
|
||||
|
||||
-- update nvchad
|
||||
["<leader>uu"] = { "<cmd> :NvChadUpdate <CR>", "update nvchad" },
|
||||
|
||||
["<leader>tt"] = {
|
||||
function()
|
||||
require("base46").toggle_theme()
|
||||
end,
|
||||
"toggle theme",
|
||||
},
|
||||
["<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>
|
||||
-- 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"', opts = { expr = true } },
|
||||
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
|
||||
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
|
||||
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', 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 } },
|
||||
|
||||
-- new buffer
|
||||
["<leader>b"] = { "<cmd> enew <CR>", "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 = { ["<C-x>"] = { termcodes "<C-\\><C-N>", "escape terminal mode" } },
|
||||
t = {
|
||||
["<C-x>"] = { vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), "Escape terminal mode" },
|
||||
},
|
||||
|
||||
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 } },
|
||||
["<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 } },
|
||||
},
|
||||
|
||||
x = {
|
||||
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "move left", opts = { expr = true } },
|
||||
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "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 } },
|
||||
-- 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
|
||||
["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', "dont copy replaced text", opts = { silent = true } },
|
||||
["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', "Dont copy replaced text", opts = { silent = true } },
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -82,29 +77,26 @@ M.tabufline = {
|
|||
|
||||
n = {
|
||||
-- cycle through buffers
|
||||
["<TAB>"] = {
|
||||
["<tab>"] = {
|
||||
function()
|
||||
require("nvchad_ui.tabufline").tabuflineNext()
|
||||
require("nvchad.tabufline").tabuflineNext()
|
||||
end,
|
||||
"goto next buffer",
|
||||
"Goto next buffer",
|
||||
},
|
||||
|
||||
["<S-Tab>"] = {
|
||||
["<S-tab>"] = {
|
||||
function()
|
||||
require("nvchad_ui.tabufline").tabuflinePrev()
|
||||
require("nvchad.tabufline").tabuflinePrev()
|
||||
end,
|
||||
"goto prev buffer",
|
||||
"Goto prev buffer",
|
||||
},
|
||||
|
||||
-- pick buffers via numbers
|
||||
["<Bslash>"] = { "<cmd> TbufPick <CR>", "Pick buffer" },
|
||||
|
||||
-- close buffer + hide terminal buffer
|
||||
["<leader>x"] = {
|
||||
function()
|
||||
require("nvchad_ui.tabufline").close_buffer()
|
||||
require("nvchad.tabufline").close_buffer()
|
||||
end,
|
||||
"close buffer",
|
||||
"Close buffer",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -118,14 +110,14 @@ M.comment = {
|
|||
function()
|
||||
require("Comment.api").toggle.linewise.current()
|
||||
end,
|
||||
"toggle comment",
|
||||
"Toggle comment",
|
||||
},
|
||||
},
|
||||
|
||||
v = {
|
||||
["<leader>/"] = {
|
||||
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
|
||||
"toggle comment",
|
||||
"Toggle comment",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -140,119 +132,121 @@ M.lspconfig = {
|
|||
function()
|
||||
vim.lsp.buf.declaration()
|
||||
end,
|
||||
"lsp declaration",
|
||||
"LSP declaration",
|
||||
},
|
||||
|
||||
["gd"] = {
|
||||
function()
|
||||
vim.lsp.buf.definition()
|
||||
end,
|
||||
"lsp definition",
|
||||
"LSP definition",
|
||||
},
|
||||
|
||||
["K"] = {
|
||||
function()
|
||||
vim.lsp.buf.hover()
|
||||
end,
|
||||
"lsp hover",
|
||||
"LSP hover",
|
||||
},
|
||||
|
||||
["gi"] = {
|
||||
function()
|
||||
vim.lsp.buf.implementation()
|
||||
end,
|
||||
"lsp implementation",
|
||||
"LSP implementation",
|
||||
},
|
||||
|
||||
["<leader>ls"] = {
|
||||
function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end,
|
||||
"lsp signature_help",
|
||||
"LSP signature help",
|
||||
},
|
||||
|
||||
["<leader>D"] = {
|
||||
function()
|
||||
vim.lsp.buf.type_definition()
|
||||
end,
|
||||
"lsp definition type",
|
||||
"LSP definition type",
|
||||
},
|
||||
|
||||
["<leader>ra"] = {
|
||||
function()
|
||||
require("nvchad_ui.renamer").open()
|
||||
require("nvchad.renamer").open()
|
||||
end,
|
||||
"lsp rename",
|
||||
"LSP rename",
|
||||
},
|
||||
|
||||
["<leader>ca"] = {
|
||||
function()
|
||||
vim.lsp.buf.code_action()
|
||||
end,
|
||||
"lsp code_action",
|
||||
"LSP code action",
|
||||
},
|
||||
|
||||
["gr"] = {
|
||||
function()
|
||||
vim.lsp.buf.references()
|
||||
end,
|
||||
"lsp references",
|
||||
"LSP references",
|
||||
},
|
||||
|
||||
["<leader>f"] = {
|
||||
function()
|
||||
vim.diagnostic.open_float()
|
||||
vim.diagnostic.open_float { border = "rounded" }
|
||||
end,
|
||||
"floating diagnostic",
|
||||
"Floating diagnostic",
|
||||
},
|
||||
|
||||
["[d"] = {
|
||||
function()
|
||||
vim.diagnostic.goto_prev()
|
||||
vim.diagnostic.goto_prev { float = { border = "rounded" } }
|
||||
end,
|
||||
"goto prev",
|
||||
"Goto prev",
|
||||
},
|
||||
|
||||
["]d"] = {
|
||||
function()
|
||||
vim.diagnostic.goto_next()
|
||||
vim.diagnostic.goto_next { float = { border = "rounded" } }
|
||||
end,
|
||||
"goto_next",
|
||||
"Goto next",
|
||||
},
|
||||
|
||||
["<leader>q"] = {
|
||||
function()
|
||||
vim.diagnostic.setloclist()
|
||||
end,
|
||||
"diagnostic setloclist",
|
||||
},
|
||||
|
||||
["<leader>fm"] = {
|
||||
function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end,
|
||||
"lsp formatting",
|
||||
"Diagnostic setloclist",
|
||||
},
|
||||
|
||||
["<leader>wa"] = {
|
||||
function()
|
||||
vim.lsp.buf.add_workspace_folder()
|
||||
end,
|
||||
"add workspace folder",
|
||||
"Add workspace folder",
|
||||
},
|
||||
|
||||
["<leader>wr"] = {
|
||||
function()
|
||||
vim.lsp.buf.remove_workspace_folder()
|
||||
end,
|
||||
"remove workspace folder",
|
||||
"Remove workspace folder",
|
||||
},
|
||||
|
||||
["<leader>wl"] = {
|
||||
function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end,
|
||||
"list workspace folders",
|
||||
"List workspace folders",
|
||||
},
|
||||
},
|
||||
|
||||
v = {
|
||||
["<leader>ca"] = {
|
||||
function()
|
||||
vim.lsp.buf.code_action()
|
||||
end,
|
||||
"LSP code action",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -262,10 +256,10 @@ M.nvimtree = {
|
|||
|
||||
n = {
|
||||
-- toggle
|
||||
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "toggle nvimtree" },
|
||||
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
|
||||
|
||||
-- focus
|
||||
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "focus nvimtree" },
|
||||
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "Focus nvimtree" },
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -274,23 +268,25 @@ M.telescope = {
|
|||
|
||||
n = {
|
||||
-- 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" },
|
||||
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "help page" },
|
||||
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "find oldfiles" },
|
||||
["<leader>tk"] = { "<cmd> Telescope keymaps <CR>", "show keys" },
|
||||
["<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" },
|
||||
["<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" },
|
||||
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "Git commits" },
|
||||
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", "Git status" },
|
||||
|
||||
-- pick a hidden term
|
||||
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "pick hidden term" },
|
||||
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
|
||||
|
||||
-- theme switcher
|
||||
["<leader>th"] = { "<cmd> Telescope themes <CR>", "nvchad themes" },
|
||||
["<leader>th"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
|
||||
|
||||
["<leader>ma"] = { "<cmd> Telescope marks <CR>", "telescope bookmarks" },
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -303,21 +299,21 @@ M.nvterm = {
|
|||
function()
|
||||
require("nvterm.terminal").toggle "float"
|
||||
end,
|
||||
"toggle floating term",
|
||||
"Toggle floating term",
|
||||
},
|
||||
|
||||
["<A-h>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "horizontal"
|
||||
end,
|
||||
"toggle horizontal term",
|
||||
"Toggle horizontal term",
|
||||
},
|
||||
|
||||
["<A-v>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "vertical"
|
||||
end,
|
||||
"toggle vertical term",
|
||||
"Toggle vertical term",
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -327,37 +323,36 @@ M.nvterm = {
|
|||
function()
|
||||
require("nvterm.terminal").toggle "float"
|
||||
end,
|
||||
"toggle floating term",
|
||||
"Toggle floating term",
|
||||
},
|
||||
|
||||
["<A-h>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "horizontal"
|
||||
end,
|
||||
"toggle horizontal term",
|
||||
"Toggle horizontal term",
|
||||
},
|
||||
|
||||
["<A-v>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "vertical"
|
||||
end,
|
||||
"toggle vertical term",
|
||||
"Toggle vertical term",
|
||||
},
|
||||
|
||||
-- new
|
||||
|
||||
["<leader>h"] = {
|
||||
function()
|
||||
require("nvterm.terminal").new "horizontal"
|
||||
end,
|
||||
"new horizontal term",
|
||||
"New horizontal term",
|
||||
},
|
||||
|
||||
["<leader>v"] = {
|
||||
function()
|
||||
require("nvterm.terminal").new "vertical"
|
||||
end,
|
||||
"new vertical term",
|
||||
"New vertical term",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -370,14 +365,14 @@ M.whichkey = {
|
|||
function()
|
||||
vim.cmd "WhichKey"
|
||||
end,
|
||||
"which-key all keymaps",
|
||||
"Which-key all keymaps",
|
||||
},
|
||||
["<leader>wk"] = {
|
||||
function()
|
||||
local input = vim.fn.input "WhichKey: "
|
||||
vim.cmd("WhichKey " .. input)
|
||||
end,
|
||||
"which-key query lookup",
|
||||
"Which-key query lookup",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -399,7 +394,7 @@ M.blankline = {
|
|||
end
|
||||
end,
|
||||
|
||||
"Jump to current_context",
|
||||
"Jump to current context",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
g.nvchad_theme = config.ui.theme
|
||||
g.base46_cache = vim.fn.stdpath "cache" .. "/nvchad/base46/"
|
||||
g.toggle_theme_icon = " "
|
||||
g.transparency = config.ui.transparency
|
||||
|
||||
opt.laststatus = 3 -- global statusline
|
||||
opt.showmode = false
|
||||
|
||||
opt.clipboard = "unnamedplus"
|
||||
opt.cursorline = true
|
||||
|
||||
-- Indenting
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 2
|
||||
opt.smartindent = true
|
||||
opt.tabstop = 2
|
||||
opt.softtabstop = 2
|
||||
|
||||
opt.fillchars = { eob = " " }
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.mouse = "a"
|
||||
|
||||
-- Numbers
|
||||
opt.number = true
|
||||
opt.numberwidth = 2
|
||||
opt.ruler = false
|
||||
|
||||
-- disable nvim intro
|
||||
opt.shortmess:append "sI"
|
||||
|
||||
opt.signcolumn = "yes"
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.termguicolors = true
|
||||
opt.timeoutlen = 400
|
||||
opt.undofile = true
|
||||
|
||||
-- interval for writing swap file to disk, also used by gitsigns
|
||||
opt.updatetime = 250
|
||||
|
||||
-- go to previous/next line with h,l,left arrow and right arrow
|
||||
-- when cursor reaches end/beginning of line
|
||||
opt.whichwrap:append "<>[]hl"
|
||||
|
||||
g.mapleader = " "
|
||||
|
||||
-- disable some default providers
|
||||
for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
|
||||
vim.g["loaded_" .. provider .. "_provider"] = 0
|
||||
end
|
|
@ -10,9 +10,9 @@ M.load_config = function()
|
|||
|
||||
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
|
||||
config = merge_tb("force", config, chadrc)
|
||||
config.mappings.disabled = nil
|
||||
end
|
||||
|
||||
config.mappings.disabled = nil
|
||||
return config
|
||||
end
|
||||
|
||||
|
@ -52,6 +52,7 @@ M.remove_disabled_keys = function(chadrc_mappings, default_mappings)
|
|||
end
|
||||
|
||||
M.load_mappings = function(section, mapping_opt)
|
||||
vim.schedule(function()
|
||||
local function set_section_map(section_values)
|
||||
if section_values.plugin then
|
||||
return
|
||||
|
@ -83,6 +84,7 @@ M.load_mappings = function(section, mapping_opt)
|
|||
for _, sect in pairs(mappings) do
|
||||
set_section_map(sect)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
M.lazy_load = function(plugin)
|
||||
|
|
|
@ -15,7 +15,7 @@ local formatting_style = {
|
|||
fields = field_arrangement[cmp_style] or { "abbr", "kind", "menu" },
|
||||
|
||||
format = function(_, item)
|
||||
local icons = require("nvchad_ui.icons").lspkind
|
||||
local icons = require "nvchad.icons.lspkind"
|
||||
local icon = (cmp_ui.icons and icons[item.kind]) or ""
|
||||
|
||||
if cmp_style == "atom" or cmp_style == "atom_colored" then
|
||||
|
@ -76,8 +76,8 @@ local options = {
|
|||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
},
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
|
@ -105,8 +105,8 @@ local options = {
|
|||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
|
|
|
@ -5,7 +5,7 @@ return {
|
|||
ui = {
|
||||
icons = {
|
||||
ft = "",
|
||||
lazy = "鈴 ",
|
||||
lazy = " ",
|
||||
loaded = "",
|
||||
not_loaded = "",
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
dofile(vim.g.base46_cache .. "lsp")
|
||||
require "nvchad_ui.lsp"
|
||||
require "nvchad.lsp"
|
||||
|
||||
local M = {}
|
||||
local utils = require "core.utils"
|
||||
|
@ -13,7 +13,11 @@ M.on_attach = function(client, bufnr)
|
|||
utils.load_mappings("lspconfig", { buffer = bufnr })
|
||||
|
||||
if client.server_capabilities.signatureHelpProvider then
|
||||
require("nvchad_ui.signature").setup(client)
|
||||
require("nvchad.signature").setup(client)
|
||||
end
|
||||
|
||||
if not utils.load_config().ui.lsp_semantic_tokens and client.supports_method "textDocument/semanticTokens" then
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -50,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/extensions/nvchad_types"] = true,
|
||||
[vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types"] = true,
|
||||
[vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
|
||||
},
|
||||
maxPreload = 100000,
|
||||
|
|
|
@ -6,8 +6,8 @@ local options = {
|
|||
ui = {
|
||||
icons = {
|
||||
package_pending = " ",
|
||||
package_installed = " ",
|
||||
package_uninstalled = " ﮊ",
|
||||
package_installed = " ",
|
||||
package_uninstalled = " ",
|
||||
},
|
||||
|
||||
keymaps = {
|
||||
|
|
|
@ -16,7 +16,7 @@ local options = {
|
|||
adaptive_size = false,
|
||||
side = "left",
|
||||
width = 30,
|
||||
hide_root_folder = true,
|
||||
preserve_window_proportions = true,
|
||||
},
|
||||
git = {
|
||||
enable = false,
|
||||
|
@ -31,6 +31,7 @@ local options = {
|
|||
},
|
||||
},
|
||||
renderer = {
|
||||
root_folder_label = false,
|
||||
highlight_git = false,
|
||||
highlight_opened_files = "none",
|
||||
|
||||
|
@ -47,15 +48,15 @@ local options = {
|
|||
},
|
||||
|
||||
glyphs = {
|
||||
default = "",
|
||||
default = "",
|
||||
symlink = "",
|
||||
folder = {
|
||||
default = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
default = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
arrow_open = "",
|
||||
arrow_closed = "",
|
||||
},
|
||||
|
@ -73,6 +74,4 @@ local options = {
|
|||
},
|
||||
}
|
||||
|
||||
vim.g.nvimtree_side = options.view.side
|
||||
|
||||
return options
|
||||
|
|
|
@ -11,6 +11,8 @@ M.blankline = {
|
|||
"TelescopePrompt",
|
||||
"TelescopeResults",
|
||||
"mason",
|
||||
"nvdash",
|
||||
"nvcheatsheet",
|
||||
"",
|
||||
},
|
||||
buftype_exclude = { "terminal" },
|
||||
|
@ -20,16 +22,20 @@ M.blankline = {
|
|||
show_current_context_start = true,
|
||||
}
|
||||
|
||||
M.luasnip = function()
|
||||
local options = {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
}
|
||||
M.luasnip = function(opts)
|
||||
require("luasnip").config.set_config(opts)
|
||||
|
||||
require("luasnip").config.set_config(options)
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
|
||||
-- vscode format
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
|
||||
|
||||
-- snipmate format
|
||||
require("luasnip.loaders.from_snipmate").load()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
|
||||
|
||||
-- lua format
|
||||
require("luasnip.loaders.from_lua").load()
|
||||
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
callback = function()
|
||||
|
@ -45,12 +51,12 @@ end
|
|||
|
||||
M.gitsigns = {
|
||||
signs = {
|
||||
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" },
|
||||
add = { text = "│" },
|
||||
change = { text = "│" },
|
||||
delete = { text = "" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
untracked = { text = "│" },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
utils.load_mappings("gitsigns", { buffer = bufnr })
|
||||
|
|
|
@ -49,7 +49,15 @@ local options = {
|
|||
},
|
||||
},
|
||||
|
||||
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,31 +0,0 @@
|
|||
local options = {
|
||||
|
||||
icons = {
|
||||
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||
separator = " ", -- symbol used between a key and it's label
|
||||
group = "+", -- symbol prepended to a group
|
||||
},
|
||||
|
||||
popup_mappings = {
|
||||
scroll_down = "<c-d>", -- binding to scroll down inside the popup
|
||||
scroll_up = "<c-u>", -- binding to scroll up inside the popup
|
||||
},
|
||||
|
||||
window = {
|
||||
border = "none", -- none/single/double/shadow
|
||||
},
|
||||
|
||||
layout = {
|
||||
spacing = 6, -- spacing between columns
|
||||
},
|
||||
|
||||
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " },
|
||||
|
||||
triggers_blacklist = {
|
||||
-- list of mode / prefixes that should never be hooked by WhichKey
|
||||
i = { "j", "k" },
|
||||
v = { "j", "k" },
|
||||
},
|
||||
}
|
||||
|
||||
return options
|
|
@ -4,9 +4,6 @@ local default_plugins = {
|
|||
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
-- nvchad plugins
|
||||
{ "NvChad/extensions", branch = "v2.0" },
|
||||
|
||||
{
|
||||
"NvChad/base46",
|
||||
branch = "v2.0",
|
||||
|
@ -19,14 +16,13 @@ local default_plugins = {
|
|||
"NvChad/ui",
|
||||
branch = "v2.0",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require "nvchad_ui"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/nvterm",
|
||||
init = require("core.utils").load_mappings "nvterm",
|
||||
init = function()
|
||||
require("core.utils").load_mappings "nvterm"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require "base46.term"
|
||||
require("nvterm").setup(opts)
|
||||
|
@ -35,7 +31,9 @@ local default_plugins = {
|
|||
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
init = require("core.utils").lazy_load "nvim-colorizer.lua",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-colorizer.lua"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("colorizer").setup(opts)
|
||||
|
||||
|
@ -49,7 +47,7 @@ local default_plugins = {
|
|||
{
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
opts = function()
|
||||
return { override = require("nvchad_ui.icons").devicons }
|
||||
return { override = require "nvchad.icons.devicons" }
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "devicons")
|
||||
|
@ -59,6 +57,7 @@ local default_plugins = {
|
|||
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
version = "2.20.7",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "indent-blankline.nvim"
|
||||
end,
|
||||
|
@ -74,7 +73,9 @@ local default_plugins = {
|
|||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
init = require("core.utils").lazy_load "nvim-treesitter",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-treesitter"
|
||||
end,
|
||||
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
|
||||
build = ":TSUpdate",
|
||||
opts = function()
|
||||
|
@ -89,17 +90,17 @@ local default_plugins = {
|
|||
-- git stuff
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
ft = "gitcommit",
|
||||
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")
|
||||
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" }
|
||||
require("lazy").load { plugins = { "gitsigns.nvim" } }
|
||||
end)
|
||||
end
|
||||
end,
|
||||
|
@ -117,7 +118,7 @@ local default_plugins = {
|
|||
-- lsp stuff
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
|
||||
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" },
|
||||
opts = function()
|
||||
return require "plugins.configs.mason"
|
||||
end,
|
||||
|
@ -129,12 +130,16 @@ local default_plugins = {
|
|||
vim.api.nvim_create_user_command("MasonInstallAll", function()
|
||||
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
|
||||
end, {})
|
||||
|
||||
vim.g.mason_binaries_list = opts.ensure_installed
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
init = require("core.utils").lazy_load "nvim-lspconfig",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-lspconfig"
|
||||
end,
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
end,
|
||||
|
@ -149,8 +154,9 @@ local default_plugins = {
|
|||
-- snippet plugin
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("plugins.configs.others").luasnip()
|
||||
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
|
||||
config = function(_, opts)
|
||||
require("plugins.configs.others").luasnip(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
|
@ -179,7 +185,6 @@ local default_plugins = {
|
|||
"hrsh7th/cmp-path",
|
||||
},
|
||||
},
|
||||
|
||||
opts = function()
|
||||
return require "plugins.configs.cmp"
|
||||
end,
|
||||
|
@ -190,10 +195,19 @@ local default_plugins = {
|
|||
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
-- keys = { "gc", "gb" },
|
||||
init = require("core.utils").load_mappings "comment",
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
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)" },
|
||||
},
|
||||
init = function()
|
||||
require("core.utils").load_mappings "comment"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("Comment").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
|
@ -201,7 +215,9 @@ local default_plugins = {
|
|||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
|
||||
init = require("core.utils").load_mappings "nvimtree",
|
||||
init = function()
|
||||
require("core.utils").load_mappings "nvimtree"
|
||||
end,
|
||||
opts = function()
|
||||
return require "plugins.configs.nvimtree"
|
||||
end,
|
||||
|
@ -213,13 +229,14 @@ local default_plugins = {
|
|||
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" } },
|
||||
cmd = "Telescope",
|
||||
init = require("core.utils").load_mappings "telescope",
|
||||
|
||||
init = function()
|
||||
require("core.utils").load_mappings "telescope"
|
||||
end,
|
||||
opts = function()
|
||||
return require "plugins.configs.telescope"
|
||||
end,
|
||||
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "telescope")
|
||||
local telescope = require "telescope"
|
||||
|
@ -235,12 +252,11 @@ local default_plugins = {
|
|||
-- Only load whichkey after all the gui
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
enabled = false,
|
||||
keys = { "<leader>", '"', "'", "`" },
|
||||
init = require("core.utils").load_mappings "whichkey",
|
||||
opts = function()
|
||||
return require "plugins.configs.whichkey"
|
||||
keys = { "<leader>", "<c-r>", '"', "'", "`", "c", "v", "g" },
|
||||
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)
|
||||
|
@ -254,7 +270,4 @@ if #config.plugins > 0 then
|
|||
table.insert(default_plugins, { import = config.plugins })
|
||||
end
|
||||
|
||||
-- lazy_nvim startup opts
|
||||
local lazy_config = vim.tbl_deep_extend("force", require "plugins.configs.lazy_nvim", config.lazy_nvim)
|
||||
|
||||
require("lazy").setup(default_plugins, lazy_config)
|
||||
require("lazy").setup(default_plugins, config.lazy_nvim)
|
||||
|
|
Loading…
Reference in a new issue