Compare commits
18 Commits
Author | SHA1 | Date |
---|---|---|
Pieter Joost van de Sande | b913bdacfd | |
siduck | 3bacdf77b9 | |
Sidhanth Rathod | b2cc8884e1 | |
siduck | 8cf7ca4002 | |
kamack38 | 0371101121 | |
siduck | dc7d35d8a8 | |
Hossain Rizbi | 32b0a008a9 | |
Ryymm | eac36d40bb | |
siduck | d3ddae598f | |
Sidhanth Rathod | 6d66f1df11 | |
anosillus | b9ec202f79 | |
siduck | 178d62bce4 | |
Gazareth | 9680078c6a | |
Gazareth | f67c629249 | |
siduck | e6a230129a | |
Aaron | 5e9ddcc1b0 | |
siduck | 54b3649324 | |
siduck | 65eab4535c |
|
@ -0,0 +1,161 @@
|
|||
# [CONTRIBUTING](https://nvchad.github.io/contribute)
|
||||
|
||||
## NvChad install for contributors
|
||||
|
||||
If you wish to contribute to NvChad, you should:
|
||||
1. [create a fork on GitHub](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
|
||||
2. clone your fork to your machine
|
||||
- For ssh:
|
||||
```shell
|
||||
$ git clone git@github.com:<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
|
||||
```
|
||||
- For https:
|
||||
```shell
|
||||
$ git clone https://github.com/<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
|
||||
```
|
||||
3. [add a new remote repo to track](https://www.atlassian.com/git/tutorials/git-forks-and-upstreams)
|
||||
- this means you can push/pull as normal to your own repo, but also easily track & update from the NvChad repo
|
||||
- for ssh:
|
||||
```shell
|
||||
$ git remote add upstream git@github.com:NvChad/NvChad.git
|
||||
```
|
||||
- for https:
|
||||
```shell
|
||||
$ git remote add upstream https://github.com/NvChad/NvChad.git
|
||||
```
|
||||
4. any time you create a branch to do some work, use
|
||||
```shell
|
||||
$ git fetch upstream && git checkout -b dev-myFEAT upstream/main
|
||||
```
|
||||
5. only use the **--rebase** flag to update your dev branch
|
||||
- this means that there are no `Merge NvChad/main into devBranch` commits, which are to be avoided
|
||||
```shell
|
||||
$ git pull upstream --rebase
|
||||
```
|
||||
|
||||
## Things to know before contributing
|
||||
|
||||
- When making a PR (pull request), please be very descriptive about what you've done!
|
||||
|
||||
- PR titles should be formatted with 'fix', 'chore' or 'feat'. ex: `feat: add new plugin`
|
||||
|
||||
- PRs should follow the pull request formats where applicable
|
||||
|
||||
- We are open to all PRs, but may decline some for a myriad of reasons. Though don't be discouraged! We'll still be open to discussions.
|
||||
|
||||
- PR's are always welcomed however NvChad aims to be less bloated. So PR's regarding existing plugin's enhancement and creating new features with existing plugins itself ( without adding a new plugin), bug fixes and corrections are more encouraged.
|
||||
|
||||
- NvChad won't keep adding more and more features (like adding new plugins most likely) as requested if they feel unneeded and aren't usable by the majority!! If you think the plugin you want to be added is very useful and many NvChaders would find it useful, then such feature's PR is welcomed!
|
||||
|
||||
- But adding specific features like adding config for [wakatime](https://github.com/wakatime/vim-wakatime) etc will be added in this [chad user configs](https://github.com/NvChad/NvChad/wiki/Chad-user-configs). This lets the user select the things only they want ( adding configs from extra configs ).
|
||||
|
||||
## How to remove or edit commits from your PR
|
||||
> You may have been directed here to remove a commit such as a merge commit: `Merge NvChad/main into devBranch` from your PR
|
||||
|
||||
> As these commands edit your git history, you may need to **force push** with `git push origin --force`
|
||||
|
||||
1. Run the following:
|
||||
```
|
||||
$ git rebase -i HEAD~<NUMBER OF COMMITS TO GO BACK>
|
||||
```
|
||||
<details><summary>Example</summary>
|
||||
<p>
|
||||
|
||||
```shell
|
||||
$ git rebase -i HEAD~4
|
||||
```
|
||||
|
||||
```shell
|
||||
pick 28b2dcb statusline add lsp status
|
||||
pick dad9a39 feat: Added lsp radial progress
|
||||
pick 68f72f1 add clickable btn for exiting nvim
|
||||
pick b281b53 avoid using q! for quitting vim
|
||||
|
||||
# Rebase 52b655b..b281b53 onto 52b655b (4 commands)
|
||||
#
|
||||
# Commands:
|
||||
# p, pick <commit> = use commit
|
||||
# r, reword <commit> = use commit, but edit the commit message
|
||||
# e, edit <commit> = use commit, but stop for amending
|
||||
# s, squash <commit> = use commit, but meld into previous commit
|
||||
# f, fixup <commit> = like "squash", but discard this commit's log message
|
||||
# x, exec <command> = run command (the rest of the line) using shell
|
||||
# b, break = stop here (continue rebase later with 'git rebase --continue')
|
||||
# d, drop <commit> = remove commit
|
||||
# l, label <label> = label current HEAD with a name
|
||||
# t, reset <label> = reset HEAD to a label
|
||||
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
|
||||
# . create a merge commit using the original merge commit's
|
||||
# . message (or the oneline, if no original merge commit was
|
||||
# . specified). Use -c <commit> to reword the commit message.
|
||||
#
|
||||
# These lines can be re-ordered; they are executed from top to bottom.
|
||||
#
|
||||
# If you remove a line here THAT COMMIT WILL BE LOST.
|
||||
#
|
||||
# However, if you remove everything, the rebase will be aborted.
|
||||
#
|
||||
# Note that empty commits are commented out
|
||||
```
|
||||
|
||||
</p>
|
||||
</details>
|
||||
|
||||
2. Change the `pick` commands to whatever you wish, you may wish to `d` `drop` or `e` `edit` a commit. Then save & quit this git file to run it.
|
||||
|
||||
<details><summary>Example</summary>
|
||||
<p>
|
||||
|
||||
```shell {3,4}
|
||||
pick 28b2dcb statusline add lsp status
|
||||
pick dad9a39 feat: Added lsp radial progress
|
||||
edit 68f72f1 add clickable btn for exiting nvim
|
||||
d b281b53 avoid using q! for quitting vim
|
||||
|
||||
# Rebase 52b655b..b281b53 onto 52b655b (4 commands)
|
||||
#
|
||||
# Commands:
|
||||
# p, pick <commit> = use commit
|
||||
# r, reword <commit> = use commit, but edit the commit message
|
||||
# e, edit <commit> = use commit, but stop for amending
|
||||
# s, squash <commit> = use commit, but meld into previous commit
|
||||
# f, fixup <commit> = like "squash", but discard this commit's log message
|
||||
# x, exec <command> = run command (the rest of the line) using shell
|
||||
# b, break = stop here (continue rebase later with 'git rebase --continue')
|
||||
# d, drop <commit> = remove commit
|
||||
# l, label <label> = label current HEAD with a name
|
||||
# t, reset <label> = reset HEAD to a label
|
||||
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
|
||||
# . create a merge commit using the original merge commit's
|
||||
# . message (or the oneline, if no original merge commit was
|
||||
# . specified). Use -c <commit> to reword the commit message.
|
||||
#
|
||||
# These lines can be re-ordered; they are executed from top to bottom.
|
||||
#
|
||||
# If you remove a line here THAT COMMIT WILL BE LOST.
|
||||
#
|
||||
# However, if you remove everything, the rebase will be aborted.
|
||||
#
|
||||
# Note that empty commits are commented out
|
||||
```
|
||||
|
||||
</p>
|
||||
</details>
|
||||
|
||||
3. If you picked `drop` you are done, if you picked `edit` then edit your files, then run:
|
||||
```shell
|
||||
$ git add <files>
|
||||
```
|
||||
|
||||
4. Once you have edited & added your files, run:
|
||||
```shell
|
||||
$ git rebase --continue
|
||||
```
|
||||
|
||||
5. You will likely need to push using:
|
||||
```shell
|
||||
$ git push origin --force
|
||||
```
|
||||
|
||||
## Help
|
||||
For help with contributing and anything else nvChad related join the [discord](https://discord.gg/VyPxsGArXc)
|
|
@ -0,0 +1,3 @@
|
|||
patreon: siduck
|
||||
ko_fi: siduck
|
||||
custom: ["https://www.buymeacoffee.com/siduck", "https://www.paypal.com/paypalme/siduck76"]
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Before reporting: update nvchad to the latest version,read breaking changes page,search existing issues. -->
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- Operating System
|
||||
- Terminal
|
||||
- Version of Neovim
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
|
@ -0,0 +1,8 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Wiki
|
||||
url: https://github.com/siduck76/NvChad/wiki
|
||||
about: "Walks you through how to use and Configure NvChad."
|
||||
- name: Visit our gitter chat
|
||||
url: https://gitter.im/neovim-dotfiles/community
|
||||
about: "A place where we dicuss NvChad related stuff."
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem was.
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
**Screenshot**
|
||||
Maybe a screenshot of the feature
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
Fixes Issue # (If it doesn't fix an issue then delete this line)
|
||||
|
||||
Features Added:
|
||||
- Plugin Name (Add links if possible too)
|
||||
|
||||
Reasoning:
|
||||
List why the feature is needed
|
||||
|
||||
Speed (If applicable):
|
||||
Show the impact on the speed of nvChad
|
||||
|
||||
Other:
|
||||
Anything else relevant goes here
|
|
@ -0,0 +1,16 @@
|
|||
(Make sure your title is either: 'fix', 'chore', or 'feat' then your title. ex: `fix: add new plugin`)
|
||||
|
||||
Fixes Issue # (If it doesn't fix an issue then delete this line)
|
||||
|
||||
Plugins Added:
|
||||
- [Plugin Name](Plugin Link)
|
||||
- [Plugin Name](Plugin Link)
|
||||
|
||||
Reasoning:
|
||||
List why the plugin(s) should be added
|
||||
|
||||
Speed:
|
||||
Show the impact on the speed of nvChad
|
||||
|
||||
Other:
|
||||
Anything else relevant goes here
|
|
@ -0,0 +1,33 @@
|
|||
<h1 align="center">NvChad</h1>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://nvchad.github.io/">Home</a>
|
||||
<span> • </span>
|
||||
<a href="https://nvchad.github.io/quickstart/install">Install</a>
|
||||
<span> • </span>
|
||||
<a href="https://nvchad.github.io/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>
|
||||
<p></p>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
|
||||
<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)
|
||||
[![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)
|
||||
[![Telegram](https://img.shields.io/badge/Telegram-blue.svg?style=flat-square&logo=Telegram&logoColor=white)](https://t.me/nvchad_tg)
|
||||
|
||||
</div>
|
||||
|
||||
**NOTICE** : v2.0 is going to be released in this month. It uses lazy.nvim instead of packer and many new features have been added & performance improvements! working on the [docs](https://github.com/NvChad/nvchad.github.io/pull/118) currently and they will be more welcoming to newbies & would make you understand how nvchad works visually. To test v2.0 do a fresh clone of v2.0 branch ( do know that some of the lazy.nvim options are different from packer, [check](https://github.com/folke/lazy.nvim#packernvim) so you have to update the plugin options in your custom plugins table. )
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
||||
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
|
||||
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
|
||||
exempt-all-issue-assignees: true # doesn't close an issue if someone was assigned to it.
|
||||
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
|
||||
exempt-all-pr-assignees: true # doesn't close a pr if someone was assigned to it.
|
||||
days-before-issue-stale: 30
|
||||
days-before-pr-stale: 45
|
||||
days-before-issue-close: 5
|
||||
days-before-pr-close: 10
|
|
@ -1,9 +1,7 @@
|
|||
plugin
|
||||
custom
|
||||
spell
|
||||
ftplugin
|
||||
syntax
|
||||
coc-settings.json
|
||||
.luarc.json
|
||||
lazy-lock.json
|
||||
after
|
||||
.github
|
||||
cheatsheet.txt
|
||||
|
|
43
init.lua
43
init.lua
|
@ -1,21 +1,34 @@
|
|||
vim.defer_fn(function()
|
||||
pcall(require, "impatient")
|
||||
end, 0)
|
||||
|
||||
require "core"
|
||||
require "core.options"
|
||||
|
||||
local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1]
|
||||
-- setup packer + plugins
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
|
||||
|
||||
if custom_init_path then
|
||||
dofile(custom_init_path)
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" })
|
||||
print "Cloning packer .."
|
||||
fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }
|
||||
|
||||
-- install plugins + compile their configs
|
||||
vim.cmd "packadd packer.nvim"
|
||||
require "plugins"
|
||||
vim.cmd "PackerSync"
|
||||
|
||||
-- install binaries from mason.nvim & tsparsers
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "PackerComplete",
|
||||
callback = function()
|
||||
vim.cmd "bw | silent! MasonInstallAll" -- close packer window
|
||||
require("packer").loader "nvim-treesitter"
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
pcall(require, "custom")
|
||||
|
||||
require("core.utils").load_mappings()
|
||||
|
||||
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||
|
||||
-- bootstrap lazy.nvim!
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
require("core.bootstrap").gen_chadrc_template()
|
||||
require("core.bootstrap").lazy(lazypath)
|
||||
end
|
||||
|
||||
dofile(vim.g.base46_cache .. "defaults")
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
require "plugins"
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
M.echo = function(str)
|
||||
vim.cmd "redraw"
|
||||
vim.api.nvim_echo({ { str, "Bold" } }, true, {})
|
||||
end
|
||||
|
||||
local function shell_call(args)
|
||||
local output = vim.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 = 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.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
|
||||
require "plugins"
|
||||
|
||||
-- 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 path = vim.fn.stdpath "config" .. "/lua/custom/"
|
||||
local input = "N"
|
||||
|
||||
if next(vim.api.nvim_list_uis()) then
|
||||
input = vim.fn.input "Do you want to install example custom config? (y/N) : "
|
||||
end
|
||||
|
||||
-- clone example_config repo
|
||||
if input == "y" then
|
||||
M.echo "cloning example custom config repo ..."
|
||||
shell_call { "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")
|
||||
file:write "---@type ChadrcConfig \n local M = {}\n M.ui = {theme = 'onedark'}\n return M"
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,11 +1,15 @@
|
|||
-- Chadrc overrides this file
|
||||
|
||||
local M = {}
|
||||
|
||||
M.options = {
|
||||
nvchad_branch = "v2.0",
|
||||
nvChad = {
|
||||
update_url = "https://github.com/NvChad/NvChad",
|
||||
update_branch = "main",
|
||||
},
|
||||
}
|
||||
|
||||
M.ui = {
|
||||
------------------------------- base46 -------------------------------------
|
||||
-- hl = highlights
|
||||
hl_add = {},
|
||||
hl_override = {},
|
||||
|
@ -13,80 +17,11 @@ 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 = {
|
||||
icons = true,
|
||||
lspkind_text = true,
|
||||
style = "default", -- default/flat_light/flat_dark/atom/atom_colored
|
||||
border_color = "grey_fg", -- only applicable for "default" style, use color names from base30 variables
|
||||
selected_item_bg = "colored", -- colored / simple
|
||||
},
|
||||
|
||||
telescope = { style = "borderless" }, -- borderless / bordered
|
||||
|
||||
------------------------------- nvchad_ui modules -----------------------------
|
||||
statusline = {
|
||||
theme = "default", -- default/vscode/vscode_colored/minimal
|
||||
-- default/round/block/arrow separators work only for default statusline theme
|
||||
-- round and block will work for minimal theme only
|
||||
separator_style = "default",
|
||||
overriden_modules = nil,
|
||||
},
|
||||
|
||||
-- lazyload it when there are 1+ buffers
|
||||
tabufline = {
|
||||
show_numbers = false,
|
||||
enabled = true,
|
||||
lazyload = true,
|
||||
overriden_modules = nil,
|
||||
},
|
||||
|
||||
-- nvdash (dashboard)
|
||||
nvdash = {
|
||||
load_on_startup = false,
|
||||
|
||||
header = {
|
||||
" ▄ ▄ ",
|
||||
" ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ",
|
||||
" █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ",
|
||||
" ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ ",
|
||||
" ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ",
|
||||
" █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄",
|
||||
"▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █",
|
||||
"█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █",
|
||||
" █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ",
|
||||
},
|
||||
|
||||
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 m a", "Telescope marks" },
|
||||
{ " Themes", "Spc t h", "Telescope themes" },
|
||||
{ " Mappings", "Spc c h", "NvCheatsheet" },
|
||||
},
|
||||
},
|
||||
|
||||
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", so make custom/plugins.lua file
|
||||
|
||||
M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options
|
||||
M.plugins = {}
|
||||
|
||||
-- check core.mappings for table structure
|
||||
M.mappings = require "core.mappings"
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,66 +1,14 @@
|
|||
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.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
|
||||
vim.env.PATH = vim.env.PATH .. (is_windows and ";" or ":") .. vim.fn.stdpath "data" .. "/mason/bin"
|
||||
|
||||
-------------------------------------- autocmds ------------------------------------------
|
||||
-- commands
|
||||
vim.cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
|
||||
vim.cmd "silent! command! NvChadSnapshotCreate lua require('nvchad').snap_create()"
|
||||
vim.cmd "silent! command! NvChadSnapshotDelete lua require('nvchad').snap_delete()"
|
||||
vim.cmd "silent! command! NvChadSnapshotCheckout lua require('nvchad').snap_checkout()"
|
||||
|
||||
-- autocmds
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- dont list quickfix buffers
|
||||
|
@ -71,45 +19,9 @@ autocmd("FileType", {
|
|||
end,
|
||||
})
|
||||
|
||||
-- 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"
|
||||
require("plenary.reload").reload_module(module)
|
||||
require("plenary.reload").reload_module "custom.chadrc"
|
||||
|
||||
config = require("core.utils").load_config()
|
||||
|
||||
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!")
|
||||
-- wrap the PackerSync command to warn people before using it in NvChadSnapshots
|
||||
autocmd("VimEnter", {
|
||||
callback = function()
|
||||
vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('plugins') require('core.utils').packer_sync(<f-args>)"
|
||||
end,
|
||||
})
|
||||
|
||||
-------------------------------------- commands ------------------------------------------
|
||||
local new_cmd = vim.api.nvim_create_user_command
|
||||
|
||||
new_cmd("NvChadUpdate", function()
|
||||
require "nvchad.updater"()
|
||||
end, {})
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
local M = {}
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- require("packer").loader(tb.plugins)
|
||||
-- This must be used for plugins that need to be loaded just after a file
|
||||
-- ex : treesitter, lspconfig etc
|
||||
M.lazy_load = function(tb)
|
||||
autocmd(tb.events, {
|
||||
group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
|
||||
callback = function()
|
||||
if tb.condition() then
|
||||
vim.api.nvim_del_augroup_by_name(tb.augroup_name)
|
||||
|
||||
-- dont defer for treesitter as it will show slow highlighting
|
||||
-- This deferring only happens only when we do "nvim filename"
|
||||
if tb.plugin ~= "nvim-treesitter" then
|
||||
vim.defer_fn(function()
|
||||
require("packer").loader(tb.plugin)
|
||||
if tb.plugin == "nvim-lspconfig" then
|
||||
vim.cmd "silent! do FileType"
|
||||
end
|
||||
end, 0)
|
||||
else
|
||||
require("packer").loader(tb.plugin)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- load certain plugins only when there's a file opened in the buffer
|
||||
-- if "nvim filename" is executed -> load the plugin after nvim gui loads
|
||||
-- This gives an instant preview of nvim with the file opened
|
||||
|
||||
M.on_file_open = function(plugin_name)
|
||||
M.lazy_load {
|
||||
events = { "BufRead", "BufWinEnter", "BufNewFile" },
|
||||
augroup_name = "BeLazyOnFileOpen" .. plugin_name,
|
||||
plugin = plugin_name,
|
||||
condition = function()
|
||||
local file = vim.fn.expand "%"
|
||||
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
M.packer_cmds = {
|
||||
"PackerSnapshot",
|
||||
"PackerSnapshotRollback",
|
||||
"PackerSnapshotDelete",
|
||||
"PackerInstall",
|
||||
"PackerUpdate",
|
||||
"PackerSync",
|
||||
"PackerClean",
|
||||
"PackerCompile",
|
||||
"PackerStatus",
|
||||
"PackerProfile",
|
||||
"PackerLoad",
|
||||
}
|
||||
|
||||
M.treesitter_cmds = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSEnable", "TSDisable", "TSModuleInfo" }
|
||||
M.mason_cmds = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" }
|
||||
|
||||
M.gitsigns = function()
|
||||
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("packer").loader "gitsigns.nvim"
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,74 +1,79 @@
|
|||
-- 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>"] = { ":noh <CR>", "Clear highlights" },
|
||||
["<ESC>"] = { "<cmd> noh <CR>", "no highlight" },
|
||||
|
||||
-- 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" },
|
||||
["<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",
|
||||
},
|
||||
|
||||
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
||||
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||
-- empty mode is same as using <cmd> :map
|
||||
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
|
||||
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', 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 } },
|
||||
|
||||
-- new buffer
|
||||
["<leader>b"] = { "<cmd> enew <CR>", "New buffer" },
|
||||
["<leader>ch"] = { "<cmd> NvCheatsheet <CR>", "Mapping cheatsheet" },
|
||||
|
||||
["<leader>fm"] = {
|
||||
function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end,
|
||||
"LSP formatting",
|
||||
},
|
||||
["<leader>b"] = { "<cmd> enew <CR>", "new buffer" },
|
||||
},
|
||||
|
||||
t = {
|
||||
["<C-x>"] = { vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), "Escape terminal mode" },
|
||||
},
|
||||
t = { ["<C-x>"] = { termcodes "<C-\\><C-N>", "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"', opts = { expr = true } },
|
||||
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
|
||||
},
|
||||
|
||||
x = {
|
||||
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
|
||||
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', 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>', opts = { silent = true } },
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -77,26 +82,29 @@ M.tabufline = {
|
|||
|
||||
n = {
|
||||
-- cycle through buffers
|
||||
["<tab>"] = {
|
||||
["<TAB>"] = {
|
||||
function()
|
||||
require("nvchad.tabufline").tabuflineNext()
|
||||
require("nvchad_ui.tabufline").tabuflineNext()
|
||||
end,
|
||||
"Goto next buffer",
|
||||
"goto next buffer",
|
||||
},
|
||||
|
||||
["<S-tab>"] = {
|
||||
["<S-Tab>"] = {
|
||||
function()
|
||||
require("nvchad.tabufline").tabuflinePrev()
|
||||
require("nvchad_ui.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.tabufline").close_buffer()
|
||||
require("nvchad_ui.tabufline").close_buffer()
|
||||
end,
|
||||
"Close buffer",
|
||||
"close buffer",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -110,14 +118,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",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -132,112 +140,119 @@ 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.renamer").open()
|
||||
require("nvchad_ui.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 { border = "rounded" }
|
||||
vim.diagnostic.open_float()
|
||||
end,
|
||||
"Floating diagnostic",
|
||||
"floating diagnostic",
|
||||
},
|
||||
|
||||
["[d"] = {
|
||||
function()
|
||||
vim.diagnostic.goto_prev { float = { border = "rounded" } }
|
||||
vim.diagnostic.goto_prev()
|
||||
end,
|
||||
"Goto prev",
|
||||
"goto prev",
|
||||
},
|
||||
|
||||
["]d"] = {
|
||||
["d]"] = {
|
||||
function()
|
||||
vim.diagnostic.goto_next { float = { border = "rounded" } }
|
||||
vim.diagnostic.goto_next()
|
||||
end,
|
||||
"Goto next",
|
||||
"goto_next",
|
||||
},
|
||||
|
||||
["<leader>q"] = {
|
||||
function()
|
||||
vim.diagnostic.setloclist()
|
||||
end,
|
||||
"Diagnostic setloclist",
|
||||
"diagnostic setloclist",
|
||||
},
|
||||
|
||||
["<leader>fm"] = {
|
||||
function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end,
|
||||
"lsp formatting",
|
||||
},
|
||||
|
||||
["<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",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -247,10 +262,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" },
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -259,25 +274,23 @@ 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>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
|
||||
["<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" },
|
||||
|
||||
-- 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>ma"] = { "<cmd> Telescope marks <CR>", "telescope bookmarks" },
|
||||
["<leader>th"] = { "<cmd> Telescope themes <CR>", "nvchad themes" },
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -290,21 +303,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",
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -314,36 +327,37 @@ 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",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -356,14 +370,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",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -385,7 +399,7 @@ M.blankline = {
|
|||
end
|
||||
end,
|
||||
|
||||
"Jump to current context",
|
||||
"Jump to current_context",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
g.nvchad_theme = config.ui.theme
|
||||
g.toggle_theme_icon = " "
|
||||
g.transparency = config.ui.transparency
|
||||
g.theme_switcher_loaded = false
|
||||
|
||||
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 builtin vim plugins
|
||||
local default_plugins = {
|
||||
"2html_plugin",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"gzip",
|
||||
"logipat",
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"matchit",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"tutor",
|
||||
"rplugin",
|
||||
"syntax",
|
||||
"synmenu",
|
||||
"optwin",
|
||||
"compiler",
|
||||
"bugreport",
|
||||
"ftplugin",
|
||||
}
|
||||
|
||||
for _, plugin in pairs(default_plugins) do
|
||||
g["loaded_" .. plugin] = 1
|
||||
end
|
||||
|
||||
local default_providers = {
|
||||
"node",
|
||||
"perl",
|
||||
"python3",
|
||||
"ruby",
|
||||
}
|
||||
|
||||
for _, provider in ipairs(default_providers) do
|
||||
vim.g["loaded_" .. provider .. "_provider"] = 0
|
||||
end
|
|
@ -3,16 +3,19 @@ local merge_tb = vim.tbl_deep_extend
|
|||
|
||||
M.load_config = function()
|
||||
local config = require "core.default_config"
|
||||
local chadrc_path = vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1]
|
||||
local chadrc_exists, chadrc = pcall(require, "custom.chadrc")
|
||||
|
||||
if chadrc_path then
|
||||
local chadrc = dofile(chadrc_path)
|
||||
|
||||
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
|
||||
config = merge_tb("force", config, chadrc)
|
||||
config.mappings.disabled = nil
|
||||
if chadrc_exists then
|
||||
-- merge user config if it exists and is a table; otherwise display an error
|
||||
if type(chadrc) == "table" then
|
||||
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
|
||||
config = merge_tb("force", config, chadrc) or {}
|
||||
else
|
||||
error "chadrc must return a table!"
|
||||
end
|
||||
end
|
||||
|
||||
config.mappings.disabled = nil
|
||||
return config
|
||||
end
|
||||
|
||||
|
@ -52,67 +55,138 @@ 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
|
||||
end
|
||||
local function set_section_map(section_values)
|
||||
if section_values.plugin then
|
||||
return
|
||||
end
|
||||
section_values.plugin = nil
|
||||
|
||||
section_values.plugin = nil
|
||||
for mode, mode_values in pairs(section_values) do
|
||||
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
|
||||
for keybind, mapping_info in pairs(mode_values) do
|
||||
-- merge default + user opts
|
||||
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
|
||||
|
||||
for mode, mode_values in pairs(section_values) do
|
||||
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
|
||||
for keybind, mapping_info in pairs(mode_values) do
|
||||
-- merge default + user opts
|
||||
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
|
||||
mapping_info.opts, opts.mode = nil, nil
|
||||
opts.desc = mapping_info[2]
|
||||
|
||||
mapping_info.opts, opts.mode = nil, nil
|
||||
opts.desc = mapping_info[2]
|
||||
|
||||
vim.keymap.set(mode, keybind, mapping_info[1], opts)
|
||||
end
|
||||
vim.keymap.set(mode, keybind, mapping_info[1], opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local mappings = require("core.utils").load_config().mappings
|
||||
local mappings = require("core.utils").load_config().mappings
|
||||
|
||||
if type(section) == "string" then
|
||||
mappings[section]["plugin"] = nil
|
||||
mappings = { mappings[section] }
|
||||
end
|
||||
if type(section) == "string" then
|
||||
mappings[section]["plugin"] = nil
|
||||
mappings = { mappings[section] }
|
||||
end
|
||||
|
||||
for _, sect in pairs(mappings) do
|
||||
set_section_map(sect)
|
||||
end
|
||||
end)
|
||||
for _, sect in pairs(mappings) do
|
||||
set_section_map(sect)
|
||||
end
|
||||
end
|
||||
|
||||
M.lazy_load = function(plugin)
|
||||
vim.api.nvim_create_autocmd({ "BufRead", "BufWinEnter", "BufNewFile" }, {
|
||||
group = vim.api.nvim_create_augroup("BeLazyOnFileOpen" .. plugin, {}),
|
||||
callback = function()
|
||||
local file = vim.fn.expand "%"
|
||||
local condition = file ~= "NvimTree_1" and file ~= "[lazy]" and file ~= ""
|
||||
-- merge default/user plugin tables
|
||||
M.merge_plugins = function(plugins)
|
||||
local plugin_configs = M.load_config().plugins
|
||||
local user_plugins = plugin_configs
|
||||
|
||||
if condition then
|
||||
vim.api.nvim_del_augroup_by_name("BeLazyOnFileOpen" .. plugin)
|
||||
-- old plugin syntax for adding plugins
|
||||
if plugin_configs.user and type(plugin_configs.user) == "table" then
|
||||
user_plugins = plugin_configs.user
|
||||
end
|
||||
|
||||
-- dont defer for treesitter as it will show slow highlighting
|
||||
-- This deferring only happens only when we do "nvim filename"
|
||||
if plugin ~= "nvim-treesitter" then
|
||||
vim.schedule(function()
|
||||
require("lazy").load { plugins = plugin }
|
||||
-- support old plugin removal syntax
|
||||
local remove_plugins = plugin_configs.remove
|
||||
if type(remove_plugins) == "table" then
|
||||
for _, v in ipairs(remove_plugins) do
|
||||
plugins[v] = nil
|
||||
end
|
||||
end
|
||||
|
||||
if plugin == "nvim-lspconfig" then
|
||||
vim.cmd "silent! do FileType"
|
||||
end
|
||||
end, 0)
|
||||
else
|
||||
require("lazy").load { plugins = plugin }
|
||||
end
|
||||
plugins = merge_tb("force", plugins, user_plugins)
|
||||
|
||||
local final_table = {}
|
||||
|
||||
for key, val in pairs(plugins) do
|
||||
if val and type(val) == "table" then
|
||||
plugins[key] = val.rm_default_opts and user_plugins[key] or plugins[key]
|
||||
plugins[key][1] = key
|
||||
final_table[#final_table + 1] = plugins[key]
|
||||
end
|
||||
end
|
||||
|
||||
return final_table
|
||||
end
|
||||
|
||||
-- override plugin options table with custom ones
|
||||
M.load_override = function(options_table, name)
|
||||
local plugin_configs, plugin_options = M.load_config().plugins, nil
|
||||
|
||||
-- support old plugin syntax for override
|
||||
local user_override = plugin_configs.override and plugin_configs.override[name]
|
||||
if user_override and type(user_override) == "table" then
|
||||
plugin_options = user_override
|
||||
end
|
||||
|
||||
-- if no old style plugin override is found, then use the new syntax
|
||||
if not plugin_options and plugin_configs[name] then
|
||||
local override_options = plugin_configs[name].override_options or {}
|
||||
if type(override_options) == "table" then
|
||||
plugin_options = override_options
|
||||
elseif type(override_options) == "function" then
|
||||
plugin_options = override_options()
|
||||
end
|
||||
end
|
||||
|
||||
-- make sure the plugin options are a table
|
||||
plugin_options = type(plugin_options) == "table" and plugin_options or {}
|
||||
|
||||
return merge_tb("force", options_table, plugin_options)
|
||||
end
|
||||
|
||||
M.packer_sync = function(...)
|
||||
local git_exists, git = pcall(require, "nvchad.utils.git")
|
||||
local defaults_exists, defaults = pcall(require, "nvchad.utils.config")
|
||||
local packer_exists, packer = pcall(require, "packer")
|
||||
|
||||
if git_exists and defaults_exists then
|
||||
local current_branch_name = git.get_current_branch_name()
|
||||
|
||||
-- warn the user if we are on a snapshot branch
|
||||
if current_branch_name:match(defaults.snaps.base_snap_branch_name .. "(.+)" .. "$") then
|
||||
vim.api.nvim_echo({
|
||||
{ "WARNING: You are trying to use ", "WarningMsg" },
|
||||
{ "PackerSync" },
|
||||
{
|
||||
" on a NvChadSnapshot. This will cause issues if NvChad dependencies contain "
|
||||
.. "any breaking changes! Plugin updates will not be included in this "
|
||||
.. "snapshot, so they will be lost after switching between snapshots! Would "
|
||||
.. "you still like to continue? [y/N]\n",
|
||||
"WarningMsg",
|
||||
},
|
||||
}, false, {})
|
||||
|
||||
local ans = vim.trim(string.lower(vim.fn.input "-> "))
|
||||
|
||||
if ans ~= "y" then
|
||||
return
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
if packer_exists then
|
||||
packer.sync(...)
|
||||
|
||||
local plugins = M.load_config().plugins
|
||||
local old_style_options = plugins.user or plugins.override or plugins.remove
|
||||
if old_style_options then
|
||||
vim.notify_once("NvChad: This plugin syntax is deprecated, use new style config.", "Error")
|
||||
end
|
||||
else
|
||||
error "Packer could not be loaded!"
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
---@type ChadrcConfig
|
||||
local M = {}
|
||||
M.ui = {theme = 'gatekeeper'}
|
||||
M.plugins = 'custom.plugins'
|
||||
M.mappings = require "custom.mappings"
|
||||
return M
|
|
@ -1,6 +0,0 @@
|
|||
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
local lspconfig = require("lspconfig")
|
||||
local util = require "lspconfig/util"
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
|
||||
local options = {
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
}
|
||||
return options
|
|
@ -1,6 +0,0 @@
|
|||
vim.opt.colorcolumn = "180"
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 0
|
||||
vim.opt.shiftwidth = 0
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
M.dap = {
|
||||
n = {
|
||||
["<leader>db"] = {
|
||||
"<cmd> DapToggleBreakpoint <CR>",
|
||||
"Toggle Breakpoint"
|
||||
},
|
||||
["<leader>dus"] = {
|
||||
function ()
|
||||
local widgets = require("dap.ui.widgets");
|
||||
local sidebar = widgets.sidebar(widgets.scopes);
|
||||
sidebar.open();
|
||||
end,
|
||||
"Open debugging sidebar"
|
||||
},
|
||||
["<leader>dc"] = {
|
||||
"<cmd> DapContinue <CR>",
|
||||
"Continue debugging"
|
||||
},
|
||||
["<leader>rcu"] = {
|
||||
function ()
|
||||
require("crates").upgrade_all_crates()
|
||||
end,
|
||||
"Update all rust crates"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return M
|
|
@ -1,57 +0,0 @@
|
|||
local plugins = {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
require "custom.configs.lspconfig"
|
||||
end
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"lua-language-server",
|
||||
"rust-analyzer"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"rust-lang/rust.vim",
|
||||
ft = "rust",
|
||||
init = function ()
|
||||
vim.g.rustfmt_autosave = 1
|
||||
end
|
||||
},
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
ft = "rust",
|
||||
dependencies = "neovim/nvim-lspconfig",
|
||||
opts = function ()
|
||||
return require "custom.configs.rust-tools"
|
||||
end,
|
||||
config = function (_, opts)
|
||||
require("rust-tools").setup(opts)
|
||||
end
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap"
|
||||
},
|
||||
{
|
||||
"saecki/crates.nvim",
|
||||
ft = {"rust", "toml"},
|
||||
config = function (_, opts)
|
||||
local crates = require("crates")
|
||||
crates.setup(opts)
|
||||
crates.show()
|
||||
end
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
opts = function ()
|
||||
local M = require "plugins.configs.cmp"
|
||||
table.insert(M.sources, {name = "crates"})
|
||||
return M
|
||||
end
|
||||
}
|
||||
}
|
||||
return plugins
|
|
@ -0,0 +1,94 @@
|
|||
local present, alpha = pcall(require, "alpha")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "alpha"
|
||||
|
||||
local function button(sc, txt, keybind)
|
||||
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
|
||||
|
||||
local opts = {
|
||||
position = "center",
|
||||
text = txt,
|
||||
shortcut = sc,
|
||||
cursor = 5,
|
||||
width = 36,
|
||||
align_shortcut = "right",
|
||||
hl = "AlphaButtons",
|
||||
}
|
||||
|
||||
if keybind then
|
||||
opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } }
|
||||
end
|
||||
|
||||
return {
|
||||
type = "button",
|
||||
val = txt,
|
||||
on_press = function()
|
||||
local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) or ""
|
||||
vim.api.nvim_feedkeys(key, "normal", false)
|
||||
end,
|
||||
opts = opts,
|
||||
}
|
||||
end
|
||||
|
||||
-- dynamic header padding
|
||||
local fn = vim.fn
|
||||
local marginTopPercent = 0.3
|
||||
local headerPadding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) }
|
||||
|
||||
local options = {
|
||||
|
||||
header = {
|
||||
type = "text",
|
||||
val = {
|
||||
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
|
||||
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
||||
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
||||
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
|
||||
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
||||
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
||||
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
||||
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
||||
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
|
||||
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
||||
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
||||
},
|
||||
opts = {
|
||||
position = "center",
|
||||
hl = "AlphaHeader",
|
||||
},
|
||||
},
|
||||
|
||||
buttons = {
|
||||
type = "group",
|
||||
val = {
|
||||
button("SPC f f", " Find File ", ":Telescope find_files<CR>"),
|
||||
button("SPC f o", " Recent File ", ":Telescope oldfiles<CR>"),
|
||||
button("SPC f w", " Find Word ", ":Telescope live_grep<CR>"),
|
||||
button("SPC b m", " Bookmarks ", ":Telescope marks<CR>"),
|
||||
button("SPC t h", " Themes ", ":Telescope themes<CR>"),
|
||||
button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h <CR>"),
|
||||
},
|
||||
opts = {
|
||||
spacing = 1,
|
||||
},
|
||||
},
|
||||
|
||||
headerPaddingTop = { type = "padding", val = headerPadding },
|
||||
headerPaddingBottom = { type = "padding", val = 2 },
|
||||
}
|
||||
|
||||
options = require("core.utils").load_override(options, "goolord/alpha-nvim")
|
||||
|
||||
alpha.setup {
|
||||
layout = {
|
||||
options.headerPaddingTop,
|
||||
options.header,
|
||||
options.headerPaddingBottom,
|
||||
options.buttons,
|
||||
},
|
||||
opts = {},
|
||||
}
|
|
@ -1,35 +1,12 @@
|
|||
local cmp = require "cmp"
|
||||
local present, cmp = pcall(require, "cmp")
|
||||
|
||||
dofile(vim.g.base46_cache .. "cmp")
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local cmp_ui = require("core.utils").load_config().ui.cmp
|
||||
local cmp_style = cmp_ui.style
|
||||
require("base46").load_highlight "cmp"
|
||||
|
||||
local field_arrangement = {
|
||||
atom = { "kind", "abbr", "menu" },
|
||||
atom_colored = { "kind", "abbr", "menu" },
|
||||
}
|
||||
|
||||
local formatting_style = {
|
||||
-- default fields order i.e completion word + item.kind + item.kind icons
|
||||
fields = field_arrangement[cmp_style] or { "abbr", "kind", "menu" },
|
||||
|
||||
format = function(_, item)
|
||||
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
|
||||
icon = " " .. icon .. " "
|
||||
item.menu = cmp_ui.lspkind_text and " (" .. item.kind .. ")" or ""
|
||||
item.kind = icon
|
||||
else
|
||||
icon = cmp_ui.lspkind_text and (" " .. icon .. " ") or icon
|
||||
item.kind = string.format("%s %s", icon, cmp_ui.lspkind_text and item.kind or "")
|
||||
end
|
||||
|
||||
return item
|
||||
end,
|
||||
}
|
||||
vim.o.completeopt = "menu,menuone,noselect"
|
||||
|
||||
local function border(hl_name)
|
||||
return {
|
||||
|
@ -44,20 +21,23 @@ local function border(hl_name)
|
|||
}
|
||||
end
|
||||
|
||||
local options = {
|
||||
completion = {
|
||||
completeopt = "menu,menuone",
|
||||
},
|
||||
local cmp_window = require "cmp.utils.window"
|
||||
|
||||
cmp_window.info_ = cmp_window.info
|
||||
cmp_window.info = function(self)
|
||||
local info = self:info_()
|
||||
info.scrollable = false
|
||||
return info
|
||||
end
|
||||
|
||||
local options = {
|
||||
window = {
|
||||
completion = {
|
||||
side_padding = (cmp_style ~= "atom" and cmp_style ~= "atom_colored") and 1 or 0,
|
||||
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel",
|
||||
scrollbar = false,
|
||||
border = border "CmpBorder",
|
||||
winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None",
|
||||
},
|
||||
documentation = {
|
||||
border = border "CmpDocBorder",
|
||||
winhighlight = "Normal:CmpDoc",
|
||||
},
|
||||
},
|
||||
snippet = {
|
||||
|
@ -65,9 +45,13 @@ local options = {
|
|||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
formatting = formatting_style,
|
||||
|
||||
formatting = {
|
||||
format = function(_, vim_item)
|
||||
local icons = require("nvchad_ui.icons").lspkind
|
||||
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
|
@ -76,8 +60,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
|
||||
|
@ -105,16 +89,15 @@ local options = {
|
|||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
},
|
||||
}
|
||||
|
||||
if cmp_style ~= "atom" and cmp_style ~= "atom_colored" then
|
||||
options.window.completion.border = border "CmpBorder"
|
||||
end
|
||||
-- check for any override
|
||||
options = require("core.utils").load_override(options, "hrsh7th/nvim-cmp")
|
||||
|
||||
return options
|
||||
cmp.setup(options)
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
return {
|
||||
defaults = { lazy = true },
|
||||
install = { colorscheme = { "nvchad" } },
|
||||
|
||||
ui = {
|
||||
icons = {
|
||||
ft = "",
|
||||
lazy = " ",
|
||||
loaded = "",
|
||||
not_loaded = "",
|
||||
},
|
||||
},
|
||||
|
||||
performance = {
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"2html_plugin",
|
||||
"tohtml",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"gzip",
|
||||
"logipat",
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"matchit",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"tutor",
|
||||
"rplugin",
|
||||
"syntax",
|
||||
"synmenu",
|
||||
"optwin",
|
||||
"compiler",
|
||||
"bugreport",
|
||||
"ftplugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,5 +1,11 @@
|
|||
dofile(vim.g.base46_cache .. "lsp")
|
||||
require "nvchad.lsp"
|
||||
local present, lspconfig = pcall(require, "lspconfig")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "lsp"
|
||||
require "nvchad_ui.lsp"
|
||||
|
||||
local M = {}
|
||||
local utils = require "core.utils"
|
||||
|
@ -13,11 +19,7 @@ M.on_attach = function(client, bufnr)
|
|||
utils.load_mappings("lspconfig", { buffer = bufnr })
|
||||
|
||||
if client.server_capabilities.signatureHelpProvider then
|
||||
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
|
||||
require("nvchad_ui.signature").setup(client)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -41,7 +43,7 @@ M.capabilities.textDocument.completion.completionItem = {
|
|||
},
|
||||
}
|
||||
|
||||
require("lspconfig").lua_ls.setup {
|
||||
lspconfig.lua_ls.setup {
|
||||
on_attach = M.on_attach,
|
||||
capabilities = M.capabilities,
|
||||
|
||||
|
@ -54,8 +56,6 @@ 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/lazy.nvim/lua/lazy"] = true,
|
||||
},
|
||||
maxPreload = 100000,
|
||||
preloadFileSize = 10000,
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
local present, mason = pcall(require, "mason")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_create_augroup("_mason", { clear = true })
|
||||
vim.api.nvim_create_autocmd("Filetype", {
|
||||
pattern = "mason",
|
||||
callback = function()
|
||||
require("base46").load_highlight "mason"
|
||||
end,
|
||||
group = "_mason",
|
||||
})
|
||||
|
||||
local options = {
|
||||
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
|
||||
|
||||
|
@ -6,8 +21,8 @@ local options = {
|
|||
ui = {
|
||||
icons = {
|
||||
package_pending = " ",
|
||||
package_installed = " ",
|
||||
package_uninstalled = " ",
|
||||
package_installed = " ",
|
||||
package_uninstalled = " ﮊ",
|
||||
},
|
||||
|
||||
keymaps = {
|
||||
|
@ -25,4 +40,10 @@ local options = {
|
|||
max_concurrent_installers = 10,
|
||||
}
|
||||
|
||||
return options
|
||||
options = require("core.utils").load_override(options, "williamboman/mason.nvim")
|
||||
|
||||
vim.api.nvim_create_user_command("MasonInstallAll", function()
|
||||
vim.cmd("MasonInstall " .. table.concat(options.ensure_installed, " "))
|
||||
end, {})
|
||||
|
||||
mason.setup(options)
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
local present, nvimtree = pcall(require, "nvim-tree")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "nvimtree"
|
||||
|
||||
local options = {
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
|
@ -7,16 +15,16 @@ local options = {
|
|||
hijack_netrw = true,
|
||||
hijack_cursor = true,
|
||||
hijack_unnamed_buffer_when_opening = false,
|
||||
sync_root_with_cwd = true,
|
||||
update_cwd = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = false,
|
||||
update_cwd = false,
|
||||
},
|
||||
view = {
|
||||
adaptive_size = false,
|
||||
adaptive_size = true,
|
||||
side = "left",
|
||||
width = 30,
|
||||
preserve_window_proportions = true,
|
||||
width = 25,
|
||||
hide_root_folder = true,
|
||||
},
|
||||
git = {
|
||||
enable = false,
|
||||
|
@ -31,7 +39,6 @@ local options = {
|
|||
},
|
||||
},
|
||||
renderer = {
|
||||
root_folder_label = false,
|
||||
highlight_git = false,
|
||||
highlight_opened_files = "none",
|
||||
|
||||
|
@ -48,22 +55,22 @@ local options = {
|
|||
},
|
||||
|
||||
glyphs = {
|
||||
default = "",
|
||||
default = "",
|
||||
symlink = "",
|
||||
folder = {
|
||||
default = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
default = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
open = "",
|
||||
symlink = "",
|
||||
symlink_open = "",
|
||||
arrow_open = "",
|
||||
arrow_closed = "",
|
||||
},
|
||||
git = {
|
||||
unstaged = "✗",
|
||||
staged = "✓",
|
||||
unmerged = "",
|
||||
unmerged = "",
|
||||
renamed = "➜",
|
||||
untracked = "★",
|
||||
deleted = "",
|
||||
|
@ -74,4 +81,8 @@ local options = {
|
|||
},
|
||||
}
|
||||
|
||||
return options
|
||||
-- check for any override
|
||||
options = require("core.utils").load_override(options, "nvim-tree/nvim-tree.lua")
|
||||
vim.g.nvimtree_side = options.view.side
|
||||
|
||||
nvimtree.setup(options)
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
local present, nvterm = pcall(require, "nvterm")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
require "base46.term"
|
||||
|
||||
local options = {
|
||||
terminals = {
|
||||
list = {},
|
||||
type_opts = {
|
||||
float = {
|
||||
relative = "editor",
|
||||
row = 0.3,
|
||||
col = 0.25,
|
||||
width = 0.5,
|
||||
height = 0.4,
|
||||
border = "single",
|
||||
},
|
||||
horizontal = { location = "rightbelow", split_ratio = 0.3 },
|
||||
vertical = { location = "rightbelow", split_ratio = 0.5 },
|
||||
},
|
||||
},
|
||||
behavior = {
|
||||
close_on_exit = true,
|
||||
auto_insert = true,
|
||||
},
|
||||
enable_new_mappings = true,
|
||||
}
|
||||
|
||||
options = require("core.utils").load_override(options, "NvChad/nvterm")
|
||||
|
||||
nvterm.setup(options)
|
|
@ -1,41 +1,121 @@
|
|||
local M = {}
|
||||
|
||||
local load_override = require("core.utils").load_override
|
||||
local utils = require "core.utils"
|
||||
|
||||
M.blankline = {
|
||||
indentLine_enabled = 1,
|
||||
filetype_exclude = {
|
||||
"help",
|
||||
"terminal",
|
||||
"lazy",
|
||||
"lspinfo",
|
||||
"TelescopePrompt",
|
||||
"TelescopeResults",
|
||||
"mason",
|
||||
"nvdash",
|
||||
"nvcheatsheet",
|
||||
"",
|
||||
},
|
||||
buftype_exclude = { "terminal" },
|
||||
show_trailing_blankline_indent = false,
|
||||
show_first_indent_level = false,
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
}
|
||||
M.autopairs = function()
|
||||
local present1, autopairs = pcall(require, "nvim-autopairs")
|
||||
local present2, cmp = pcall(require, "cmp")
|
||||
|
||||
M.luasnip = function(opts)
|
||||
require("luasnip").config.set_config(opts)
|
||||
if not (present1 and present2) then
|
||||
return
|
||||
end
|
||||
|
||||
-- vscode format
|
||||
local options = {
|
||||
fast_wrap = {},
|
||||
disable_filetype = { "TelescopePrompt", "vim" },
|
||||
}
|
||||
|
||||
options = load_override(options, "windwp/nvim-autopairs")
|
||||
autopairs.setup(options)
|
||||
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end
|
||||
|
||||
M.blankline = function()
|
||||
local present, blankline = pcall(require, "indent_blankline")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "blankline"
|
||||
|
||||
local options = {
|
||||
indentLine_enabled = 1,
|
||||
filetype_exclude = {
|
||||
"help",
|
||||
"terminal",
|
||||
"alpha",
|
||||
"packer",
|
||||
"lspinfo",
|
||||
"TelescopePrompt",
|
||||
"TelescopeResults",
|
||||
"mason",
|
||||
"",
|
||||
},
|
||||
buftype_exclude = { "terminal" },
|
||||
show_trailing_blankline_indent = false,
|
||||
show_first_indent_level = false,
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
}
|
||||
|
||||
options = load_override(options, "lukas-reineke/indent-blankline.nvim")
|
||||
blankline.setup(options)
|
||||
end
|
||||
|
||||
M.colorizer = function()
|
||||
local present, colorizer = pcall(require, "colorizer")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local options = {
|
||||
filetypes = {
|
||||
"*",
|
||||
},
|
||||
user_default_options = {
|
||||
RGB = true, -- #RGB hex codes
|
||||
RRGGBB = true, -- #RRGGBB hex codes
|
||||
names = false, -- "Name" codes like Blue
|
||||
RRGGBBAA = false, -- #RRGGBBAA hex codes
|
||||
rgb_fn = false, -- CSS rgb() and rgba() functions
|
||||
hsl_fn = false, -- CSS hsl() and hsla() functions
|
||||
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
mode = "background", -- Set the display mode.
|
||||
},
|
||||
}
|
||||
|
||||
options = load_override(options, "NvChad/nvim-colorizer.lua")
|
||||
colorizer.setup(options)
|
||||
-- execute colorizer as soon as possible
|
||||
vim.defer_fn(function()
|
||||
require("colorizer").attach_to_buffer(0)
|
||||
end, 0)
|
||||
end
|
||||
|
||||
M.comment = function()
|
||||
local present, nvim_comment = pcall(require, "Comment")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local options = {}
|
||||
options = load_override(options, "numToStr/Comment.nvim")
|
||||
nvim_comment.setup(options)
|
||||
end
|
||||
|
||||
M.luasnip = function()
|
||||
local present, luasnip = pcall(require, "luasnip")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local options = {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
}
|
||||
|
||||
options = load_override(options, "L3MON4D3/LuaSnip")
|
||||
luasnip.config.set_config(options)
|
||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
|
||||
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()
|
||||
|
@ -49,18 +129,61 @@ M.luasnip = function(opts)
|
|||
})
|
||||
end
|
||||
|
||||
M.gitsigns = {
|
||||
signs = {
|
||||
add = { text = "│" },
|
||||
change = { text = "│" },
|
||||
delete = { text = "" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
untracked = { text = "│" },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
utils.load_mappings("gitsigns", { buffer = bufnr })
|
||||
end,
|
||||
}
|
||||
M.gitsigns = function()
|
||||
local present, gitsigns = pcall(require, "gitsigns")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "git"
|
||||
|
||||
local options = {
|
||||
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" },
|
||||
},
|
||||
on_attach = function (bufnr)
|
||||
utils.load_mappings("gitsigns", { buffer = bufnr })
|
||||
end
|
||||
}
|
||||
|
||||
options = load_override(options, "lewis6991/gitsigns.nvim")
|
||||
gitsigns.setup(options)
|
||||
end
|
||||
|
||||
M.devicons = function()
|
||||
local present, devicons = pcall(require, "nvim-web-devicons")
|
||||
|
||||
if present then
|
||||
require("base46").load_highlight "devicons"
|
||||
|
||||
local options = { override = require("nvchad_ui.icons").devicons }
|
||||
options = require("core.utils").load_override(options, "nvim-tree/nvim-web-devicons")
|
||||
|
||||
devicons.setup(options)
|
||||
end
|
||||
end
|
||||
|
||||
M.packer_init = function()
|
||||
return {
|
||||
auto_clean = true,
|
||||
compile_on_sync = true,
|
||||
git = { clone_timeout = 6000 },
|
||||
display = {
|
||||
working_sym = "ﲊ",
|
||||
error_sym = "✗ ",
|
||||
done_sym = " ",
|
||||
removed_sym = " ",
|
||||
moved_sym = "",
|
||||
open_fn = function()
|
||||
return require("packer.util").float { border = "single" }
|
||||
end,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
local present, telescope = pcall(require, "telescope")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
vim.g.theme_switcher_loaded = true
|
||||
|
||||
require("base46").load_highlight "telescope"
|
||||
|
||||
local options = {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
|
@ -52,4 +62,13 @@ local options = {
|
|||
extensions_list = { "themes", "terms" },
|
||||
}
|
||||
|
||||
return options
|
||||
-- check for any override
|
||||
options = require("core.utils").load_override(options, "nvim-telescope/telescope.nvim")
|
||||
telescope.setup(options)
|
||||
|
||||
-- load extensions
|
||||
pcall(function()
|
||||
for _, ext in ipairs(options.extensions_list) do
|
||||
telescope.load_extension(ext)
|
||||
end
|
||||
end)
|
||||
|
|
|
@ -1,12 +1,27 @@
|
|||
local present, treesitter = pcall(require, "nvim-treesitter.configs")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "treesitter"
|
||||
|
||||
local options = {
|
||||
ensure_installed = { "lua" },
|
||||
ensure_installed = {
|
||||
"lua",
|
||||
},
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
|
||||
indent = { enable = true },
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
|
||||
return options
|
||||
-- check for any override
|
||||
options = require("core.utils").load_override(options, "nvim-treesitter/nvim-treesitter")
|
||||
|
||||
treesitter.setup(options)
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
local present, wk = pcall(require, "which-key")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "whichkey"
|
||||
|
||||
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" },
|
||||
},
|
||||
}
|
||||
|
||||
options = require("core.utils").load_override(options, "folke/which-key.nvim")
|
||||
|
||||
wk.setup(options)
|
|
@ -1,144 +1,116 @@
|
|||
-- All plugins have lazy=true by default,to load a plugin on startup just lazy=false
|
||||
-- List of all default plugins & their definitions
|
||||
local default_plugins = {
|
||||
local plugins = {
|
||||
|
||||
"nvim-lua/plenary.nvim",
|
||||
["nvim-lua/plenary.nvim"] = { module = "plenary" },
|
||||
|
||||
{
|
||||
"NvChad/base46",
|
||||
branch = "v2.0",
|
||||
build = function()
|
||||
require("base46").load_all_highlights()
|
||||
["lewis6991/impatient.nvim"] = {},
|
||||
|
||||
["wbthomason/packer.nvim"] = {
|
||||
cmd = require("core.lazy_load").packer_cmds,
|
||||
config = function()
|
||||
require "plugins"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/ui",
|
||||
branch = "v2.0",
|
||||
lazy = false,
|
||||
["NvChad/extensions"] = { branch = "main", module = { "telescope", "nvchad" } },
|
||||
|
||||
["NvChad/base46"] = {
|
||||
branch = "master",
|
||||
config = function()
|
||||
local ok, base46 = pcall(require, "base46")
|
||||
|
||||
if ok then
|
||||
base46.load_theme()
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/nvterm",
|
||||
init = function()
|
||||
["NvChad/ui"] = {
|
||||
branch = "main",
|
||||
after = "base46",
|
||||
config = function()
|
||||
local present, nvchad_ui = pcall(require, "nvchad_ui")
|
||||
|
||||
if present then
|
||||
nvchad_ui.setup()
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
["NvChad/nvterm"] = {
|
||||
module = "nvterm",
|
||||
config = function()
|
||||
require "plugins.configs.nvterm"
|
||||
end,
|
||||
setup = function()
|
||||
require("core.utils").load_mappings "nvterm"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require "base46.term"
|
||||
require("nvterm").setup(opts)
|
||||
},
|
||||
|
||||
["nvim-tree/nvim-web-devicons"] = {
|
||||
after = "ui",
|
||||
module = "nvim-web-devicons",
|
||||
commit = "dd468f6991a4e447607097dfc89d47ae97d14dea",
|
||||
config = function()
|
||||
require("plugins.configs.others").devicons()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-colorizer.lua"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("colorizer").setup(opts)
|
||||
|
||||
-- execute colorizer as soon as possible
|
||||
vim.defer_fn(function()
|
||||
require("colorizer").attach_to_buffer(0)
|
||||
end, 0)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
opts = function()
|
||||
return { override = require "nvchad.icons.devicons" }
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "devicons")
|
||||
require("nvim-web-devicons").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
version = "2.20.7",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "indent-blankline.nvim"
|
||||
end,
|
||||
opts = function()
|
||||
return require("plugins.configs.others").blankline
|
||||
end,
|
||||
config = function(_, opts)
|
||||
["lukas-reineke/indent-blankline.nvim"] = {
|
||||
opt = true,
|
||||
setup = function()
|
||||
require("core.lazy_load").on_file_open "indent-blankline.nvim"
|
||||
require("core.utils").load_mappings "blankline"
|
||||
dofile(vim.g.base46_cache .. "blankline")
|
||||
require("indent_blankline").setup(opts)
|
||||
end,
|
||||
config = function()
|
||||
require("plugins.configs.others").blankline()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-treesitter"
|
||||
["NvChad/nvim-colorizer.lua"] = {
|
||||
opt = true,
|
||||
setup = function()
|
||||
require("core.lazy_load").on_file_open "nvim-colorizer.lua"
|
||||
end,
|
||||
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
|
||||
build = ":TSUpdate",
|
||||
opts = function()
|
||||
return require "plugins.configs.treesitter"
|
||||
config = function()
|
||||
require("plugins.configs.others").colorizer()
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "syntax")
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
},
|
||||
|
||||
["nvim-treesitter/nvim-treesitter"] = {
|
||||
module = "nvim-treesitter",
|
||||
setup = function()
|
||||
require("core.lazy_load").on_file_open "nvim-treesitter"
|
||||
end,
|
||||
cmd = require("core.lazy_load").treesitter_cmds,
|
||||
run = ":TSUpdate",
|
||||
config = function()
|
||||
require "plugins.configs.treesitter"
|
||||
end,
|
||||
},
|
||||
|
||||
-- git stuff
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
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,
|
||||
})
|
||||
["lewis6991/gitsigns.nvim"] = {
|
||||
ft = "gitcommit",
|
||||
setup = function()
|
||||
require("core.lazy_load").gitsigns()
|
||||
end,
|
||||
opts = function()
|
||||
return require("plugins.configs.others").gitsigns
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "git")
|
||||
require("gitsigns").setup(opts)
|
||||
config = function()
|
||||
require("plugins.configs.others").gitsigns()
|
||||
end,
|
||||
},
|
||||
|
||||
-- lsp stuff
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
|
||||
opts = function()
|
||||
return require "plugins.configs.mason"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "mason")
|
||||
require("mason").setup(opts)
|
||||
|
||||
-- custom nvchad cmd to install all mason binaries listed
|
||||
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
|
||||
["williamboman/mason.nvim"] = {
|
||||
cmd = require("core.lazy_load").mason_cmds,
|
||||
config = function()
|
||||
require "plugins.configs.mason"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-lspconfig"
|
||||
["neovim/nvim-lspconfig"] = {
|
||||
opt = true,
|
||||
setup = function()
|
||||
require("core.lazy_load").on_file_open "nvim-lspconfig"
|
||||
end,
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
|
@ -146,127 +118,109 @@ local default_plugins = {
|
|||
},
|
||||
|
||||
-- load luasnips + cmp related in insert mode only
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
|
||||
["rafamadriz/friendly-snippets"] = {
|
||||
module = { "cmp", "cmp_nvim_lsp" },
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
{
|
||||
-- snippet plugin
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
|
||||
config = function(_, opts)
|
||||
require("plugins.configs.others").luasnip(opts)
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
-- autopairing of (){}[] etc
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
opts = {
|
||||
fast_wrap = {},
|
||||
disable_filetype = { "TelescopePrompt", "vim" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-autopairs").setup(opts)
|
||||
|
||||
-- setup cmp for autopairs
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
},
|
||||
|
||||
-- cmp sources plugins
|
||||
{
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
},
|
||||
opts = function()
|
||||
return require "plugins.configs.cmp"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("cmp").setup(opts)
|
||||
["hrsh7th/nvim-cmp"] = {
|
||||
after = "friendly-snippets",
|
||||
config = function()
|
||||
require "plugins.configs.cmp"
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"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)" },
|
||||
},
|
||||
init = function()
|
||||
require("core.utils").load_mappings "comment"
|
||||
["L3MON4D3/LuaSnip"] = {
|
||||
wants = "friendly-snippets",
|
||||
after = "nvim-cmp",
|
||||
config = function()
|
||||
require("plugins.configs.others").luasnip()
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("Comment").setup(opts)
|
||||
},
|
||||
|
||||
["saadparwaiz1/cmp_luasnip"] = { after = "LuaSnip" },
|
||||
["hrsh7th/cmp-nvim-lua"] = { after = "cmp_luasnip" },
|
||||
["hrsh7th/cmp-nvim-lsp"] = { after = "cmp-nvim-lua" },
|
||||
["hrsh7th/cmp-buffer"] = { after = "cmp-nvim-lsp" },
|
||||
["hrsh7th/cmp-path"] = { after = "cmp-buffer" },
|
||||
|
||||
-- misc plugins
|
||||
["windwp/nvim-autopairs"] = {
|
||||
after = "nvim-cmp",
|
||||
config = function()
|
||||
require("plugins.configs.others").autopairs()
|
||||
end,
|
||||
},
|
||||
|
||||
["goolord/alpha-nvim"] = {
|
||||
after = "base46",
|
||||
disable = true,
|
||||
config = function()
|
||||
require "plugins.configs.alpha"
|
||||
end,
|
||||
},
|
||||
|
||||
["numToStr/Comment.nvim"] = {
|
||||
module = "Comment",
|
||||
keys = { "gc", "gb" },
|
||||
config = function()
|
||||
require("plugins.configs.others").comment()
|
||||
end,
|
||||
setup = function()
|
||||
require("core.utils").load_mappings "comment"
|
||||
end,
|
||||
},
|
||||
|
||||
-- file managing , picker etc
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
["nvim-tree/nvim-tree.lua"] = {
|
||||
ft = "alpha",
|
||||
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
|
||||
init = function()
|
||||
config = function()
|
||||
require "plugins.configs.nvimtree"
|
||||
end,
|
||||
setup = function()
|
||||
require("core.utils").load_mappings "nvimtree"
|
||||
end,
|
||||
opts = function()
|
||||
return require "plugins.configs.nvimtree"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "nvimtree")
|
||||
require("nvim-tree").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = "nvim-treesitter/nvim-treesitter",
|
||||
["nvim-telescope/telescope.nvim"] = {
|
||||
cmd = "Telescope",
|
||||
init = function()
|
||||
config = function()
|
||||
require "plugins.configs.telescope"
|
||||
end,
|
||||
setup = 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"
|
||||
telescope.setup(opts)
|
||||
|
||||
-- load extensions
|
||||
for _, ext in ipairs(opts.extensions_list) do
|
||||
telescope.load_extension(ext)
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Only load whichkey after all the gui
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
keys = { "<leader>", '"', "'", "`", "c", "v", "g" },
|
||||
init = function()
|
||||
require("core.utils").load_mappings "whichkey"
|
||||
["folke/which-key.nvim"] = {
|
||||
disable = true,
|
||||
module = "which-key",
|
||||
keys = { "<leader>", '"', "'", "`" },
|
||||
config = function()
|
||||
require "plugins.configs.whichkey"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "whichkey")
|
||||
require("which-key").setup(opts)
|
||||
setup = function()
|
||||
require("core.utils").load_mappings "whichkey"
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
local config = require("core.utils").load_config()
|
||||
-- Load all plugins
|
||||
local present, packer = pcall(require, "packer")
|
||||
|
||||
if #config.plugins > 0 then
|
||||
table.insert(default_plugins, { import = config.plugins })
|
||||
if present then
|
||||
vim.cmd "packadd packer.nvim"
|
||||
|
||||
-- Override with default plugins with user ones
|
||||
plugins = require("core.utils").merge_plugins(plugins)
|
||||
|
||||
-- load packer init options
|
||||
local init_options = require("plugins.configs.others").packer_init()
|
||||
init_options = require("core.utils").load_override(init_options, "wbthomason/packer.nvim")
|
||||
|
||||
packer.init(init_options)
|
||||
packer.startup { plugins }
|
||||
end
|
||||
|
||||
require("lazy").setup(default_plugins, config.lazy_nvim)
|
||||
|
|
Loading…
Reference in New Issue