Move to NvChad 3.5; move repository path to a variable.

This commit is contained in:
Bartek Stalewski 2024-03-30 00:33:15 +01:00
parent 447a1f0511
commit af1740df8d
No known key found for this signature in database
21 changed files with 290 additions and 20 deletions

6
_cli/nvim/.stylua.toml Normal file
View File

@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "None"

39
_cli/nvim/init.lua Normal file
View File

@ -0,0 +1,39 @@
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)

30
_cli/nvim/lua/chadrc.lua Normal file
View File

@ -0,0 +1,30 @@
-- This file needs to have same structure as nvconfig.lua
-- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvconfig.lua
---@type ChadrcConfig
local M = {}
M.ui = {
theme = "monekai",
hl_override = {
ColorColumn = { bg = "#770000" },
Comment = { italic = true, },
DiffChange = { bg = "NONE", fg = "#e7c547" },
DiffText = { bg = "NONE", fg = "#ff8700" },
FoldColumn = { bg = "NONE" },
NonText = { bg = "NONE" },
Normal = { bg = "NONE" },
NormalFloat = { bg = "NONE" },
SignColumn = { bg = "NONE" },
SpellBad = { bg = "#770000", fg = "#ffffff" },
TelescopeNormal = { bg = "NONE" },
Visual = { bg = "#0094d8", fg = "#ffffff" },
},
statusline = {
theme = "vscode_colored",
}
}
return M

View File

@ -0,0 +1,15 @@
local options = {
formatters_by_ft = {
lua = { "stylua" },
-- css = { "prettier" },
-- html = { "prettier" },
},
-- 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,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",
},
},
},
}

View File

@ -0,0 +1,23 @@
-- EXAMPLE
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"
local servers = {}
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
}
end
-- typescript
lspconfig.tsserver.setup {
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
}

View File

@ -0,0 +1,20 @@
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
map("i", "jk", "<ESC>")
map("i", "<C-a>", "<esc>I" )
map("i", "<C-e>", "<esc>A" )
map("n", ";", ":", { desc = "CMD enter command mode" })
map("n", "<esc><cr>", "<esc><cmd>wq!<cr>", { desc = "Save and Exit" })
map("n", "<leader>m", '<cmd>execute "set colorcolumn=" . (&colorcolumn == "" ? "80,120" : "")<cr>', { desc = "Toggle Column" })
map("n", "<leader>h", "<cmd>set hlsearch!<cr>", { desc = "Toggle hlsearch" })
map("n", "<leader>j", "<cmd>bprevious<cr>", { desc = "Buffer Previous" })
map("n", "<leader>k", "<cmd>bnext<cr>", { desc = "Buffer Next" })
map("n", "<leader>n", '<cmd>set number!<cr><cmd>IBLToggle<cr><cmd>execute "set signcolumn=" . (&signcolumn == "yes" ? "no" : "yes")<cr>', { desc = "Toggle Decorations" })
map("n", "<leader>w", "<cmd>lua require('whitespace-nvim').trim()<cr>", { desc = "Trim Trailing Whitespaces" })
map("n", "<leader>x", "<cmd>bd<cr>", { desc = "Buffer Close" })
map("n", "<tab>", "<C-w>w", { desc = "Switch buffer" })

27
_cli/nvim/lua/options.lua Normal file
View File

@ -0,0 +1,27 @@
require "nvchad.options"
-- add yours here!
local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!
o.gdefault = true
o.hlsearch = false
o.shiftround = true
o.relativenumber = false
o.wrap = true
o.writebackup = false
o.clipboard = ""
o.foldcolumn = "0"
o.mouse = ""
o.whichwrap = ''
local autocmd = vim.api.nvim_create_autocmd
autocmd("BufRead", {
pattern = "*.gotmpl",
command = "set filetype=yaml",
})
autocmd("BufNewFile", {
pattern = "*.gotmpl",
command = "set filetype=yaml",
})

View File

