move to nvchad

This commit is contained in:
krolxon 2024-08-31 23:59:03 +05:30
parent 8ae44cd732
commit 87ce731d6e
41 changed files with 260 additions and 2235 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
plugin

6
.stylua.toml Normal file
View File

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

16
LICENSE
View File

@ -1,16 +0,0 @@
The GPLv3 License (GPLv3)
Copyright (c) 2023 Author
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1,11 +1,6 @@
## Installation
```bash
# backup your current config
mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bak
### My nvchad config
# clone my configuration
git clone https://github.com/krolyxon/nvim.git ~/.config/nvim
```
### Thanks to [NvChad](https://github.com/nvchad/nvchad)
#### extra plugins added
1. rustaceanvim: for rust development.
2. crates.nvim: for rust dependencies lookup.
3. nvim-tetris: tetris game.

View File

@ -1,17 +1,47 @@
require("core.options")
require("core.utils").load_mappings()
require("core.autocmds")
-- require("ui").setup_colorscheme()
vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
vim.g.mapleader = " "
-- add binaries installed by mason.nvim to path
vim.env.PATH = vim.env.PATH .. ":" .. vim.fn.stdpath "data" .. "/mason/bin"
-- bootstrap lazy.nvim!
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
require("core.bootstrap").lazy(lazypath)
if not vim.uv.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)
require "plugins"
local lazy_config = require "configs.lazy"
-- load plugins
require("lazy").setup({
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
},
{ import = "plugins" },
}, lazy_config)
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "options"
require "nvchad.autocmds"
require("autocmds")
vim.schedule(function()
require "mappings"
end)

View File

@ -1,37 +1,31 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "ce0a05ab4e2839e1c48d072c5236cce846a387bc" },
"clangd_extensions.nvim": { "branch": "main", "commit": "bafed83f79b5779f5b43e8e015e13ca99dcd8b3a" },
"LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" },
"NvChad": { "branch": "v2.5", "commit": "b7a163e232524f1024a59a0a5c6ddf123530085c" },
"base46": { "branch": "v2.5", "commit": "1b4710eaaea14a3d1bfd9ba7724152bbf18e5bc6" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"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": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"codeium.vim": { "branch": "main", "commit": "5b8f68d5c0e32ae97d073a56ff14dba5646ec223" },
"crates.nvim": { "branch": "main", "commit": "3fc7ddac13ddf65914a733ef074317c4c72ef05b" },
"codeium.vim": { "branch": "main", "commit": "1513aef682a9b3363c0bf60292e6ddc781c716ce" },
"conform.nvim": { "branch": "master", "commit": "0ebe875d9c306f5fc829db38492ffff2a70d8e9d" },
"crates.nvim": { "branch": "main", "commit": "891063a2dc8471501b9742406a514be62a20c138" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"gitsigns.nvim": { "branch": "main", "commit": "f388995990aba04cfdc7c3ab870c33e280601109" },
"harpoon": { "branch": "master", "commit": "c1aebbad9e3d13f20bedb8f2ce8b3a94e39e424a" },
"indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" },
"kterm": { "branch": "main", "commit": "b587868af673cc4ddf6b1bd13d65dafbfd77383e" },
"lazy.nvim": { "branch": "main", "commit": "9d445ebbd89401544a538c6af080e4d2785abb49" },
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
"markdown.nvim": { "branch": "main", "commit": "4ab835985de62b46b6785ae160f5f709b77a0f92" },
"mason.nvim": { "branch": "main", "commit": "4546dec8b56bc56bc1d81e717e4a935bc7cd6477" },
"nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" },
"nvim-cmp": { "branch": "main", "commit": "8202df9561b90102b41dbc1ad71945534ef4ea39" },
"nvim-colorizer.lua": { "branch": "master", "commit": "760e27df4dd966607e8fb7fd8b6b93e3c7d2e193" },
"nvim-jdtls": { "branch": "master", "commit": "8eb5f0dbe6e126b392ddcaf45893358619893e45" },
"nvim-lspconfig": { "branch": "master", "commit": "01e08d4bf1c35e5126b2ad5209725e4c552289ab" },
"gitsigns.nvim": { "branch": "main", "commit": "899e993850084ea33d001ec229d237bc020c19ae" },
"indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"nvim-autopairs": { "branch": "master", "commit": "19606af7c039271d5aa96bceff101e7523af3136" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" },
"nvim-lspconfig": { "branch": "master", "commit": "3ad562700d0615818bf358268ac8914f6ce2b079" },
"nvim-tetris": { "branch": "master", "commit": "d17c99fb527ada98ffb0212ffc87ccda6fd4f7d9" },
"nvim-tree.lua": { "branch": "master", "commit": "78a9ca5ed6557f29cd0ce203df44213e54bfabb9" },
"nvim-treesitter": { "branch": "master", "commit": "5a8e9644c49f992f47bacd7900f4404df6fd9d38" },
"plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" },
"nvim-tree.lua": { "branch": "master", "commit": "d43ab67d0eb4317961c5e9d15fffe908519debe0" },
"nvim-treesitter": { "branch": "master", "commit": "64cc1ef764a0b137a642d05cacdfe1126124fb35" },
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
"rustaceanvim": { "branch": "master", "commit": "d3a8b145f0b3db4de9a08fcbc604659f52ee4fbc" },
"telescope.nvim": { "branch": "master", "commit": "74ce793a60759e3db0d265174f137fb627430355" },
"todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" },
"tokyonight.nvim": { "branch": "main", "commit": "e89caa3ad6d8da9d0dd981ec74a82c55adc61ffd" },
"undotree": { "branch": "master", "commit": "b6fdb95db53b7ceb23ddfe8a8211a3135d98eef0" },
"vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" },
"which-key.nvim": { "branch": "main", "commit": "5224c261825263f46f6771f1b644cae33cd06995" }
"telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" },
"ui": { "branch": "v2.5", "commit": "cd474496cdc41c833f6376eaf20e7c357b7a2e35" },
"which-key.nvim": { "branch": "main", "commit": "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0" }
}

View File

