upload custom (was weird before)

This commit is contained in:
Christoph J. Scherr 2024-01-19 22:34:37 +01:00
parent 72e3417ce0
commit 7f284d475d
Signed by: PlexSheep
GPG Key ID: 7CDD0B14851A08EF
9 changed files with 397 additions and 1 deletions

@ -1 +0,0 @@
Subproject commit 5195a38b1dfbbe7831e3dfcd0e3e07ac6ff05b58

20
lua/custom/chadrc.lua Normal file
View File

@ -0,0 +1,20 @@
---@type ChadrcConfig
local M = {}
-- Path to overriding theme and highlights files
local highlights = require "custom.highlights"
M.ui = {
theme = "kanagawa",
theme_toggle = { "kanagawa", "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

View File

@ -0,0 +1,24 @@
local options = {
lsp_fallback = true,
formatters_by_ft = {
lua = { "stylua" },
javascript = { "prettier" },
css = { "prettier" },
html = { "prettier" },
sh = { "shfmt" },
},
-- adding same formatter for multiple filetypes can look too much work for some
-- instead of the above code you could just use a loop! the config is just a table after all!
-- format_on_save = {
-- -- These options will be passed to conform.format()
-- timeout_ms = 500,
-- lsp_fallback = true,
-- },
}
require("conform").setup(options)

View File

@ -0,0 +1,17 @@
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
local lspconfig = require "lspconfig"
-- 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.pyright.setup { blabla}

View File

@ -0,0 +1,59 @@
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,
},
},
},
}
return M

19
lua/custom/highlights.lua Normal file
View 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

9
lua/custom/init.lua Normal file
View File

@ -0,0 +1,9 @@
local opt = vim.opt
local g = vim.g
g.maplocalleader = ";"
opt.foldmethod = "indent"
opt.foldnestmax = 10
opt.foldlevel = 4
opt.signcolumn = "yes"
opt.spelllang = "en,de"
opt.clipboard = "" -- dont just use the system clipboard

176
lua/custom/mappings.lua Normal file
View File

@ -0,0 +1,176 @@
---@type MappingsTable
local M = {}
M.disabled = {
n = {
["<leader>h"] = "",
["<leader>ff"] = "",
["<C-a>"] = "",
["<C-s>"] = "",
},
}
M.lazygit = {
plugin = true,
n = {
["<leader>gg"] = { "<cmd> LazyGit <CR>", "Open LazyGit" },
},
}
M.clipboard = {
plugin = false,
n = {
["<leader>y"] = { '"+y', "yank to system" },
["<leader>Y"] = { '"+Y', "yank to system" },
["<leader>yy"] = { '"+y', "yank to system" },
},
v = {
["<leader>y"] = { '"+y', "yank to system" },
["<leader>Y"] = { '"+Y', "yank to system" },
["<leader>yy"] = { '"+y', "yank to system" },
},
}
M.telescope = {
plugin = true,
n = {
-- find
["<localleader>ff"] = { "<cmd> Telescope find_files <CR>", "Find files" },
["<localleader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "Find all" },
["<localleader>fw"] = { "<cmd> Telescope live_grep <CR>", "Live grep" },
["<localleader>fb"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
["<localleader>fh"] = { "<cmd> Telescope help_tags <CR>", "Help page" },
["<localleader>fo"] = { "<cmd> Telescope oldfiles <CR>", "Find oldfiles" },
["<localleader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
-- git
["<localleader>cm"] = { "<cmd> Telescope git_commits <CR>", "Git commits" },
["<localleader>gt"] = { "<cmd> Telescope git_status <CR>", "Git status" },
-- pick a hidden term
["<localleader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
-- theme switcher
["<localleader>th"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
["<localleader>ma"] = { "<cmd> Telescope marks <CR>", "telescope bookmarks" },
},
}
M.nvimtree = {
plugin = true,
n = {
-- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
["<F5>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
-- focus
["<localleader>e"] = { "<cmd> NvimTreeFocus <CR>", "Focus nvimtree" },
},
}
M.movements = {
plugin = false,
i = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["<C-b>"] = { "<HOME>", "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" },
},
n = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["H"] = { "<HOME>", "Beginning of line" },
["L"] = { "<End>", "End of line" },
},
v = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
-- go to beginning and end
["H"] = { "<HOME>", "Beginning of line" },
["L"] = { "<End>", "End of line" },
},
t = {
["<C-w>"] = {
vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true),
"Escape terminal mode",
},
},
}
M.edit = {
plugin = false,
n = {
-- easy newline
["OO"] = { "O<ESC>", "insert a line above", opts = { nowait = false } },
["oo"] = { "o<ESC>", "insert a line below", opts = { nowait = false } },
-- split and join lines
["<leader>jj"] = { "<cmd> join <CR>", "join lines" },
-- do something useful with the arrows
["<Up>"] = { "<cmd> move-2<CR>", "Move line up", opts = { expr = true } },
["<Down>"] = { "<cmd> move+<CR>", "Move line down", opts = { expr = true } },
["<LEFT>"] = { "<<", "Less indentation", opts = { expr = true } },
["<RIGHT>"] = { ">>", "More indentation", opts = { expr = true } },
-- format with conform
["<leader>ff"] = {
function()
require("conform").format()
end,
"formatting",
},
},
v = {
["<LEFT>"] = { "<gv", "Less indentation" },
["<RIGHT>"] = { ">gv", "More indentation" },
},
x = {
["<Up>"] = { "move'<-2<CR>gv=gv", "Move line up", opts = { expr = true } },
["<Down>"] = { "move'<-2<CR>gv=gv", "Move line down", opts = { expr = true } },
},
t = {
--big move
["<A-k>"] = { "<C-u>", "big step down" },
["<A-j>"] = { "<C-d>", "big step down" },
},
}
M.ui = {
plugin = false,
n = {
-- toggle wrap
["<leader>tw"] = {
function()
vim.opt_local.wrap = not vim.wo.wrap
vim.opt_local.breakindent = not vim.wo.breakindent
if vim.wo.colorcolumn == "" then
vim.opt_local.colorcolumn = tostring(vim.bo.textwidth)
else
vim.opt_local.colorcolumn = ""
end
end,
"toggle wrap",
},
},
}
-- more keybinds!
return M

73
lua/custom/plugins.lua Normal file
View File

@ -0,0 +1,73 @@
local overrides = require "custom.configs.overrides"
local utils = require "core.utils"
---@type NvPluginSpec[]
local plugins = {
-- Override plugin definition options
{
"neovim/nvim-lspconfig",
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end, -- Override to setup mason-lspconfig
},
-- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"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,
},
{
"stevearc/conform.nvim",
-- for users those who want auto-save conform + lazyloading!
-- event = "BufWritePre"
config = function()
require "custom.configs.conform"
end,
},
{
"ggandor/leap.nvim",
config = function()
require("leap").create_default_mappings()
end,
},
{
"kdheepak/lazygit.nvim",
keys = { "<leader>gg" },
cmd = "LazyGit",
-- optional for floating window border decoration
dependencies = {
"nvim-lua/plenary.nvim",
},
init = function()
require("core.utils").load_mappings "lazygit"
end,
},
{
"folke/which-key.nvim",
keys = { "<leader>", "<localleader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
},
}
return plugins