HELLO NvChad
This commit is contained in:
3
lua/custom/README.md
Normal file
3
lua/custom/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Example_config
|
||||
|
||||
This can be used as an example custom config for NvChad. Do check the https://github.com/NvChad/nvcommunity
|
||||
20
lua/custom/chadrc.lua
Normal file
20
lua/custom/chadrc.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
---@type ChadrcConfig
|
||||
local M = {}
|
||||
|
||||
-- Path to overriding theme and highlights files
|
||||
local highlights = require "custom.highlights"
|
||||
|
||||
M.ui = {
|
||||
theme = "ashes",
|
||||
theme_toggle = { "ashes", "one_light" },
|
||||
|
||||
hl_override = highlights.override,
|
||||
hl_add = highlights.add,
|
||||
}
|
||||
|
||||
M.plugins = "custom.plugins"
|
||||
|
||||
-- check core.mappings for table structure
|
||||
M.mappings = require "custom.mappings"
|
||||
|
||||
return M
|
||||
30
lua/custom/configs/lspconfig.lua
Normal file
30
lua/custom/configs/lspconfig.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
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"
|
||||
|
||||
-- if you just want default config for the servers then put them in a table
|
||||
local servers = { "html", "cssls", "tsserver", "clangd" }
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
-- lspconfig.rust_analyzer.setup({
|
||||
-- on_attach = on_attach,
|
||||
-- capabilities = capabilities,
|
||||
-- filetypes = {"rust"},
|
||||
-- root_dir = util.root_pattern("Cargo.toml"),
|
||||
-- settings = {},
|
||||
-- ['rust-analyzer'] = {
|
||||
-- cargo = {
|
||||
-- allFeatures = true,
|
||||
-- }
|
||||
-- }
|
||||
-- })
|
||||
|
||||
--
|
||||
-- lspconfig.pyright.setup { blabla}
|
||||
21
lua/custom/configs/null-ls.lua
Normal file
21
lua/custom/configs/null-ls.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
local null_ls = require "null-ls"
|
||||
|
||||
local b = null_ls.builtins
|
||||
|
||||
local sources = {
|
||||
|
||||
-- webdev stuff
|
||||
b.formatting.deno_fmt, -- choosed deno for ts/js files cuz its very fast!
|
||||
b.formatting.prettier.with { filetypes = { "html", "markdown", "css" } }, -- so prettier works only on these filetypes
|
||||
|
||||
-- Lua
|
||||
b.formatting.stylua,
|
||||
|
||||
-- cpp
|
||||
b.formatting.clang_format,
|
||||
}
|
||||
|
||||
null_ls.setup {
|
||||
debug = true,
|
||||
sources = sources,
|
||||
}
|
||||
67
lua/custom/configs/overrides.lua
Normal file
67
lua/custom/configs/overrides.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
local cmp = require "cmp"
|
||||
|
||||
local M = {}
|
||||
|
||||
M.treesitter = {
|
||||
ensure_installed = {
|
||||
"vim",
|
||||
"lua",
|
||||
"html",
|
||||
"css",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"c",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
-- disable = {
|
||||
-- "python"
|
||||
-- },
|
||||
},
|
||||
}
|
||||
|
||||
M.mason = {
|
||||
ensure_installed = {
|
||||
-- lua stuff
|
||||
"lua-language-server",
|
||||
"stylua",
|
||||
|
||||
-- web dev stuff
|
||||
"css-lsp",
|
||||
"html-lsp",
|
||||
"typescript-language-server",
|
||||
"deno",
|
||||
"prettier",
|
||||
|
||||
-- c/cpp stuff
|
||||
"clangd",
|
||||
"clang-format",
|
||||
},
|
||||
}
|
||||
|
||||
-- git support in nvimtree
|
||||
M.nvimtree = {
|
||||
git = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
icons = {
|
||||
show = {
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- M.cmp = {
|
||||
-- mapping = {
|
||||
-- ["<A-Space>"] = cmp.mapping.complete(),
|
||||
-- }
|
||||
-- }
|
||||
|
||||
return M
|
||||
13
lua/custom/configs/rust-tools.lua
Normal file
13
lua/custom/configs/rust-tools.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
-- local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
-- local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
--
|
||||
-- local options = {
|
||||
-- server = {
|
||||
-- on_attach = vim.tbl_deep_extend("force", on_attach, {
|
||||
-- vim.keymap.set("n", "<leader>H", rt)
|
||||
-- },
|
||||
-- capabilities = capabilities,
|
||||
-- },
|
||||
-- }
|
||||
--
|
||||
-- return options
|
||||
19
lua/custom/highlights.lua
Normal file
19
lua/custom/highlights.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
-- To find any highlight groups: "<cmd> Telescope highlights"
|
||||
-- Each highlight group can take a table with variables fg, bg, bold, italic, etc
|
||||
-- base30 variable names can also be used as colors
|
||||
|
||||
local M = {}
|
||||
|
||||
---@type Base46HLGroupsList
|
||||
M.override = {
|
||||
Comment = {
|
||||
italic = true,
|
||||
},
|
||||
}
|
||||
|
||||
---@type HLTable
|
||||
M.add = {
|
||||
NvimTreeOpenedFolderName = { fg = "green", bold = true },
|
||||
}
|
||||
|
||||
return M
|
||||
11
lua/custom/init.lua
Normal file
11
lua/custom/init.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- Auto resize panes when resizing nvim window
|
||||
-- autocmd("VimResized", {
|
||||
-- pattern = "*",
|
||||
-- command = "tabdo wincmd =",
|
||||
-- })
|
||||
--
|
||||
local opt = vim.opt
|
||||
|
||||
opt.laststatus = 3
|
||||
67
lua/custom/mappings.lua
Normal file
67
lua/custom/mappings.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
---@type MappingsTable
|
||||
local M = {}
|
||||
|
||||
M.general = {
|
||||
i = {
|
||||
["<c-r>"] = { "<c-v>", "paste from OS without autopairing" },
|
||||
},
|
||||
n = {
|
||||
-- [";"] = { ":", "enter command mode", opts = { nowait = true } },
|
||||
["go"] = {
|
||||
function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end,
|
||||
"LSP formatting",
|
||||
},
|
||||
|
||||
["<leader>wv"] = { "<C-w>v", "Split vertical" },
|
||||
["<leader>ws"] = { "<C-w>s", "Split horizontal" },
|
||||
["<leader>wo"] = { "<C-w>o", "Maximize split" },
|
||||
["<leader>wc"] = { "<C-w>c", "Close split" },
|
||||
["<leader>w="] = { "w=", "Even splits" },
|
||||
["<leader>h"] = { "<C-w>h", "Focus left split" },
|
||||
["<leader>j"] = { "<C-w>j", "Focus lower split" },
|
||||
["<leader>k"] = { "<C-w>k", "Focus upper split" },
|
||||
["<leader>l"] = { "<C-w>l", "Focus right split" },
|
||||
["<leader>ee"] = { ':e <C-R>=expand("%:p:h" . "/" <CR><CR>)', "Copy relative path to file" },
|
||||
["<leader>er"] = { ":!echo -n % | pbcopy<CR>", "Copy absolute path to file" },
|
||||
["<leader>gn"] = { ":Telescope resume<CR>", "Resume telescope" },
|
||||
["<leader>eu"] = { '!!python -c "import uuid; print(uuid.uuid4())"<CR>', "Drop fresh uuid4" },
|
||||
["<c-c>"] = { '"+y', "Copy to OS clipboard" },
|
||||
|
||||
[",,"] = { ":w<CR>", "save" },
|
||||
["<leader> "] = { ":w<CR>", "save" },
|
||||
|
||||
[",z"] = { ":bnext<CR>", "Next buffer" },
|
||||
[",v"] = { ":bprevious<CR>", "Previous buffer" },
|
||||
["<leader>z"] = { ":bnext<CR>", "Next buffer" },
|
||||
["<leader>v"] = { ":bprevious<CR>", "Previous buffer" },
|
||||
|
||||
["<leader>n"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
|
||||
["<leader>N"] = { "<cmd> set nu! <CR>", "Toggle line number" },
|
||||
|
||||
["<leader>c"] = { "<cmd>bdelete<CR>", "Close Buffer" },
|
||||
["<leader>b"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
|
||||
|
||||
-- ["<A-Space>"] = cmp.mapping.complete(),
|
||||
},
|
||||
v = {
|
||||
[">"] = { ">gv", "indent" },
|
||||
["<c-c>"] = { '"+y', "Copy to OS clipboard" },
|
||||
},
|
||||
}
|
||||
|
||||
M.crates = {
|
||||
n = {
|
||||
["<leader>rcu"] = {
|
||||
function()
|
||||
require("crates").upgrade_all_crates()
|
||||
end,
|
||||
"Update crates",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- more keybinds!
|
||||
|
||||
return M
|
||||
146
lua/custom/plugins.lua
Normal file
146
lua/custom/plugins.lua
Normal file
@@ -0,0 +1,146 @@
|
||||
local overrides = require "custom.configs.overrides"
|
||||
|
||||
---@type NvPluginSpec[]
|
||||
local plugins = {
|
||||
|
||||
-- Override plugin definition options
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- format & linting
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
config = function()
|
||||
require "custom.configs.null-ls"
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
require "custom.configs.lspconfig"
|
||||
end, -- Override to setup mason-lspconfig
|
||||
},
|
||||
|
||||
-- override plugin configs
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = vim.tbl_deep_extend("force", overrides.mason, {
|
||||
ensure_installed = {
|
||||
"rust-analyzer",
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = overrides.treesitter,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
opts = overrides.nvimtree,
|
||||
},
|
||||
|
||||
-- Install a plugin
|
||||
{
|
||||
"max397574/better-escape.nvim",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("better_escape").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"elixir-tools/elixir-tools.nvim",
|
||||
version = "*",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local elixir = require "elixir"
|
||||
local elixirls = require "elixir.elixirls"
|
||||
|
||||
elixir.setup {
|
||||
nextls = { enable = true },
|
||||
credo = {},
|
||||
elixirls = {
|
||||
enable = true,
|
||||
settings = elixirls.settings {
|
||||
dialyzerEnabled = false,
|
||||
enableTestLenses = false,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", { buffer = true, noremap = true })
|
||||
vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", { buffer = true, noremap = true })
|
||||
vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", { buffer = true, noremap = true })
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"rust-lang/rust.vim",
|
||||
ft = "rust",
|
||||
init = function()
|
||||
vim.g.rustfmt_autosave = 1
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^3",
|
||||
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",
|
||||
dependencies = "hrsh7th/nvim-cmp",
|
||||
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 = "cartes" })
|
||||
return M
|
||||
end,
|
||||
},
|
||||
|
||||
{ "tpope/vim-surround", lazy = false },
|
||||
|
||||
-- To make a plugin not be loaded
|
||||
-- {
|
||||
-- "NvChad/nvim-colorizer.lua",
|
||||
-- enabled = false
|
||||
-- },
|
||||
|
||||
-- All NvChad plugins are lazy-loaded by default
|
||||
-- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
|
||||
-- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
|
||||
-- {
|
||||
-- "mg979/vim-visual-multi",
|
||||
-- lazy = false,
|
||||
-- }
|
||||
}
|
||||
|
||||
return plugins
|
||||
Reference in New Issue
Block a user