@ -1,21 +1,33 @@
local KrolyxonGroup = vim.api.nvim_create_augroup('Krolyxon', {})
local autocmd = vim.api.nvim_create_autocmd
-- Highlight on yank
autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank({
higroup = 'IncSearch',
vim.highlight.on_yank {
higroup = "IncSearch",
timeout = 40,
})
}
end,
})
-- Restore Cursor on file open
autocmd("BufReadPost", {
pattern = "*",
callback = function()
local line = vim.fn.line "'\""
if
line > 1
and line <= vim.fn.line "$"
and vim.bo.filetype ~= "commit"
and vim.fn.index({ "xxd", "gitrebase" }, vim.bo.filetype) == -1
then
vim.cmd 'normal! g`"'
end
end,
})
-- Remove trailing whitespaces on :w
autocmd({ "BufWritePre" }, {
group = KrolyxonGroup,
pattern = "*",
command = [[%s/\s\+$//e]],
})
@ -23,11 +35,11 @@ autocmd({ "BufWritePre" }, {
-- Don"t auto commenting new lines
autocmd("BufEnter", {
pattern = "",
command = "set fo-=c fo-=r fo-=o"
command = "set fo-=c fo-=r fo-=o",
})
-- spell check markdown and tex files
vim.cmd([[
vim.cmd [[
augroup spellCheck
autocmd!
autocmd Filetype plaintext setlocal spell
@ -37,18 +49,7 @@ vim.cmd([[
autocmd BufRead,BufNewFile *.Rmd setlocal spell
autocmd BufRead,BufNewFile *.tex setlocal spell
augroup END
]])
-- Run C/C++ fil
vim.api.nvim_buf_set_keymap(0, 'n', '<F5>', ':w<CR>:!gcc -o %:t:r % && ./%:t:r<CR>', { silent = true })
vim.api.nvim_buf_set_keymap(0, 'n', '<F6>', ':w<CR>:!g++ -o %:t:r % && ./%:t:r<CR>', { silent = true })
vim.api.nvim_buf_set_keymap(0, 'n', '<F7>',
':w<CR>:lua require("kterm.terminal").send("cp -f " .. vim.fn.expand("%") .. " /tmp; javac -d /tmp " .. vim.fn.expand("%") .. "; java -cp /tmp " .. vim.fn.expand("%:t:r"), "float")<CR>',
{ silent = true })
-- vim.api.nvim_buf_set_keymap(0, 'n', '<F5>', ":w<CR>:new | term . '!gcc %:p:h && ./a.out'<CR>:startinsert<CR>", {silent = true})
--
]]
local build_commands = {
c = "!g++ -std=c++17 -o %:p:r.o %",
@ -58,7 +59,7 @@ local build_commands = {
-- tex = "pdflatex %",
tex = "VimtexCompile",
javascript = "",
java = "!jrun %"
java = "!jrun %",
}
local debug_build_commands = {
@ -105,10 +106,10 @@ vim.api.nvim_create_user_command("Run", function()
for file, command in pairs(run_commands) do
if filetype == file then
vim.cmd("sp") -- Vertical split
vim.cmd "sp" -- Vertical split
-- vim.cmd("vs") -- Horizontal split
vim.cmd("term " .. command)
vim.cmd("resize 20N") -- Comment this if horizontal
vim.cmd "resize 20N" -- Comment this if horizontal
local keys = vim.api.nvim_replace_termcodes("i", true, false, true)
vim.api.nvim_feedkeys(keys, "n", false)
break
@ -117,11 +118,12 @@ vim.api.nvim_create_user_command("Run", function()
end, {})
vim.api.nvim_create_user_command("Ha", function()
vim.cmd([[Build]])
vim.cmd([[Run]])
vim.cmd [[Build]]
vim.cmd [[Run]]
end, {})
vim.api.nvim_create_user_command("Config", function() vim.cmd([[cd ~/.config/nvim]]) end, {})
vim.api.nvim_create_user_command("Config", function()
vim.cmd [[cd ~/.config/nvim]]
end, {})
vim.cmd [[ autocmd BufRead,BufNewFile *.slint set filetype=slint ]]

9
lua/chadrc.lua Normal file
View File

@ -0,0 +1,9 @@
---@type ChadrcConfig
local M = {}
M.base46 = {
theme = "tokyodark",
theme_toggle = { "tokyodark", "tokyonight" },
}
return M

15
lua/configs/conform.lua Normal file
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,
-- },
}
return options

View File

@ -1,10 +1,6 @@
return {
defaults = { lazy = true },
-- install = {
-- try to load one of these colorschemes when starting an installation during startup
-- colorscheme = { "rose-pine" },
-- },
install = { colorscheme = { "nvchad" } },
ui = {
icons = {
@ -24,6 +20,10 @@ return {
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
@ -33,7 +33,7 @@ return {
"vimballPlugin",
"zip",
"zipPlugin",
-- "tutor",
"tutor",
"rplugin",
"syntax",
"synmenu",

32
lua/configs/lspconfig.lua Normal file
View File

@ -0,0 +1,32 @@
-- load defaults i.e lua_lsp
require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig"
-- EXAMPLE
local servers = { "cssls", "jdtls", "slint_lsp" }
local nvlsp = require "nvchad.configs.lspconfig"
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
capabilities = nvlsp.capabilities,
}
end
-- Html lsp
lspconfig.html.setup {
on_attach = nvlsp.on_attach,
capabilities = nvlsp.capabilities,
init_option = { provideFormatter = true },
filetypes = { "htmldjango", "html" },
}
-- configuring single server, example: typescript
-- lspconfig.tsserver.setup {
-- on_attach = nvlsp.on_attach,
-- on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
-- }

View File

@ -1,28 +0,0 @@
local M = {}
M.lazy = function(install_path)
print "Bootstrapping lazy.nvim .."
vim.fn.system {
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
install_path,
}
vim.opt.rtp:prepend(install_path)
-- install plugins + compile their configs
require "plugins"
require("lazy").load { plugins = "nvim-treesitter" }
-- install binaries from mason.nvim & tsparsers on LazySync
vim.schedule(function()
vim.cmd "bw | silent! MasonInstallAll" -- close lazy window
end, 0)
end
return M

View File

@ -1,372 +0,0 @@
local M = {}
M.general = {
n = { ["<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" },
-- cycleling through buffers
["tk"] = { "<cmd> bnext <CR>", "Next buffer" },
["tj"] = { "<cmd> bprev <CR>", "Previous buffer" },
-- 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"', opts = { expr = true } },
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
-- new buffer
["<leader>b"] = { "<cmd> enew <CR>", "new buffer" },
-- close buffer + hide terminal buffer
["<leader>x"] = {
function()
require("core.utils").close_buffer()
end,
"close buffer",
},
["<leader>d"] = { "\"_d", "delete without copying into clipboard" },
-- motion keybinds
["<C-d>"] = { "<C-d>zz", "move forward half page" },
["<C-u>"] = { "<C-u>zz", "move backward half page" },
["n"] = { "nzzzv" },
["N"] = { "Nzzzv" },
["<leader>pv"] = { "<cmd> Ex <CR>", "File Tree" },
["<leader>ex"] = { "<cmd>!chmod +x %<CR>", "Make the current buffer script executable", opts = { silent = true } },
["<leader>s"] = { [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]] },
},
v = {
["<leader>d"] = { "\"_d", "delete without copying into clipboard" },
["J"] = { ":m '>+1<CR>gv=gv" },
["K"] = { ":m '<-2<CR>gv=gv" },
},
x = {
-- 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>', opts = { silent = true } },
},
}
M.kterm = {
plugin = true,
t = {
-- toggle in terminal mode
["<C-\\>"] = {
function()
require("kterm.terminal").toggle "float"
end,
"toggle floating term",
},
-- ["<A-h>"] = {
-- function()
-- require("kterm.terminal").toggle "horizontal"
-- end,
-- "toggle horizontal term",
-- },
--
-- ["<A-v>"] = {
-- function()
-- require("kterm.terminal").toggle "vertical"
-- end,
-- "toggle vertical term",
-- },
},
n = {
-- toggle in normal mode
["<C-\\>"] = {
function()
require("kterm.terminal").toggle "float"
end,
"toggle floating term",
},
-- ["<A-h>"] = {
-- function()
-- require("kterm.terminal").toggle "horizontal"
-- end,
-- "toggle horizontal term",
-- },
--
-- ["<A-v>"] = {
-- function()
-- require("kterm.terminal").toggle "vertical"
-- end,
-- "toggle vertical term",
-- },
},
}
M.nvimtree = {
plugin = true,
n = {
-- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
-- focus
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "Focus nvimtree" },
},
}
M.telescope = {
plugin = true,
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>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" },
-- theme switcher
["<leader>th"] = { "<cmd> Telescope colorscheme<CR>", "colorthemes" },
},
}
M.fugitive = {
plugin = true,
n = {
["<leader>gs"] = { "<cmd> Git <CR>", "Git" }
}
}
M.harpoon = {
plugin = true,
n = {
["<C-h>"] = { function() require("harpoon.ui").nav_file(1) end, "Harpoon File 1" },
["<C-j>"] = { function() require("harpoon.ui").nav_file(2) end, "Harpoon File 2" },
["<C-k>"] = { function() require("harpoon.ui").nav_file(3) end, "Harpoon File 3" },
["<C-l>"] = { function() require("harpoon.ui").nav_file(4) end, "Harpoon File 4" },
["<C-e>"] = { function() require("harpoon.ui").toggle_quick_menu() end, "Harpoon Toggle Quick Menu" },
["<leader>a"] = { function() require("harpoon.mark").add_file() end, "Harpoon Add File" },
}
}
M.undotree = {
plugin = true,
n = {
-- toggle
["<leader>u"] = { "<cmd> UndotreeToggle <CR>", "toggle undotree" },
},
}
M.whichkey = {
plugin = true,
n = {
["<leader>wK"] = {
function()
vim.cmd "WhichKey"
end,
"which-key all keymaps",
},
["<leader>wk"] = {
function()
local input = vim.fn.input "WhichKey: "
vim.cmd("WhichKey " .. input)
end,
"which-key query lookup",
},
},
}
M.comment = {
plugin = true,
-- toggle comment in both modes
n = {
["<leader>/"] = {
function()
require("Comment.api").toggle.linewise.current()
end,
"toggle comment",
},
},
v = {
["<leader>/"] = {
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
"toggle comment",
},
},
}
M.lspconfig = {
plugin = true,
-- See `<cmd> :help vim.lsp.*` for documentation on any of the below functions
n = {
["gD"] = {
function()
vim.lsp.buf.declaration()
end,
"lsp declaration",
},
["gd"] = {
function()
vim.lsp.buf.definition()
end,
"lsp definition",
},
["K"] = {
function()
vim.lsp.buf.hover()
end,
"lsp hover",
},
["gi"] = {
function()
vim.lsp.buf.implementation()
end,
"lsp implementation",
},
["<leader>ls"] = {
function()
vim.lsp.buf.signature_help()
end,
"lsp signature_help",
},
["<leader>D"] = {
function()
vim.lsp.buf.type_definition()
end,
"lsp definition type",
},
["<leader>ca"] = {
function()
vim.lsp.buf.code_action()
end,
"lsp code_action",
},
["gr"] = {
function()
vim.lsp.buf.references()
end,
"lsp references",
},
["<leader>f"] = {
function()
vim.diagnostic.open_float()
end,
"floating diagnostic",
},
["[d"] = {
function()
vim.diagnostic.goto_prev({ float = { border = "rounded" } })
end,
"goto prev",
},
["]d"] = {
function()
vim.diagnostic.goto_next({ float = { border = "rounded" } })
end,
"goto_next",
},
["<leader>q"] = {
function()
vim.diagnostic.setloclist()
end,
"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",
},
["<leader>wr"] = {
function()
vim.lsp.buf.remove_workspace_folder()
end,
"remove workspace folder",
},
["<leader>wl"] = {
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end,
"list workspace folders",
},
},
}
M.rust = {
plugin = true,
n = {
["<leader>rr"] = { "<cmd> RustRun<CR>", "RustRun" },
["<leader>roc"] = { "<cmd> RustOpenCargo <CR>", "RustLsp openCargo" },
},
}
M.blankline = {
plugin = true,
n = {
["<leader>cc"] = {
function()
local ok, start = require("indent_blankline.utils").get_current_context(
vim.g.indent_blankline_context_patterns,
vim.g.indent_blankline_use_treesitter_scope
)
if ok then
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
vim.cmd [[normal! _]]
end
end,
"Jump to current_context",
},
},
}
return M

View File

@ -1,47 +0,0 @@
local opt = vim.opt
local g = vim.g
opt.laststatus = 3 -- global statusline
opt.cmdheight = 1
opt.clipboard = "unnamedplus"
opt.cul = true -- cursor line
opt.mouse = opt.mouse + "nv" -- mouse scrolling
opt.ignorecase = true
opt.smartcase = true
opt.showmode = false
opt.incsearch = true
-- numbers
opt.number = true
opt.numberwidth = 2
opt.relativenumber = true
opt.ruler = false
opt.colorcolumn = "100"
-- indentline
opt.expandtab = true
opt.shiftwidth = 4
opt.smartindent = true
-- 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 nvim intro
opt.shortmess:append "sI"
opt.signcolumn = "yes"
opt.termguicolors = true
opt.timeoutlen = 400
opt.swapfile = false
opt.undodir = vim.fn.expand('~/.local/share/nvim/undodir')
opt.undofile = true
-- netrw settings
vim.g.netrw_browse_split = 0
vim.g.netrw_banner = 0
vim.g.netrw_winsize = 25
-- interval for writing swap file to disk, also used by gitsigns
opt.updatetime = 250

View File

@ -1,74 +0,0 @@
local M = {}
local merge_tb = vim.tbl_deep_extend
M.close_buffer = function(bufnr)
if vim.bo.buftype == "terminal" then
vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide")
else
bufnr = bufnr or vim.api.nvim_get_current_buf()
vim.cmd("confirm bd" .. bufnr)
end
end
M.load_mappings = function(section, mapping_opt)
local function set_section_map(section_values)
if section_values.plugin then
return
end
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 {})
mapping_info.opts, opts.mode = nil, nil
opts.desc = mapping_info[2]
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end
end
local mappings = require("core.mappings")
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
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 ~= ""
if condition then
vim.api.nvim_del_augroup_by_name("BeLazyOnFileOpen" .. plugin)
-- 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 }
if plugin == "nvim-lspconfig" then
vim.cmd "silent! do FileType"
end
end)
else
require("lazy").load { plugins = plugin }
end
end
end,
})
end
return M

15
lua/mappings.lua Normal file
View File

@ -0,0 +1,15 @@
require "nvchad.mappings"
-- add yours here
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>")
-- Flaoting Terminal
map({ "n", "t" }, "<C-\\>", function()
require("nvchad.term").toggle { pos = "float", id = "floatTerm" }
end, { desc = "terminal toggle floating term" })

5
lua/options.lua Normal file
View File

@ -0,0 +1,5 @@
require "nvchad.options"
local o = vim.o
o.cursorlineopt = "both" -- to enable cursorline!
o.shiftwidth = 4

View File

@ -1,29 +0,0 @@
local clangd = require("clangd_extensions");
local options = {
server = {
filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" },
single_file_support = true,
on_attach = require("plugins.configs.lspconfig").on_attach,
capabilities = require("plugins.configs.lspconfig").capabilities,
root_dir = vim.loop.cwd,
-- The command that starts the language server (Has nothing to do with compiling)
cmd = {
"clangd",
-- NOTE: don't remove this if you don't want errors
"--offset-encoding=utf-16",
"-j=4",
"--background-index",
"--clang-tidy",
"--fallback-style=llvm",
"--all-scopes-completion",
"--completion-style=detailed",
"--header-insertion=iwyu",
"--header-insertion-decorators",
"--pch-storage=memory",
},
-- init_option = { fallbackFlags = { "-std=c++2a" } }
}
}
clangd.setup(options)

View File

@ -1,131 +0,0 @@
local cmp = require("cmp")
-- require("ui").load_highlight "cmp"
local function border(hl_name)
return {
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
}
end
local options = {
completion = {
completeopt = "menu,menuone",
},
window = {
completion = {
border = border "CmpBorder",
winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None",
scrollbar = false,
},
documentation = {
border = border "CmpDocBorder",
},
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
formatting = {
format = function(_, vim_item)
local icons = {
Namespace = "󰌗",
Text = "󰉿",
Method = "󰆧",
Function = "󰆧",
Constructor = "",
Field = "󰜢",
Variable = "󰀫",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "󰑭",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈚",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "󰙅",
Event = "",
Operator = "󰆕",
TypeParameter = "󰊄",
Table = "",
Object = "󰅩",
Tag = "",
Array = "[]",
Boolean = "",
Number = "",
Null = "󰟢",
String = "󰉿",
Calendar = "",
Watch = "󰥔",
Package = "",
Copilot = "",
}
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(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "path" },
{ name = "crates" },
},
}
cmp.setup(options)

View File

@ -1,24 +0,0 @@
local options = {
terminals = {
list = {},
type_opts = {
float = {
relative = "editor",
row = 0.07,
col = 0.05,
width = 0.9,
height = 0.8,
border = "single",
},
horizontal = { location = "rightbelow", split_ratio = 0.4 },
vertical = { location = "rightbelow", split_ratio = 0.5 },
},
},
behavior = {
close_on_exit = true,
auto_insert = true,
},
enable_new_mappings = true,
}
require("kterm").setup(options)

View File

@ -1,205 +0,0 @@
local lspconfig = require("lspconfig")
local M = {}
local utils = require "core.utils"
-- export on_attach & capabilities for custom lspconfigs
M.on_attach = function(client, bufnr)
-- if vim.g.vim_version > 7 then
-- -- nightly
-- client.server_capabilities.documentFormattingProvider = false
-- client.server_capabilities.documentRangeFormattingProvider = false
-- else
-- -- stable
-- client.resolved_capabilities.document_formatting = false
-- client.resolved_capabilities.document_range_formatting = false
-- end
utils.load_mappings("lspconfig", { buffer = bufnr })
if client.server_capabilities.signatureHelpProvider then
local function lspSymbol(name, icon)
local hl = "DiagnosticSign" .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
end
lspSymbol("Error", "󰅙")
lspSymbol("Info", "󰋼")
lspSymbol("Hint", "󰌵")
lspSymbol("Warn", "")
vim.diagnostic.config {
virtual_text = {
prefix = "",
},
signs = true,
underline = true,
update_in_insert = false,
}
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "single",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "single",
focusable = false,
relative = "cursor",
})
-- suppress error messages from lang servers
vim.notify = function(msg, log_level)
if msg:match "exit code" then
return
end
if log_level == vim.log.levels.ERROR then
vim.api.nvim_err_writeln(msg)
else
vim.api.nvim_echo({ { msg } }, true, {})
end
end
-- Borders for LspInfo winodw
local win = require "lspconfig.ui.windows"
local _default_opts = win.default_opts
win.default_opts = function(options)
local opts = _default_opts(options)
opts.border = "single"
return opts
end
end
end
M.capabilities = vim.lsp.protocol.make_client_capabilities()
M.capabilities.textDocument.completion.completionItem = {
documentationFormat = { "markdown", "plaintext" },
snippetSupport = true,
preselectSupport = true,
insertReplaceSupport = true,
labelDetailsSupport = true,
deprecatedSupport = true,
commitCharactersSupport = true,
tagSupport = { valueSet = { 1 } },
resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
},
}
lspconfig.lua_ls.setup {
on_attach = M.on_attach,
capabilities = M.capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
[vim.fn.stdpath("data") .. "/lazy/lazy.nvim/lua/lazy"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
}
-- lspconfig.rust_analyzer.setup {
-- on_attach = M.on_attach,
-- capabilities = M.capabilities,
--
-- settings = {
-- tools = {
-- inlay_hints = {
-- auto = true,
-- show_parameter_hints = true,
-- },
-- },
-- }
-- }
lspconfig.clangd.setup {
filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" },
single_file_support = true,
on_attach = M.on_attach,
capabilities = M.capabilities,
root_dir = vim.loop.cwd,
-- init_option = { fallbackFlags = { "-std=c++2a" } }
}
lspconfig.html.setup {
on_attach = M.on_attach,
capabilities = M.capabilities,
init_option = { provideFormatter = true },
filetypes = { "htmldjango", "html" },
}
lspconfig.asm_lsp.setup {
on_attach = M.on_attach,
capabilities = M.capabilities,
init_option = { provideFormatter = true },
command = "asm-lsp",
filetypes = { "a", "s", "S", "asm" },
}
lspconfig.slint_lsp.setup {
on_attach = M.on_attach,
capabilities = M.capabilities,
init_option = { provideFormatter = true },
filetypes = { "slt", "slint" },
}
lspconfig.jdtls.setup {
on_attach = M.on_attach,
capabilities = M.capabilities,
init_option = {
provideFormatter = true,
init_options = {
-- extendedClientCapabilities = {
-- classFileContentsSupport = true,
-- generateToStringPromptSupport = true,
-- hashCodeEqualsPromptSupport = true,
-- advancedExtractRefactoringSupport = true,
-- advancedOrganizeImportsSupport = true,
-- generateConstructorsPromptSupport = true,
-- generateDelegateMethodsPromptSupport = true,
-- moveRefactoringSupport = true,
-- overrideMethodsPromptSupport = true,
-- executeClientCommandSupport = true,
-- inferSelectionSupport = {
-- 'extractMethod',
-- 'extractVariable',
-- 'extractConstant',
-- 'extractVariableAllOccurrence',
-- },
-- },
},
},
}
local servers = {
"marksman",
"taplo",
"pyright",
"cssls",
"tsserver",
}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = M.on_attach,
capabilities = M.capabilities,
}
end
return M

View File

@ -1,25 +0,0 @@
local options = {
PATH = "skip",
ui = {
icons = {
package_pending = "",
package_installed = "󰄳 ",
package_uninstalled = " 󰚌",
},
keymaps = {
toggle_server_expand = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
cancel_installation = "<C-c>",
},
},
max_concurrent_installers = 10,
}
require("mason").setup(options)

View File

@ -1,77 +0,0 @@
local options = {
filters = {
dotfiles = false,
exclude = { vim.fn.stdpath "config" .. "/lua/custom" },
},
-- disable_netrw = true,
hijack_netrw = true,
hijack_cursor = true,
hijack_unnamed_buffer_when_opening = false,
sync_root_with_cwd = true,
update_focused_file = {
enable = true,
update_root = false,
},
view = {
adaptive_size = false,
side = "left",
width = 30,
preserve_window_proportions = true,
},
git = {
enable = false,
ignore = true,
},
filesystem_watchers = {
enable = true,
},
actions = {
open_file = {
resize_window = true,
},
},
renderer = {
root_folder_label = false,
highlight_git = false,
highlight_opened_files = "none",
indent_markers = {
enable = false,
},
icons = {
show = {
file = true,
folder = true,
folder_arrow = true,
git = false,
},
glyphs = {
default = "󰈚",
symlink = "",
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
arrow_open = "",
arrow_closed = "",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
},
},
}
return options

View File

@ -1,90 +0,0 @@
local M = {}
M.autopairs = function()
local options = {
fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" },
}
require("nvim-autopairs").setup(options)
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
end
M.luasnip = function()
local options = {
history = true,
updateevents = "TextChanged,TextChangedI",
}
require("luasnip").config.set_config(options)
-- vscode format
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
require('luasnip.loaders.from_vscode').lazy_load({ paths = "~/.config/nvim/snippets/" })
-- 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()
if require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active
then
require("luasnip").unlink_current()
end
end,
})
end
M.gitsigns = function()
local options = {
signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = { hl = "GitSignsDelete", text = "󰍵", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
},
}
require("gitsigns").setup(options)
end
M.blankline = function()
local options = {
indentLine_enabled = 1,
char = "",
filetype_exclude = {
"help",
"terminal",
"alpha",
"lazy",
"lspinfo",
"TelescopePrompt",
"TelescopeResults",
"nvchad_cheatsheet",
"lsp-installer",
"",
},
buftype_exclude = { "terminal" },
show_trailing_blankline_indent = false,
show_first_indent_level = false,
}
require("indent_blankline").setup(options)
end
M.colorizer = function()
require("colorizer").setup()
-- execute colorizer as soon as possible
vim.defer_fn(function()
require("colorizer").attach_to_buffer(0)
end, 0)
end
return M

View File

@ -1,41 +0,0 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = {
{ "filename", path = 1, symbols = { modified = "", readonly = "", unnamed = "" } }
},
lualine_y = { 'progress' },
lualine_z = { 'location' }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}

