Initial Commit

This commit is contained in:
Ben Foster committed 2024-11-15 02:18:40 -07:00
commit b268e041e9
34 files changed
+1502

No files matched your search

Vendored
BIN
View File
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 4
quote_style = "AutoPreferDouble"
# call_parentheses = "None"
+24
View File
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>
+852
View File
@@ -0,0 +1,852 @@
![Screenshot](nvchad-neovim.png)
https://www.youtube.com/watch?v=TNRFegMqbWA
# Installing NvChad Version 2.5
## Backup and remove old nvim config.
Backup old nvim config.
```
mv ~/.config/nvim ~/.config/nvim-old
```
Or remove old nvim config.
```
rm -rf ~/.config/nvim
```
Remove local/state and local/share
```
rm -rf ~/.local/state/nvim
rm -rf ~/.local/share/nvim
```
## Install NvChad.
Install required packages.
```
sudo pacman -S --needed neovim unzip luarocks xclip wl-clipboard
```
Install NvChad config from https://nvchad.com/docs/quickstart/install
```
git clone https://github.com/NvChad/starter ~/.config/nvim && nvim
```
Or this already configured version
```
git clone https://github.com/ProgrammingRainbow/NvChad-2.5 ~/.config/nvim && nvim
```
You can safely remove the `.git` and image files.
```
rm-rf ~/.config/nvim/.git
rm ~/.config/nvim/*.png
```
Edit the file `~/.config/nvim/lua/options.lua` to change tabs from 2 to 4 spaces. \
Original config is here https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/options.lua
```
-- local o = vim.o
```
To this.
```
local o = vim.o
-- Indenting
o.shiftwidth = 4
o.tabstop = 4
o.softtabstop = 4
```
Edit `~/.config/nvim/.stylua.toml` to change indent width to 4 and to use parentheses.
```
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 4
quote_style = "AutoPreferDouble"
# call_parentheses = "None"
```
## Setup Format and Style with Conform.
Edit `~/.config/nvim/lua/plugins/init.lua` to load module on save.
```
{
"stevearc/conform.nvim",
event = "BufWritePre",
config = function()
require("configs.conform")
end,
},
```
Edit `~/.config/nvim/lua/configs/conform.lua` to enable format_on_save.
```
local options = {
formatters_by_ft = {
lua = { "stylua" },
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_fallback = true,
},
}
require("conform").setup(options)
```
## Setup Treesitter
https://github.com/nvim-treesitter/nvim-treesitter \
Added to the Top of `~/.config/nvim/lua/plugins/init.lua`.
```
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("configs.treesitter")
end,
},
```
Create file `~/.config/nvim/lua/configs/treesitter.lua`. \
Copy from the internal one.
https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/treesitter.lua
```
local options = {
ensure_installed = {
"bash",
"fish",
"lua",
"luadoc",
"markdown",
"printf",
"toml",
"vim",
"vimdoc",
"yaml",
},
highlight = {
enable = true,
use_languagetree = true,
},
indent = { enable = true },
}
require("nvim-treesitter.configs").setup(options)
```
## Basic Treesitter commands.
List Treesitter installed languages.
```
:TSInstallInfo
```
Install fish for treesitter.
```
:TSInstall fish
```
Update fish.
```
:TSUpdate fish
```
Update all.
```
:TSUpdate
```
Disable treesitter highlighting.
```
:TSDisable highlight
```
Enable treesitter highlighting.
```
:TSEnable highlight
```
## Treesitter language for filetype.
Check loaded treesitter language.
```
:lua print(require"nvim-treesitter.parsers".get_buf_lang())
```
or
```
:Inspect
```
Check filetype of buffer.
```
:echo &filetype
```
or
```
:set filetype?
```
Set filetype.
```
:set filetype=fish
```
## Setup LSPConfig.
https://github.com/neovim/nvim-lspconfig \
Edit file `~/.config/nvim/lua/plugins/init.lua`. \
Under Treesitter add an lspconfig entry.
```
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("nvchad.configs.lspconfig").defaults()
require("configs.lspconfig")
end,
},
```
Edit file `~/.config/nvim/lua/configs/lspconfig.lua`. \
We will be adding a table that has a list of all servers configured. \
This will be used later in the mason-lspconfig to automate there installation. \
Then we will have a simple default_servers table for looping and setting up default configs. \
Using the NvChad default lua_ls found \
here https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/lspconfig.lua \
we will add love2d support `"${3rd}/love2d/library",` but also disable linting diagnostics.
```
local on_attach = require("nvchad.configs.lspconfig").on_attach
local on_init = require("nvchad.configs.lspconfig").on_init
local capabilities = require("nvchad.configs.lspconfig").capabilities
local lspconfig = require("lspconfig")
-- list of all servers configured.
lspconfig.servers = {
"lua_ls",
}
-- list of servers configured with default config.
local default_servers = {}
-- lsps with default config
for _, lsp in ipairs(default_servers) do
lspconfig[lsp].setup({
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
})
end
lspconfig.lua_ls.setup({
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
enable = false, -- Disable all diagnostics from lua_ls
-- globals = { "vim" },
},
workspace = {
library = {
vim.fn.expand("$VIMRUNTIME/lua"),
vim.fn.expand("$VIMRUNTIME/lua/vim/lsp"),
vim.fn.stdpath("data") .. "/lazy/ui/nvchad_types",
vim.fn.stdpath("data") .. "/lazy/lazy.nvim/lua/lazy",
"${3rd}/love2d/library",
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
})
```
## Setting up Linting.
https://github.com/mfussenegger/nvim-lint \
Edit file `~/.config/nvim/lua/plugins/init.lua`. \
Between LSPConfig and Confom add an entry for Linting.
```
{
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("configs.lint")
end,
},
```
Create file `~/.config/nvim/lua/configs/lint.lua`. \
`lint.linters_by_ft` is a key, value table for all linters to be configured. \
`lint.linters.laucheck.args = {` Will over write the arguments table for luacheck. \
To get the default args before editing use this command \
`:lua print(vim.inspect(require('lint').linters.luacheck.args))`. \
or unpack the original args into the table and add your new args below it.
Create an auto command to run the linter when opeing a buffer, saving or leaving insert mode.
```
local lint = require("lint")
lint.linters_by_ft = {
lua = { "luacheck" },
}
lint.linters.luacheck.args = {
unpack(lint.linters.luacheck.args),
"--globals",
"love",
"vim",
}
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
callback = function()
lint.try_lint()
end,
})
```
## Setting up mason-conform.
https://github.com/zapling/mason-conform.nvim \
Edit the file `~/.config/nvim/lua/plugins/init.lua`. \
Below the conform entry add mason-conform.
```
{
"zapling/mason-conform.nvim",
event = "VeryLazy",
dependencies = { "conform.nvim" },
config = function()
require("configs.mason-conform")
end,
},
```
Create the file `~/.config/nvim/lua/configs/mason-conform.lua`. \
Any formatters you don't wish to auto install add to ignore_install table.
```
require("mason-conform").setup({
-- List of formatters to ignore during install
ignore_install = {},
})
```
## Setting up mason-lspconfig.
https://github.com/williamboman/mason-lspconfig.nvim \
Edit the file `~/.config/nvim/lua/plugins/init.lua`. \
Below the lspconfig entry add mason-lspconfig.
```
{
"williamboman/mason-lspconfig.nvim",
event = "VeryLazy",
dependencies = { "nvim-lspconfig" },
config = function()
require("configs.mason-lspconfig")
end,
},
```
Create the file `~/.config/nvim/lua/configs/mason-lspconfig.lua`. \
This entire file is simply creating a table of servers to pass into ensure_installed. \
There is also a table at the top to add any server that should not be installed.
```
local lspconfig = package.loaded["lspconfig"]
-- List of servers to ignore during install
local ignore_install = {}
-- Helper function to find if value is in table.
local function table_contains(table, value)
for _, v in ipairs(table) do
if v == value then
return true
end
end
return false
end
-- Build a list of lsp servers to install minus the ignored list.
local all_servers = {}
for _, s in ipairs(lspconfig.servers) do
if not table_contains(ignore_install, s) then
table.insert(all_servers, s)
end
end
require("mason-lspconfig").setup({
ensure_installed = all_servers,
automatic_installation = false,
})
```
## Setting up mason-lint.
https://github.com/rshkarin/mason-nvim-lint \
Edit the file `~/.config/nvim/lua/plugins/init.lua`. \
Below the lint entry add mason-lint.
```
{
"rshkarin/mason-nvim-lint",
event = "VeryLazy",
dependencies = { "nvim-lint" },
config = function()
require("configs.mason-lint")
end,
},
```
Create the file `~/.config/nvim/lua/configs/mason-lint.lua`. \
This entire file is simply creating a table of linters to pass into ensure_installed. \
There is also a table at the top to add any linter that should not be installed.
```
local lint = package.loaded["lint"]
-- List of linters to ignore during install
local ignore_install = {}
-- Helper function to find if value is in table.
local function table_contains(table, value)
for _, v in ipairs(table) do
if v == value then
return true
end
end
return false
end
-- Build a list of linters to install minus the ignored list.
local all_linters = {}
for _, v in pairs(lint.linters_by_ft) do
for _, linter in ipairs(v) do
if not table_contains(ignore_install, linter) then
table.insert(all_linters, linter)
end
end
end
require("mason-nvim-lint").setup({
ensure_installed = all_linters,
automatic_installation = false,
})
```
![Screenshot](nvchad-cpp.png)
https://www.youtube.com/watch?v=upeAH74q0q4
# C and C++
## UPDATE
I have changed the hack that was in place for clang_format since the video. \
Change file `~/.config/nvim/lua/configs/conform.lua`.
```
c_cpp = { "clang-format" }, -- Hack to force download.
c = { "clang_format" },
cpp = { "clang_format" },
```
and
```
clang_format = {
```
The a simpler way.
```
c = { "clang-format" },
cpp = { "clang-format" },
```
and
```
["clang-format"] = {
```
In `~/.config/nvim/lua/configs/lspconfig.lua`. The on_attach function takes client and bufnr parameters. It has almost no documentations and i have no idea if leaving it off affects anything. But it appears it should be provided.
```
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
on_attach(client, bufnr)
```
## lspconfig
Edit file `~/.config/nvim/lua/configs/lspconfig.lua`. \
Add `"clangd",` to lspconfig.servers.
```
lspconfig.servers = {
"lua_ls",
"clangd",
}
```
Add a setup for clangd. This disables formatting.
```
lspconfig.clangd.setup({
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
on_attach(client, bufnr)
end,
on_init = on_init,
capabilities = capabilities,
})
```
## conform
Edit file `~/.config/nvim/lua/configs/conform.lua`. \
Add a C and C++ entry to formatters_by_ft.
```
c = { "clang-format" },
cpp = { "clang-format" },
```
Between formatters_by_ft and format_on_save tables add. This sets tab spacing to 4. The default is 2.
```
formatters = {
["clang-format"] = {
prepend_args = {
"-style={ \
IndentWidth: 4, \
TabWidth: 4, \
UseTab: Never, \
AccessModifierOffset: 0, \
IndentAccessModifiers: true, \
PackConstructorInitializers: Never}",
},
},
},
```
## treesitter
Edit file `~/.config/nvim/lua/configs/treesitter.lua`. \
Add syntax highlighting for c, c++, make and cmake.
```
"c",
"cmake",
"cpp",
"make",
```
![Screenshot](nvchad-go.png)
https://www.youtube.com/watch?v=1vK3VCfKEyQ
# Golang
## UPDATE
I think all the formatters for Go only apply to actual .go files. So all non Go filetypes have been removed from `conform.lua`.
In `treesitter.lua` gotmpl has been added.
## lspconfig
Edit file `~/.config/nvim/lua/configs/lspconfig.lua`. \
Add `"gopls",` to lspconfig.servers.
```
lspconfig.servers = {
"lua_ls",
"gopls",
}
```
Add a setup for gopls. This disables formatting and adds some linting options.
```
lspconfig.gopls.setup({
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
on_attach(client, bufnr)
end,
on_init = on_init,
capabilities = capabilities,
cmd = { "gopls" },
filetypes = { "go", "gomod", "gotmpl", "gowork" },
root_dir = lspconfig.util.root_pattern("go.work", "go.mod", ".git"),
settings = {
gopls = {
analyses = {
unusedparams = true,
},
completeUnimported = true,
usePlaceholders = true,
staticcheck = true,
},
},
})
```
## conform
Edit file `~/.config/nvim/lua/configs/conform.lua`. \
Add Golang entry to formatters_by_ft.
```
go = { "gofumpt", "goimports-reviser", "golines" },
```
Between `formatters_by_ft` and `format_on_save` add entries to table `formatters`.
```
formatters = {
["goimports-reviser"] = {
prepend_args = { "-rm-unused" },
},
golines = {
prepend_args = { "--max-len=80" },
},
},
```
## treesitter
Edit file `~/.config/nvim/lua/configs/treesitter.lua`. \
Add syntax highlighting for Go related filetypes.
```
"go",
"gomod",
"gosum",
"gotmpl",
"gowork",
```
![Screenshot](nvchad-python.png)
https://www.youtube.com/watch?v=4o6D1W0iW10
# Python
## lspconfig
Edit file `~/.config/nvim/lua/configs/lspconfig.lua`. \
Add `"pyright",` to `lspconfig.servers`.
```
"pyright",
```
Add `"pyright"` to `default_servers`.
```
"pyright",
```
## conform
Edit file `~/.config/nvim/lua/configs/conform.lua`. \
Add `python` `entries to formatters_by_ft` for isort and black.
```
python = { "isort", "black" },
```
Between `formatters_by_ft` and `format_on_save` add entries to table `formatters`. \
Try to speed up black and to to make isort play better wtih black.
```
formatters = {
-- Python
black = {
prepend_args = {
"--fast",
"--line-length",
"80",
},
},
isort = {
prepend_args = {
"--profile",
"black",
},
},
},
```
## linting
Edit file `~/.config/nvim/lua/configs/lint.lua`. \
Add a python flake8 entry to `linters_by_ft` table.
```
python = { "flake8" },
```
## treesitter
Edit file `~/.config/nvim/lua/configs/treesitter.lua`. \
Add syntax highlighting for Python.
```
"python",
```
![Screenshot](nvchad-python-doc.png)
https://www.youtube.com/watch?v=m0OobzFjEKE
# Python (Dreams of Code)
## lspconfig
Edit file `~/.config/nvim/lua/configs/lspconfig.lua`. \
Add `"pyright",` to `lspconfig.servers`.
```
"pyright",
```
Choose default or choose to disable type checks for pyright. \
(Choice 1) For default add `"pyright"` to `default_servers`.
```
"pyright",
```
(Choice 2) Or to prevent duplicate linting from pyright and mypy add the following. This will not stop pyright unused variable hits. I was unable to turn this off.
```
lspconfig.pyright.setup({
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
settings = {
python = {
analysis = {
typeCheckingMode = "off", -- Disable type checking diagnostics
},
},
},
})
```
## conform
Edit file `~/.config/nvim/lua/configs/conform.lua`. \
Add a `python` entry to `formatters_by_ft` for isort and black.
```
python = { "black" },
```
(Optional) Between `formatters_by_ft` and `format_on_save` add entries to table `formatters`. \
Try to speed up black and to to make isort play better wtih black.
```
formatters = {
-- Python
black = {
prepend_args = {
"--fast",
"--line-length",
"80",
},
},
},
```
## linting
Edit file `~/.config/nvim/lua/configs/lint.lua`. \
Add a python mypy and ruff entries to `linters_by_ft` table.
```
python = { "mypy", "ruff" },
```
## treesitter
Edit file `~/.config/nvim/lua/configs/treesitter.lua`. \
Add syntax highlighting for Python.
```
"python",
```
## dap
Edit file `~/.config/nvim/lua/plugins/init.lua`. \
We will add the entry for nvim-dap and also load it's config from `configs/dap.lua`
```
{
"mfussenegger/nvim-dap",
config = function()
require("configs.dap")
end,
},
```
Create `~/.config/nvim/lua/configs/dap.lua`. \
We are adding a leader + d + b key mapping to set a breakpoint. This key mapping is only set when dap is loaded that's why it's not in mappings.lua
```
local map = vim.keymap.set
map(
"n",
"<leader>db",
"<cmd> DapToggleBreakpoint <CR>",
{ desc = "Toggle DAP Breakpoint" }
)
map(
"n",
"<leader>dr",
"<cmd> DapContinue <CR>",
{ desc = "Start or continue DAP" }
)
```
## dap-ui
Edit file `~/.config/nvim/lua/plugins/init.lua`. \
we need an entry for both nvim-nio and nvim-dap-ui. Dap UI depends on both nvim-dap and nvim-nio. We will load it's configuration from `configs/dap-ui.lua`
```
{
"nvim-neotest/nvim-nio",
},
{
"rcarriga/nvim-dap-ui",
dependencies = {
"mfussenegger/nvim-dap",
"nvim-neotest/nvim-nio",
},
config = function()
require("configs.dap-ui")
end,
},
```
Create `~/.config/nvim/lua/configs/dap-ui.lua`.
```
local dap = require("dap")
local dapui = require("dapui")
dapui.setup()
local map = vim.keymap.set
map(
"n",
"<leader>du",
"<cmd>lua require('dapui').toggle()<CR>",
{ desc = "Toggle DAP UI" }
)
dap.listeners.after.attach.dapui_config = function()
dapui.open()
end
dap.listeners.after.launch.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end
```
## dap-python
Edit file `~/.config/nvim/lua/plugins/init.lua`. \
We will have this load when `python` files are loaded. We will load it's configurations from `configs/dap-python.lua`.
```
{
"mfussenegger/nvim-dap-python",
ft = "python",
dependencies = {
"mfussenegger/nvim-dap",
"rcarriga/nvim-dap-ui",
},
config = function()
require("configs.dap-python")
end,
},
```
Create `~/.config/nvim/lua/configs/dap-python.lua`. \
We are setting the path to debugpy and passing that to the dap-python setup. We are also setting up key mappings that will only be loaded when `nvim-dap-python` is loaded.
```
local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python"
require("dap-python").setup(path)
local map = vim.keymap.set
map("n", "<leader>dpr", function()
require("dap-python").test_method()
end, { desc = "Run DAP Python test method" })
```
## mason-nvim-dap
Edit file `~/.config/nvim/lua/plugins/init.lua`. \
We will used `mason-nvim-dap` to automagicly install debugpy. We will set it's loading to verylazy so it doesn't slowdown nvim startup time. It will also load its config from `configs/mason-dap.lua`
```
{
"jay-babu/mason-nvim-dap.nvim",
event = "VeryLazy",
config = function()
require("configs.mason-dap")
end,
},
```
Create `~/.config/nvim/lua/configs/mason-dap.lua`. \
This mason-nvim-dap like other similar packages doesn't actually load it's packages on demand so we will just put the package into the ensured installed. Debugpy is actually refered to as `python`. Any package that is being installed automatically that you don't want to, can be added into the exclude table.
```
require("mason-nvim-dap").setup({
ensure_installed = { "python" },
automatic_installation = { exclude = {} },
})
```
![Screenshot](nvchad-odin.png)
https://www.youtube.com/watch?v=-NMYeQGIN20
# Odin
## lspconfig
Edit file `~/.config/nvim/lua/configs/lspconfig.lua`. \
Add `"ols",` to `lspconfig.servers`.
```
"ols",
```
Add `"ols"` to `default_servers`.
```
"ols",
```
## treesitter
Edit file `~/.config/nvim/lua/configs/treesitter.lua`. \
Add syntax highlighting for Odin.
```
"odin",
```
![Screenshot](nvchad-haskell.png)
https://www.youtube.com/watch?v=CcYQULn_M4s
# Haskell
## lspconfig
Edit file `~/.config/nvim/lua/configs/lspconfig.lua`. \
Add the haskell-language-server `"hls",` to `lspconfig.servers`. Unless it's installed on your system.
```
"hls",
```
Add a setup for hls. This disables formatting.
```
lspconfig.hls.setup({
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
on_attach(client, bufnr)
end,
on_init = on_init,
capabilities = capabilities,
})
```
## linting
Edit file `~/.config/nvim/lua/configs/lint.lua`. \
Add a hlint entry to `linters_by_ft` table.
```
haskell = { "hlint" },
```
## conform
Edit file `~/.config/nvim/lua/configs/conform.lua`. \
Add an entry to `formatters_by_ft` for ormolu or fourmolu. Also add stylish-haskell.\
Four spaces the right choice.
```
haskell = { "fourmolu", "stylish-haskell" },
```
Two spaces the wrong choice.
```
haskell = { "ormolu", "stylish-haskell" },
```
## treesitter
Edit file `~/.config/nvim/lua/configs/treesitter.lua`. \
Add syntax highlighting for Haskell.
```
"haskell",
```
+41
View File
@@ -0,0 +1,41 @@
vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
vim.g.mapleader = " "
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }
end
vim.opt.rtp:prepend(lazypath)
local lazy_config = require "configs.lazy"
-- load plugins
require("lazy").setup({
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
config = function()
require "options"
end,
},
{ import = "plugins" },
}, lazy_config)
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "nvchad.autocmds"
vim.schedule(function()
require "mappings"
end)
require("toggleterm").setup{}
+38
View File
@@ -0,0 +1,38 @@
{
"LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" },
"NvChad": { "branch": "v2.5", "commit": "bbc3d43db088c141b142a40cd5f717635833a54e" },
"base46": { "branch": "v2.5", "commit": "16ee0e93dfc52e35ee7c9cf45e5ebf116958edb7" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" },
"indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" },
"lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" },
"mason-conform.nvim": { "branch": "main", "commit": "abce2be529f3b4b336c56d0ba6336a9144e0fee6" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
"mason-nvim-lint": { "branch": "main", "commit": "b579a00ee39dcd590b1023028dc8fb3d203a67b0" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" },
"minty": { "branch": "main", "commit": "1b604ed0d741294cfb56c0ce3aa6161e9ae7dd8b" },
"nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
"nvim-lint": { "branch": "master", "commit": "36da8dd0ddc4f88e0beae234c20e75397326f143" },
"nvim-lspconfig": { "branch": "master", "commit": "87c7c83ce62971e0bdb29bb32b8ad2b19c8f95d0" },
"nvim-tree.lua": { "branch": "master", "commit": "28eac2801b201f301449e976d7a9e8cfde053ba3" },
"nvim-treesitter": { "branch": "master", "commit": "6389ceb1758b8f62a15194e3b790e33268304cb8" },
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" },
"toggleterm.nvim": { "branch": "main", "commit": "022ff5594acccc8d90d2e46dc43994f7722ebdf7" },
"ui": { "branch": "v3.0", "commit": "c59c5fc078cc22a28604e154552c41705359145b" },
"vim-cmake": { "branch": "master", "commit": "896bc2189c8ade62d00a0ebedc59c65d9d9b0d65" },
"vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" },
"vim-tmux-navigator": { "branch": "master", "commit": "424b5caa154bff34dc258ee53cec5a8e36cf7ea8" },
"volt": { "branch": "main", "commit": "1df6698f7e5d19db578063412d12322e53376f5e" },
"which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" }
}
BIN
View File
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
-- This file needs to have same structure as nvconfig.lua
-- https://github.com/NvChad/ui/blob/v2.5/lua/nvconfig.lua
---@type ChadrcConfig
local M = {}
M.base46 = {
theme = "ayu_dark",
-- hl_override = {
-- Comment = { italic = true },
-- ["@comment"] = { italic = true },
-- },
}
M.nvdash = {
load_on_startup = true,
}
return M
+64
View File
@@ -0,0 +1,64 @@
local options = {
formatters_by_ft = {
lua = { "stylua" },
c = { "clang-format" },
cpp = { "clang-format" },
-- go = { "gofumpt", "goimports-reviser", "golines" },
-- haskell = { "fourmolu", "stylish-haskell" },
python = { "isort", "black" },
},
formatters = {
-- C & C++
["clang-format"] = {
prepend_args = {
"-style={ \
IndentWidth: 4, \
TabWidth: 4, \
UseTab: Never, \
AccessModifierOffset: 0, \
IndentAccessModifiers: true, \
PackConstructorInitializers: Never}",
},
},
-- -- Golang
-- ["goimports-reviser"] = {
-- prepend_args = { "-rm-unused" },
-- },
-- golines = {
-- prepend_args = { "--max-len=80" },
-- },
-- -- Lua
-- stylua = {
-- prepend_args = {
-- "--column-width", "80",
-- "--line-endings", "Unix",
-- "--indent-type", "Spaces",
-- "--indent-width", "4",
-- "--quote-style", "AutoPreferDouble",
-- },
-- },
-- Python
black = {
prepend_args = {
"--fast",
"--line-length",
"80",
},
},
isort = {
prepend_args = {
"--profile",
"black",
},
},
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_fallback = true,
},
}
require("conform").setup(options)
+47
View File
@@ -0,0 +1,47 @@
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",
},
},
},
}
+20
View File
@@ -0,0 +1,20 @@
local lint = require("lint")
lint.linters_by_ft = {
lua = { "luacheck" },
-- haskell = { "hlint" },
python = { "flake8" },
}
lint.linters.luacheck.args = {
unpack(lint.linters.luacheck.args),
"--globals",
"love",
"vim",
}
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
callback = function()
lint.try_lint()
end,
})
+101
View File
@@ -0,0 +1,101 @@
local on_attach = require("nvchad.configs.lspconfig").on_attach
local on_init = require("nvchad.configs.lspconfig").on_init
local capabilities = require("nvchad.configs.lspconfig").capabilities
local lspconfig = require("lspconfig")
-- list of all servers configured.
lspconfig.servers = {
"ansiblels",
"lua_ls",
"clangd",
-- "gopls",
-- "hls",
"ols",
"pyright",
}
-- list of servers configured with default config.
local default_servers = {
"ols",
"pyright",
}
-- lsps with default config
for _, lsp in ipairs(default_servers) do
lspconfig[lsp].setup({
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
})
end
lspconfig.clangd.setup({
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
on_attach(client, bufnr)
end,
on_init = on_init,
capabilities = capabilities,
})
-- lspconfig.gopls.setup({
-- on_attach = function(client, bufnr)
-- client.server_capabilities.documentFormattingProvider = false
-- client.server_capabilities.documentRangeFormattingProvider = false
-- on_attach(client, bufnr)
-- end,
-- on_init = on_init,
-- capabilities = capabilities,
-- cmd = { "gopls" },
-- filetypes = { "go", "gomod", "gotmpl", "gowork" },
-- root_dir = lspconfig.util.root_pattern("go.work", "go.mod", ".git"),
-- settings = {
-- gopls = {
-- analyses = {
-- unusedparams = true,
-- },
-- completeUnimported = true,
-- usePlaceholders = true,
-- staticcheck = true,
-- },
-- },
-- })
-- lspconfig.hls.setup({
-- on_attach = function(client, bufnr)
-- client.server_capabilities.documentFormattingProvider = false
-- client.server_capabilities.documentRangeFormattingProvider = false
-- on_attach(client, bufnr)
-- end,
--
-- on_init = on_init,
-- capabilities = capabilities,
-- })
lspconfig.lua_ls.setup({
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
enable = false, -- Disable all diagnostics from lua_ls
-- globals = { "vim" },
},
workspace = {
library = {
vim.fn.expand("$VIMRUNTIME/lua"),
vim.fn.expand("$VIMRUNTIME/lua/vim/lsp"),
vim.fn.stdpath("data") .. "/lazy/ui/nvchad_types",
vim.fn.stdpath("data") .. "/lazy/lazy.nvim/lua/lazy",
"${3rd}/love2d/library",
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
})
+4
View File
@@ -0,0 +1,4 @@
require("mason-conform").setup({
-- List of formatters to ignore during install
ignore_install = {},
})
+29
View File
@@ -0,0 +1,29 @@
local lint = package.loaded["lint"]
-- List of linters to ignore during install
local ignore_install = {}
-- Helper function to find if value is in table.
local function table_contains(table, value)
for _, v in ipairs(table) do
if v == value then
return true
end
end
return false
end
-- Build a list of linters to install minus the ignored list.
local all_linters = {}
for _, v in pairs(lint.linters_by_ft) do
for _, linter in ipairs(v) do
if not table_contains(ignore_install, linter) then
table.insert(all_linters, linter)
end
end
end
require("mason-nvim-lint").setup({
ensure_installed = all_linters,
automatic_installation = true,
})
+27
View File
@@ -0,0 +1,27 @@
local lspconfig = package.loaded["lspconfig"]
-- List of servers to ignore during install
local ignore_install = {}
-- Helper function to find if value is in table.
local function table_contains(table, value)
for _, v in ipairs(table) do
if v == value then
return true
end
end
return false
end
-- Build a list of lsp servers to install minus the ignored list.
local all_servers = {}
for _, s in ipairs(lspconfig.servers) do
if not table_contains(ignore_install, s) then
table.insert(all_servers, s)
end
end
require("mason-lspconfig").setup({
ensure_installed = all_servers,
automatic_installation = false,
})
+35
View File
@@ -0,0 +1,35 @@
local options = {
ensure_installed = {
"bash",
"c",
"cmake",
"cpp",
"fish",
-- "go",
-- "gomod",
-- "gosum",
-- "gotmpl",
-- "gowork",
-- "haskell",
"lua",
"luadoc",
"make",
"markdown",
"odin",
"printf",
"python",
"toml",
"vim",
"vimdoc",
"yaml",
},
highlight = {
enable = true,
use_languagetree = true,
},
indent = { enable = true },
}
require("nvim-treesitter.configs").setup(options)
+33
View File
@@ -0,0 +1,33 @@
require("nvchad.mappings")
local map = vim.keymap.set
map("n", ";", ":", { desc = "CMD enter command mode" })
map("i", "jk", "<ESC>")
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
local keymap = vim.api.nvim_set_keymap
local opts = { noremap = true }
-- CMake
keymap("", "<leader>cg", ":CMakeGenerate<cr>", {})
keymap("", "<leader>cb", ":CMakeBuild<cr>", {})
keymap("", "<leader>cq", ":CMakeClose<cr>", {})
keymap("", "<leader>cc", ":CMakeClean<cr>", {})
keymap("", "<leader>nt", ":ToggleTerm<cr>", {})
function _G.set_terminal_keymaps()
local opts = {buffer = 0}
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
end
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
+13
View File
@@ -0,0 +1,13 @@
require("nvchad.options")
local o = vim.o
-- Indenting
o.shiftwidth = 4
o.tabstop = 4
o.softtabstop = 4
-- o.cursorlineopt ='both' -- to enable cursorline!
-- set filetype for .CBL COBOL files.
-- vim.cmd([[ au BufRead,BufNewFile *.CBL set filetype=cobol ]])
BIN
View File
Binary file not shown.
+2
View File
@@ -0,0 +1,2 @@
return {
"hrsh7th/cmp-cmdline"}
+3
View File
@@ -0,0 +1,3 @@
return {
"voldikss/vim-floaterm",
}
+2
View File
@@ -0,0 +1,2 @@
return {
"rafamadriz/friendly-snippets"}
+62
View File
@@ -0,0 +1,62 @@
return {
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("configs.treesitter")
end,
},
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("nvchad.configs.lspconfig").defaults()
require("configs.lspconfig")
end,
},
{
"williamboman/mason-lspconfig.nvim",
event = "VeryLazy",
dependencies = { "nvim-lspconfig" },
config = function()
require("configs.mason-lspconfig")
end,
},
{
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("configs.lint")
end,
},
{
"rshkarin/mason-nvim-lint",
event = "VeryLazy",
dependencies = { "nvim-lint" },
config = function()
require("configs.mason-lint")
end,
},
{
"stevearc/conform.nvim",
event = "BufWritePre",
config = function()
require("configs.conform")
end,
},
{
"zapling/mason-conform.nvim",
event = "VeryLazy",
dependencies = { "conform.nvim" },
config = function()
require("configs.mason-conform")
end,
},
}
+56
View File
@@ -0,0 +1,56 @@
local M = {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"saadparwaiz1/cmp_luasnip",
"L3MON4D3/LuaSnip",
},
}
M.config = function()
local cmp = require("cmp")
vim.opt.completeopt = { "menu", "menuone", "noselect" }
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lua" },
{ name = "luasnip" }, -- For luasnip users.
{ name = "orgmode" },
}, {
{ name = "buffer" },
{ name = "path" },
}),
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
end
return M
+17
View File
@@ -0,0 +1,17 @@
return {
"christoomey/vim-tmux-navigator",
cmd = {
"TmuxNavigateLeft",
"TmuxNavigateDown",
"TmuxNavigateUp",
"TmuxNavigateRight",
"TmuxNavigatePrevious",
},
keys = {
{ "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" },
{ "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" },
{ "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" },
{ "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" },
{ "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" },
},
}
+1
View File
@@ -0,0 +1 @@
return { "akinsho/toggleterm.nvim", version = "*" }
+3
View File
@@ -0,0 +1,3 @@
return {
"cdelledonne/vim-cmake",
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 566 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 602 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 650 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 606 KiB