@ -0,0 +1,66 @@
return {
{
"stevearc/conform.nvim",
-- event = 'BufWritePre', -- uncomment for format on save
config = function()
require "configs.conform"
end,
},
-- These are some examples, uncomment them if you want to see them work!
-- {
-- "neovim/nvim-lspconfig",
-- config = function()
-- require("nvchad.configs.lspconfig").defaults()
-- require "configs.lspconfig"
-- end,
-- },
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"lua-language-server",
},
},
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"lua",
"markdown",
"markdown_inline",
"python",
"terraform",
"vim",
"yaml",
},
},
},
-- Install a plugin
-- {
-- "max397574/better-escape.nvim",
-- event = "InsertEnter",
-- config = function()
-- require("better_escape").setup()
-- end
-- },
-- 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,
-- }
}

View File

@ -1,36 +1,33 @@
#!/bin/sh #!/bin/sh
# clean + prepare local dirs # variables
rm -rf ~/.cache ~/.config/_cache /tmp/${USER}-cache GIT_DIR=~/.local/git
rm -rf ~/.fdignore ~/.fzf.bash ~/.fzf.zsh ~/.gitconfig ~/.gitignore ~/.history ~/.tmux.conf ~/.vim* ~/.zcomp* ~/.zsh*
mkdir -p /tmp/${USER}-cache/ ~/.config ~/.local/bin ~/.local/share
chmod 700 /tmp/${USER}-cache
# export XDG stuff for later use
export XDG_CACHE_HOME=/tmp/${USER}-cache export XDG_CACHE_HOME=/tmp/${USER}-cache
export XDG_CONFIG_HOME=$HOME/.config export XDG_CONFIG_HOME=$HOME/.config
export XDG_DATA_HOME=$HOME/.local/share export XDG_DATA_HOME=$HOME/.local/share
export XDG_STATE_HOME=$HOME/.local/state export XDG_STATE_HOME=$HOME/.local/state
# prepare repository # clean + prepare local dirs
mkdir -p ~/.local/git rm -rf ~/.cache ~/.config/_cache $XDG_CACHE_HOME
rm -rf ~/.local/git/dotfiles
git clone https://git.insomniac.pl/ftpd/dotfiles ~/.local/git/dotfiles
# nvim
rm -rf ~/.config/nvim ~/.local/share/nvim ~/.local/state/nvim rm -rf ~/.config/nvim ~/.local/share/nvim ~/.local/state/nvim
git clone --depth 1 https://github.com/AstroNvim/AstroNvim $XDG_CONFIG_HOME/nvim rm -rf ~/.fdignore ~/.fzf.bash ~/.fzf.zsh ~/.gitconfig ~/.gitignore ~/.history ~/.tmux.conf ~/.vim* ~/.zcomp* ~/.zsh*
ln -sf ~/.local/git/dotfiles/astronvim $XDG_CONFIG_HOME/nvim/lua/user mkdir -p ~/.local/bin $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME
chmod 700 $XDG_CACHE_HOME
# prepare repository
mkdir -p $GIT_DIR
rm -rf $GIT_DIR/dotfiles
git clone https://git.insomniac.pl/ftpd/dotfiles $GIT_DIR/dotfiles
# zsh modules # zsh modules
mkdir -p ~/.local/git/zsh_modules mkdir -p $GIT_DIR/zsh_modules
rm -rf ~/.local/git/zsh_modules/* rm -rf $GIT_DIR/zsh_modules/*
for module in mfaerevaag/wd romkatv/powerlevel10k zdharma-continuum/fast-syntax-highlighting; do for module in mfaerevaag/wd romkatv/powerlevel10k zdharma-continuum/fast-syntax-highlighting; do
git clone https://github.com/${module} ~/.local/git/zsh_modules/${module#*/} git clone https://github.com/${module} $GIT_DIR/zsh_modules/${module#*/}
done done
# configs # configs
for i in ~/.local/git/dotfiles/_cli/*; do for i in $GIT_DIR/dotfiles/_cli/*; do
rm -rf $XDG_CONFIG_HOME/$(basename $i) rm -rf $XDG_CONFIG_HOME/$(basename $i)
ln -sf ~/.local/git/dotfiles/_cli/$(basename $i) $XDG_CONFIG_HOME/ ln -sf $GIT_DIR/dotfiles/_cli/$(basename $i) $XDG_CONFIG_HOME/
done done