View File

@ -1,57 +0,0 @@
vim.g.theme_switcher_loaded = true
local options = {
defaults = {
vimgrep_arguments = {
"rg",
"-L",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
}
local telescope = require("telescope")
-- check for any override
telescope.setup(options)

View File

@ -1,19 +0,0 @@
-- require("ui").load_highlight "treesitter"
local options = {
ensure_installed = {
"lua",
"rust",
"c",
"python",
},
highlight = {
enable = true,
use_languagetree = true,
},
indent = { enable = true },
}
require("nvim-treesitter.configs").setup(options)

View File

@ -1,31 +0,0 @@
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" },
},
}
require("which-key").setup(options)

View File

@ -1,371 +1,46 @@
-- All plugins have lazy = true by default, to load a plugin on startup just lazy=false
local plugins = {
-- { dir = "~/repos/krose-pine",
-- lazy = false,
-- priority = 1000,
-- config = function()
-- function ColorMyPencils(color)
-- color = color or "rose-pine"
-- vim.cmd.colorscheme(color)
--
-- vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
--
-- end
--
-- ColorMyPencils()
-- end
-- },
return {
{
"folke/tokyonight.nvim",
lazy = false,
init = function()
require("tokyonight").setup({
-- transparent = true,
style = "night"
})
vim.cmd.colorscheme("tokyonight-night")
end
},
{ 'nvim-lua/plenary.nvim' },
-- {
-- "nvim-treesitter/nvim-treesitter",
-- init = function()
-- require("core.utils").lazy_load "nvim-treesitter"
-- end,
-- cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSEnable", "TSDisable", "TSModuleInfo" },
-- build = ":TSUpdate",
-- config = function()
-- require "plugins.configs.treesitter"
-- end,
-- },
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate",
config = function()
require "plugins.configs.treesitter"
end,
},
{
"lewis6991/gitsigns.nvim",
ft = "gitcommit",
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.jobstart({ "git", "-C", vim.loop.cwd(), "rev-parse" },
{
on_exit = function(_, return_code)
if return_code == 0 then
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
vim.schedule(function()
require("lazy").load { plugins = { "gitsigns.nvim" } }
end)
end
end
}
)
end,
})
end,
config = function()
require("plugins.configs.others").gitsigns()
end,
},
-- Highlight todo, notes, etc in comments
{
'folke/todo-comments.nvim',
event = 'VimEnter',
dependencies = { 'nvim-lua/plenary.nvim' },
opts = { signs = false }
},
{
"tpope/vim-fugitive",
cmd = "Git",
init = function()
require("core.utils").load_mappings "fugitive"
end
},
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
cmd = "Telescope",
config = function()
require "plugins.configs.telescope"
-- require("telescope").setup()
end,
init = function()
require("core.utils").load_mappings "telescope"
end,
},
{
"ThePrimeagen/harpoon",
init = function()
require("core.utils").load_mappings "harpoon"
end
},
-- lsp stuff
{
"williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUninstall", "MasonUninstallAll", "MasonLog" },
config = function()
require "plugins.configs.mason"
local ensure_installed = { "lua-language-server", "rust-analyzer", "pyright", "clangd", "html-lsp" } -- not an option from mason.nvim
vim.api.nvim_create_user_command("MasonInstallAll", function()
vim.cmd("MasonInstall " .. table.concat(ensure_installed, " "))
end, {})
end,
"stevearc/conform.nvim",
-- event = "BufWritePre", -- uncomment for format on save
opts = require "configs.conform",
},
{
"neovim/nvim-lspconfig",
-- init = function()
-- require("core.utils").lazy_load "nvim-lspconfig"
-- end,
event = "User FilePost",
config = function()
require "plugins.configs.lspconfig"
require "configs.lspconfig"
end,
},
{
'mrcjkb/rustaceanvim',
version = '^5', -- Recommended
lazy = false, -- This plugin is already lazy
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
},
config = function()
require("core.utils").load_mappings "rust"
vim.g.rustaceanvim = {
tools = {
float_win_config = {
border = 'rounded'
}
},
}
end
},
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
config = function()
require("crates").setup()
-- Add crates.nvim to the cmp sources as soon as we load the plugin
require("cmp").setup.buffer({ sources = { { name = "crates" } } })
end,
},
{
"p00f/clangd_extensions.nvim",
ft = { "c", "cpp", "objc", "objcpp", "cuda", "proto" },
dependencies = "neovim/nvim-lspconfig",
config = function()
require("plugins.configs.clangd")
end
},
{
"mfussenegger/nvim-jdtls",
ft = "java",
config = function()
local config = {
cmd = { vim.fn.stdpath "data" .. "/mason/bin/jdtls" },
root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', '.git', 'mvnw' }, { upward = true })[1]),
}
require('jdtls').start_or_attach(config)
end,
},
-- load luasnips + cmp related in insert mode only
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{
-- snippet plugin
"L3MON4D3/LuaSnip",
dependencies = "rafamadriz/friendly-snippets",
config = function()
require("plugins.configs.others").luasnip()
end,
},
-- autopairing of (){}[] etc
{
"windwp/nvim-autopairs",
config = function()
require("plugins.configs.others").autopairs()
end,
},
-- cmp sources plugins
{
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
},
},
config = function()
require "plugins.configs.cmp"
end,
},
-- misc
--
{
'Exafunction/codeium.vim',
event = 'BufEnter'
},
-- {
-- 'vimwiki/vimwiki',
-- event = "VeryLazy",
-- init = function()
-- vim.g.vimwiki_list = {
-- {
-- path = '~/dox/brain/Notes',
-- syntax = 'markdown',
-- ext = '.md',
-- }
-- }
-- end,
-- "nvim-treesitter/nvim-treesitter",
-- opts = {
-- ensure_installed = {
-- "vim", "lua", "vimdoc",
-- "html", "css"
-- },
-- },
-- },
-- Misc
{
'MeanderingProgrammer/markdown.nvim',
ft = { "markdown" },
config = function()
require('render-markdown').setup({})
end,
},
{
"numToStr/Comment.nvim",
-- keys = { "gc", "gb" },
config = function()
require("Comment").setup()
end,
init = function()
require("core.utils").load_mappings "comment"
end,
},
{
"mbbill/undotree",
cmd = "UndotreeToggle",
init = function()
require("core.utils").load_mappings "undotree"
end,
},
{
"krolyxon/kterm",
config = function()
require "plugins.configs.kterm"
end,
init = function()
require("core.utils").load_mappings "kterm"
end,
},
-- UI stuff
{
"lukas-reineke/indent-blankline.nvim",
event = "BufRead",
config = function()
require("plugins.configs.others").blankline()
end,
init = function()
require("core.utils").lazy_load "indent-blankline.nvim"
require("core.utils").load_mappings "blankline"
end,
},
{
"nvchad/nvim-colorizer.lua",
init = function()
require("core.utils").lazy_load "nvim-colorizer.lua"
end,
config = function()
require("plugins.configs.others").colorizer()
end,
},
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
config = function()
require("plugins.configs.statusline")
end,
},
-- Only load whichkey after all the gui
{
"folke/which-key.nvim",
enabled = true,
keys = { "<leader>", "\"", "'", "`", "c", "v" },
cmd = "WhichKey",
config = function()
require "plugins.configs.whichkey"
end,
init = function()
require("core.utils").load_mappings "whichkey"
end,
},
{
"nvim-tree/nvim-tree.lua",
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
init = function()
require("core.utils").load_mappings "nvimtree"
end,
opts = function()
return require "plugins.configs.nvimtree"
end,
config = function(_, opts)
require("nvim-tree").setup(opts)
end,
"Exafunction/codeium.vim",
event = "BufEnter",
},
{
"alec-gibson/nvim-tetris",
cmd = { "Tetris" },
},
-- Crates version completion for rust
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
config = function()
require("crates").setup()
-- Add crates.nvim to the cmp sources as soon as we load the plugin
require("cmp").setup.buffer { sources = { { name = "crates" } } }
end,
},
}
-- pin commits for all default plugins
for _, value in pairs(plugins) do
value.pin = true
end
-- load lazy.nvim options
local lazy_config = require "plugins.configs.lazy_nvim"
require("lazy").setup(plugins, lazy_config)

19
lua/plugins/rust.lua Normal file
View File

@ -0,0 +1,19 @@
return {
"mrcjkb/rustaceanvim",
version = "^5", -- Recommended
lazy = false, -- This plugin is already lazy
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
},
config = function()
vim.g.rustaceanvim = {
tools = {
float_win_config = {
border = "rounded",
},
},
}
end,
}

View File

@ -0,0 +1,31 @@
return {
"mrcjkb/rustaceanvim",
version = "^5", -- Recommended
lazy = false, -- This plugin is already lazy
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
},
config = function()
vim.g.rustaceanvim = {
tools = {
float_win_config = {
border = "rounded",
},
},
}
end,
-- Crates version completion for rust
{
"Saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
config = function()
require("crates").setup()
-- Add crates.nvim to the cmp sources as soon as we load the plugin
require("cmp").setup.buffer { sources = { { name = "crates" } } }
end,
},
}

View File

@ -1,25 +0,0 @@
local M = {}
M.load_highlight = function(group)
-- if type(group) == "string" and group == "core" then
-- local syntax = require("ui.integrations.syntax")
-- local nvim = require("ui.integrations.nvim")
-- group = merge_tb("force", syntax, nvim)
-- end
if type(group) == "string" then
group = require("ui.integrations." .. group)
end
for hl, col in pairs(group) do
vim.api.nvim_set_hl(0, hl, col)
end
end
M.setup_colorscheme = function ()
-- vim.cmd('hi clear')
require("ui.term_hl")
require("ui").load_highlight "syntax"
require("ui").load_highlight "nvim"
end
return M

View File

@ -1,15 +0,0 @@
local theme = require("ui.kdark").colors
return {
CmpItemAbbr = { fg = theme.bright_black },
CmpItemAbbrMatch = { fg = theme.white, bold = true },
CmpItemAbbrDeprecated = { fg = theme.bright_black, strikethrough = true },
CmpItemAbbrMatchFuzzy = { fg = theme.white, bold = true },
CmpItemKind = { fg = theme.magenta },
CmpItemKindClass = { fg = theme.yellow },
CmpItemKindFunction = { fg = theme.magenta },
CmpItemKindInterface = { fg = theme.yellow },
CmpItemKindMethod = { fg = theme.magenta },
CmpItemKindSnippet = { fg = theme.magenta },
CmpItemKindVariable = { fg = theme.cyan },
}

View File

@ -1,99 +0,0 @@
local theme = require("ui.kdark").colors
return {
Comment = { fg = theme.bright_black },
SignColumn = {
bg = theme.black,
},
-- line number
LineNr = { fg = theme.bright_black },
CursorLineNr = { fg = theme.white },
CursorLine = {
bg = '#131313',
sp = "none",
},
-- those ugly ~'s
EndOfBuffer = { fg = theme.black },
-- floating windows
FloatBorder = { fg = theme.blue },
NormalFloat = { bg = theme.black },
-- Pmenu i.e completion menu
Pmenu = { bg = theme.black },
PmenuSbar = { bg = theme.black },
PmenuSel = { bg = '#26233a', fg = theme.white },
PmenuThumb = { bg = theme.bright_black },
-- nvim cmp
CmpItemAbbr = { fg = theme.white },
CmpItemAbbrMatch = { fg = theme.blue, bold = true },
CmpBorder = { fg = theme.bright_black },
CmpDocBorder = { fg = theme.bright_black },
NvimInternalError = { fg = theme.red },
WinSeparator = { fg = theme.bright_black },
-- Dashboard i.e alpha.nvim
AlphaHeader = { fg = theme.bright_black },
AlphaButtons = { fg = theme.bright_black },
-- Gitsigns.nvim
DiffAdd = {
fg = theme.blue,
},
DiffAdded = {
fg = theme.green,
},
DiffChange = {
fg = theme.bright_black,
},
DiffChangeDelete = {
fg = theme.red,
},
DiffModified = {
fg = theme.yellow,
},
DiffDelete = {
fg = theme.red,
},
DiffRemoved = {
fg = theme.red,
},
-- Indent blankline
IndentBlanklineChar = { fg = theme.bright_black },
IndentBlanklineSpaceChar = { fg = theme.bright_black },
-- Lsp Diagnostics
DiagnosticHint = { fg = theme.magenta },
DiagnosticError = { fg = theme.red },
DiagnosticWarn = { fg = theme.yellow },
DiagnosticInformation = { fg = theme.green },
-- StatusLine = {
-- fg = theme.white,
-- },
-- StatusLineNC = {
-- fg = theme.white,
-- },
-- StatusLineSeparator = {
-- fg = theme.bright_black,
-- },
-- StatusLineTerm = {
-- fg = theme.bright_black,
-- },
-- StatusLineTermNC = {
-- fg = theme.bright_black,
-- },
}

View File

@ -1,112 +0,0 @@
local theme = require("ui.kdark").colors
return {
Boolean = {
fg = theme.orange,
},
Character = {
fg = theme.magenta,
},
Conditional = {
fg = theme.magenta,
},
Constant = {
fg = theme.white,
},
Define = {
fg = theme.magenta,
sp = "none",
},
Delimiter = {
fg = theme.cyan,
},
Float = {
fg = theme.yellow,
},
Function = {
fg = theme.bright_blue,
},
Identifier = {
fg = theme.white,
sp = "none",
},
Include = {
fg = theme.bright_blue,
},
Keyword = {
fg = theme.magenta,
},
Label = {
fg = theme.yellow,
},
Number = {
fg = theme.yellow,
},
Operator = {
fg = theme.gray,
sp = "none",
},
PreProc = {
fg = theme.yellow,
},
Repeat = {
fg = theme.yellow,
},
Special = {
fg = theme.bright_blue,
},
SpecialChar = {
fg = theme.orange,
},
Statement = {
fg = theme.magenta,
},
StorageClass = {
fg = theme.yellow,
},
String = {
fg = theme.yellow,
},
Structure = {
fg = '#37908d',
},
Tag = {
fg = theme.yellow,
},
Todo = {
fg = theme.yellow,
bg = theme.bright_black,
},
Type = {
fg = theme.yellow,
sp = "none",
},
Typedef = {
fg = theme.yellow,
},
}

View File

@ -1,168 +0,0 @@
local theme = require("ui.kdark").colors
return {
TSAnnotation = {
fg = theme.orange,
sp = "none",
},
TSAttribute = {
fg = theme.bright_green,
sp = "none",
},
TSCharacter = {
fg = theme.magenta,
sp = "none",
},
TSConstBuiltin = {
fg = theme.bright_yellow,
sp = "none",
},
TSConstMacro = {
fg = theme.magenta,
sp = "none",
},
TSError = {
fg = theme.red,
sp = "none",
},
TSException = {
fg = theme.magenta,
sp = "none",
},
TSFloat = {
fg = theme.bright_yellow,
sp = "none",
},
TSFuncBuiltin = {
fg = theme.bright_blue,
sp = "none",
},
TSFuncMacro = {
fg = theme.magenta,
sp = "none",
},
TSKeywordOperator = {
fg = theme.bright_magenta,
sp = "none",
},
TSMethod = {
fg = theme.bright_blue,
sp = "none",
},
TSNamespace = {
fg = theme.magenta,
sp = "none",
},
TSNone = {
fg = theme.gray,
sp = "none",
},
TSParameter = {
fg = theme.magenta,
sp = "none",
},
TSParameterReference = {
fg = theme.gray,
sp = "none",
},
TSPunctDelimiter = {
fg = theme.orange,
sp = "none",
},
TSPunctSpecial = {
fg = theme.gray,
sp = "none",
},
TSStringRegex = {
fg = theme.cyan,
sp = "none",
},
TSStringEscape = {
fg = theme.cyan,
sp = "none",
},
TSSymbol = {
fg = theme.bright_green,
sp = "none",
},
TSTagDelimiter = {
fg = theme.orange,
sp = "none",
},
TSText = {
fg = theme.gray,
sp = "none",
},
TSStrong = {
bold = true,
},
TSEmphasis = {
fg = theme.base09,
sp = "none",
},
TSStrike = {
fg = theme.black,
sp = "none",
strikethrough = true,
},
TSLiteral = {
fg = theme.bright_magenta,
sp = "none",
},
TSURI = {
fg = theme.bright_magenta,
sp = "none",
underline = true,
},
TSTypeBuiltin = {
fg = theme.yellow,
sp = "none",
},
TSVariableBuiltin = {
fg = theme.bright_yellow,
sp = "none",
},
TSDefinition = {
sp = theme.blue,
underline = true,
},
TSDefinitionUsage = {
sp = theme.bright_black,
underline = true,
},
TSCurrentScope = {
bold = true,
},
}

View File

@ -1,44 +0,0 @@
local M = {}
M.colors= {
black = "#000000", -- base00
red = "#cd0000", -- base01
green = "#00cd00", -- base02
yellow = "#cdcd00", -- base03
blue = "#0000ee", -- base04
magenta = "#cd00cd", -- base05
cyan = "#00cdcd", -- base06
white = "#e5e5e5", -- base07
bright_black = "#7f7f7f", -- base08
bright_red = "#ff0000", -- base09
bright_green = "#00ff00", -- base0A
bright_yellow = "#ffff00", -- base0B
bright_blue = "#5c5cff", -- base0C
bright_magenta = "#ff00ff", -- base0D
bright_cyan = "#00ffff", -- base0E
bright_white = "#ffffff", -- base0F
orange = "#be5046",
gray = "#abb2bf",
}
-- M.colors= {
-- black = "#131313", -- base00
-- red = "#353b45", -- base01
-- green = "#3e4451", -- base02
-- yellow = "#545862", -- base03
-- blue = "#565c64", -- base04
-- magenta = "#abb2bf", -- base05
-- cyan = "#b6bdca", -- base06
-- white = "#c8ccd4", -- base07
-- bright_black = "#cd00cd", -- base08
-- bright_red = "#d19a66", -- base09
-- bright_green = "#cdcd00", -- base0A
-- bright_yellow = "#00ff00", -- base0B
-- bright_blue = "#56b6c2", -- base0C
-- bright_magenta = "#5c5cff", -- base0D
-- bright_cyan = "#cd00cd", -- base0E
-- bright_white = "#be5046", -- base0F
-- }
return M

View File

@ -1,18 +0,0 @@
local colors = require("ui.kdark").colors
vim.g.terminal_color_0 = "#" .. colors.black
vim.g.terminal_color_1 = "#" .. colors.red
vim.g.terminal_color_2 = "#" .. colors.green
vim.g.terminal_color_3 = "#" .. colors.yellow
vim.g.terminal_color_4 = "#" .. colors.blue
vim.g.terminal_color_5 = "#" .. colors.magenta
vim.g.terminal_color_6 = "#" .. colors.cyan
vim.g.terminal_color_7 = "#" .. colors.white
vim.g.terminal_color_8 = "#" .. colors.bright_black
vim.g.terminal_color_9 = "#" .. colors.bright_red
vim.g.terminal_color_10 = "#" .. colors.bright_green
vim.g.terminal_color_11 = "#" .. colors.bright_yellow
vim.g.terminal_color_12 = "#" .. colors.bright_blue
vim.g.terminal_color_13 = "#" .. colors.bright_magenta
vim.g.terminal_color_14 = "#" .. colors.bright_cyan
vim.g.terminal_color_15 = "#" .. colors.bright_white

View File

@ -1,16 +0,0 @@
{
"boilerplate": {
"prefix": "boilerplate",
"body": [
"\n.model small",
"\n.data",
"\n.code",
"\tmov ax, @data",
"\tmov ds, ax",
"\n\n\tmov ah, 4ch",
"\tint 21h",
"\tends",
"end"
]
}
}

View File

@ -1,13 +0,0 @@
{
"boilerplate": {
"prefix": "boilerplate",
"body": [
"#include <stdio.h>",
"\nint main(int argc, char *argv[])",
"{",
" $1",
" return 0;",
"}"
]
}
}

View File

@ -1,26 +0,0 @@
{
"name": "My snippets",
"contributes": {
"snippets": [
{
"language": [
"all"
],
"path": "./all.json"
},
{
"language": [
"c"
],
"path": "./c.json"
},
{
"language": [
"asm"
],
"path": "./asm.json"
}
]
}
}