Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 57 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Neovim configuration
# :hammer_and_wrench: Neovim configuration

![commitlint](https://img.shields.io/github/actions/workflow/status/CelticBoozer/nvim-config/commitlint.yaml?branch=master&label=commitlint)
![StyLua](https://img.shields.io/github/actions/workflow/status/CelticBoozer/nvim-config/stylua.yaml?branch=master&label=StyLua)
Expand All @@ -17,11 +17,6 @@ file, LSP integration, and consistent style conventions).

1. **Install Neovim** (version >= 0.8) on your system.
2. **Clone this repo** into your config directory:

```bash
git clone https://github.com/CelticBoozer/nvim-config.git ~/.config/nvim
```
<!-- markdownlint-disable-file MD029 -->
3. Install plugin manager (lazy.nvim) will automatically setup on first launch.
4. Open Neovim and let it install plugins.
5. Install external dependencies listed below.
Expand Down Expand Up @@ -54,18 +49,62 @@ version control.
coloring.
- Quickkey Hints: which-key integration for discovering keybindings.

## 📚 Usage Examples
<!-- markdownlint-disable-file MD033 -->
- Open Telescope file search: <leader>ff
- Toggle NvimTree: <leader>te
- Git status (lazygit): <leader>gg
- LSP actions: <leader>aa for code actions, <leader>tl for diagnostics, etc.
- Color preview: Hex color codes will display actual colors via nvim-colorizer.lua
when opening relevant files.
## Hotkeys

| Group | Key(s) | Description |
|---------------------|----------------------|---------------------------------------|
| **File (⎈ f)** | `<leader>ff` | Find files (Telescope) |
| | `<leader>fr` | Recently opened files |
| | `<leader>fg` | Live grep |
| | `<leader>fb` | List buffers |
| | `<leader>fh` | Help tags |
| **Explorer (⎈ e)** | `<leader>e` | Toggle file tree |
| | `<leader>E` | Focus file tree |
| **Git (⎈ g)** | `<leader>gs` | Git status (Neogit) |
| | `<leader>gc` | Git commits |
| | `<leader>gb` | Git branches |
| | `<leader>gd` | Git diff |
| | `<leader>gp` | Git push |
| **LSP (⎈ l)** | `<leader>ld` | Go to definition |
| | `<leader>lh` | Hover documentation |
| | `<leader>li` | LSP info |
| | `<leader>lr` | Rename symbol |
| | `<leader>la` | Code action |
| | `<leader>lf` | Format document |
| | `<leader>le` | Show diagnostics |
| | `<leader>lq` | Set quickfix list |
| **Test/Debug (⎈ t)**| `<leader>tt` | Toggle test summary |
| | `<leader>tn` | Next test |
| | `<leader>tp` | Previous test |
| | `<leader>db` | Toggle breakpoint |
| | `<leader>dc` | Continue (debug) |
| | `<leader>dr` | Run to cursor |
| | `<leader>ds` | Step over |
| | `<leader>di` | Step into |
| **Search/Replace (⎈ s)** | `<leader>sr` | Replace in file |
| | `<leader>sR` | Replace in project |
| | `<leader>ss` | Search word under cursor |
| **Plugins (⎈ p)** | `<leader>pi` | Plugin install |
| | `<leader>pu` | Plugin update |
| | `<leader>ps` | Plugin sync |
| | `<leader>pc` | Plugin clean |

## :heart: Acknowledgements

I would like to thank the entire community, anyone who uses or is inspired by
my dotfiles. To everyone who inspired or helped me (I tried to indicate each
author in each script or file I borrowed fully or partially).

If you like this project and want to express your gratitude - star this
repository. Or you can donate.

[PLACE IMAGE HERE] – (e.g., screenshot of Neovim with this config)
### :star: Star history

## ⭐ Stay Updated
[![Star History Chart](https://api.star-history.com/svg?repos=CelticBoozer/nvim-config&type=Timeline&theme=dark)](https://star-history.com/#CelticBoozer/nvim-config&Timeline)

If you find this configuration helpful, consider starring the repo! Feedback
and suggestions are always appreciated.
### :coin: Donation
<!-- cSpell:disable -->
| ![USDT-TRC20](.github/assets/USDT.jpg) | ![BTC](.github/assets/BTC.jpg) | ![ETH](.github/assets/ETH.jpg) |
|:----------------------------------:|:------------------------------------------:|:------------------------------------------:|
| USDT TRC20 | BTC | ETH |
| TGhY5bCn12EDP3MGgs8Qg4YerczhP3PsC5 | bc1qru2p84r3zecva68e804jtjqp923mx2eekqwg3a | 0xb00d88737B0BD4f5cb5fc7519b3d27045b796ceb |
1 change: 1 addition & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- NOTE: Core initialization file for Neovim configuration. Requires and sets up modules.
require("core.options")
require("core.lazy")
require("core.functions")

-- Safe telescope extension loading
vim.api.nvim_create_autocmd("User", {
Expand Down
10 changes: 5 additions & 5 deletions lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"fine-cmdline.nvim": { "branch": "main", "commit": "aec9efebf6f4606a5204d49ffa3ce2eeb7e08a3e" },
"garbage-day.nvim": { "branch": "main", "commit": "750ef08ae6031ee3683014c5349144340c08ead6" },
"gitsigns.nvim": { "branch": "main", "commit": "8dec8da8ed8a4463cc6abcd3cc3801373600767d" },
"gitsigns.nvim": { "branch": "main", "commit": "ee28ba3e70ecea811b8f6d7b51d81976e94b121c" },
"gruvbox-material": { "branch": "master", "commit": "f5f912fbc7cf2d45da6928b792d554f85c7aa89a" },
"inc-rename.nvim": { "branch": "main", "commit": "87ebe7bee0b83d3b6e4f1494c74abed21b318175" },
"inc-rename.nvim": { "branch": "main", "commit": "726d28468e900e1172a04faeb7af0b18acd609e7" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" },
Expand All @@ -44,12 +44,12 @@
"nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" },
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
"nvim-lspconfig": { "branch": "master", "commit": "2e3f389aa06c7b7c29600ec2e67ee64c332077eb" },
"nvim-lspconfig": { "branch": "master", "commit": "94d0fec9135719e046903bbbbf8f39e3d3436d4e" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" },
"nvim-surround": { "branch": "main", "commit": "0e62500b98f4513feaaf7425c135472457ea5b7d" },
"nvim-tree.lua": { "branch": "master", "commit": "582ae48c9e43d2bcd55dfcc8e2e7a1f29065d924" },
"nvim-treesitter": { "branch": "master", "commit": "3b308861a8d7d7bfbe9be51d52e54dcfd9fe3d38" },
"nvim-treesitter": { "branch": "master", "commit": "94ea4f436d2b59c80f02e293466c374584f03b8c" },
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
"nvim-ufo": { "branch": "main", "commit": "cac999ec9f6302d2fd4ad8a846bf8f731af6e7cf" },
Expand All @@ -59,7 +59,7 @@
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" },
"reactive.nvim": { "branch": "master", "commit": "e0a22a42811ca1e7aa7531f931c55619aad68b5d" },
"render-markdown.nvim": { "branch": "main", "commit": "7f81e9dcc15504c044f20df39d28a590cd5c6ca5" },
"render-markdown.nvim": { "branch": "main", "commit": "8c33733b9af902250731539b2fe3920c76993765" },
"search.nvim": { "branch": "main", "commit": "7b8f2315d031be73e14bc2d82386dfac15952614" },
"sqls.nvim": { "branch": "main", "commit": "d1bc5421ef3e8edc5101e37edbb7de6639207a09" },
"statuscol.nvim": { "branch": "main", "commit": "a2580e009a3b4c51b5978768d907dafae2c919ac" },
Expand Down
5 changes: 5 additions & 0 deletions lua/core/functions.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank()
end,
})
1 change: 1 addition & 0 deletions lua/core/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ o.mousemoveevent = true
-- Basic color setup
o.termguicolors = true
o.background = "dark"
o.foldlevel = 99

vim.diagnostic.config({
severity_sort = true, -- Sort all diagnostics by severity
Expand Down
6 changes: 4 additions & 2 deletions lua/plugin/completion/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ return {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip",
{ "L3MON4D3/LuaSnip", build = "make install_jsregexp" },
"saadparwaiz1/cmp_luasnip",
"onsails/lspkind.nvim",
"windwp/nvim-autopairs",
Expand All @@ -31,8 +31,10 @@ return {
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ name = "cmdline" },
{ name = "luasnip" },
{ name = "dotenv" },
{ name = "supermaven" },
},
Expand Down
2 changes: 1 addition & 1 deletion lua/plugin/dap/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ return {
desc = "Step Out",
},
{
"<C-F8>",
"<leader>db",
function()
require("dap").toggle_breakpoint()
end,
Expand Down
2 changes: 2 additions & 0 deletions lua/plugin/syntax/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ return {
"javascript",
"json",
"lua",
"latex",
"markdown",
"markdown_inline",
"python",
"sql",
"toml",
Expand Down
2 changes: 1 addition & 1 deletion lua/plugin/ui/fine-cmd-line.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ return {
cmdline = {
enable_keymaps = true,
smart_history = true,
prompt = " 󰘳 ",
prompt = " > ",
},
popup = {
position = {
Expand Down
8 changes: 0 additions & 8 deletions lua/plugin/ui/gitsigns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,5 @@ return {
topdelete = { text = "‾" },
changedelete = { text = "~" },
},
on_attach = function(bufnr)
local gs = require("gitsigns")
vim.keymap.set("n", "<leader>hs", gs.stage_hunk, { buffer = bufnr, desc = "Stage hunk" })
vim.keymap.set("n", "<leader>hu", gs.undo_stage_hunk, { buffer = bufnr, desc = "Undo stage hunk" })
vim.keymap.set("n", "<leader>hr", gs.reset_hunk, { buffer = bufnr, desc = "Reset hunk" })
vim.keymap.set("n", "<leader>hR", gs.reset_buffer, { buffer = bufnr, desc = "Reset buffer" })
vim.keymap.set("n", "<leader>hp", gs.preview_hunk, { buffer = bufnr, desc = "Preview hunk" })
end,
},
}
25 changes: 1 addition & 24 deletions lua/plugin/ui/statuscol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,5 @@
return {
"luukvbaal/statuscol.nvim",
event = "VeryLazy",
dependencies = { "kevinhwang91/nvim-ufo" },
opts = {
setopt = true,
relculright = true,
segments = {
{
text = { "%C" },
click = "v:lua.ScFa",
condition = { true },
hl = "FoldColumn",
},
{
text = { "%s" },
click = "v:lua.ScSa",
hl = "SignColumn",
},
{
text = { " ", "", " " },
click = "v:lua.ScLa",
hl = { "LineNr", "Comment" },
condition = { true },
},
},
},
opts = {},
}
126 changes: 62 additions & 64 deletions lua/plugin/ui/ufo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,79 +3,77 @@

return {
"kevinhwang91/nvim-ufo",
event = "LspAttach",
dependencies = {
"kevinhwang91/promise-async",
dependencies = { "kevinhwang91/promise-async" },
event = { "BufReadPost", "BufNewFile" },
keys = {
{
"luukvbaal/statuscol.nvim",
config = function()
require("statuscol").setup({
foldfunc = "builtin",
setopt = true,
})
"zM",
function()
require("ufo").closeAllFolds()
end,
{ desc = "Close All Folds" },
},
{
"zR",
function()
require("ufo").openAllFolds()
end,
{ desc = "Open All Folds" },
},
},
opts = {
fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
local suffix = (" 󰁂 %d "):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0

for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, { chunkText, hlGroup })
chunkWidth = vim.fn.strdisplaywidth(chunkText)
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
open_fold_hl_timeout = 150,
filetype_exclude = { "help", "dashboard", "neo-tree", "Trouble", "lazy", "mason" },
preview = {
win_config = {
border = { "", "─", "", "", "", "─", "", "" },
winhighlight = "Normal:Folded",
winblend = 0,
},
mappings = {
scrollU = "<C-u>",
scrollD = "<C-d>",
jumpTop = "[",
jumpBot = "]",
},
},
-- luacheck: ignore 212 113
provider_selector = function(bufnr, filetype, buftype)
local ft_map = {
vim = "indent",
python = { "indent" },
git = "",
}
---@diagnostic disable-next-line: undefined-global
if ft_map[filetype] ~= nl then
return ft_map[filetype]
end
return function()
return require("ufo")
.getFolds(bufnr, "lsp")
:catch(function()
return require("ufo").getFolds(bufnr, "treesitter")
end)
:catch(function()
return require("ufo").getFolds(bufnr, "indent")
end)
end
table.insert(newVirtText, { suffix, "UfoFoldedEllipsis" })
return newVirtText
end,
provider_selector = function()
return { "treesitter", "indent" }
fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate)
local folded_lines = endLnum - lnum
virtText[#virtText + 1] = { (" ↙ %d lines "):format(folded_lines), "Folded" }
return virtText
end,
},
config = function(_, opts)
-- Workaround for auto-session conflict:
vim.api.nvim_create_autocmd("BufReadPost", {
callback = function()
if not pcall(require, "ufo") then
vim.notify("nvim-ufo failed to load", vim.log.levels.WARN)
return
end
require("ufo").setup(opts)
end,
})

-- Configure LSP folding capabilities
vim.o.foldcolumn = "1"
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]

-- Link custom highlight group
vim.api.nvim_set_hl(0, "UfoFoldedEllipsis", { link = "Comment" })

-- Key mappings for folding
vim.keymap.set("n", "zE", require("ufo").openAllFolds)
vim.keymap.set("n", "zC", require("ufo").closeAllFolds)
vim.keymap.set("n", "ze", require("ufo").openFoldsExceptKinds)
vim.keymap.set("n", "zc", function()
require("ufo").closeFoldsWith(1)
end, { desc = "Close current fold" })
local caps = vim.lsp.protocol.make_client_capabilities()
caps.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
for _, server in ipairs(vim.tbl_keys(require("lspconfig").servers or {})) do
require("lspconfig")[server].setup({ capabilities = caps })
end
require("ufo").setup(opts)
end,
}
Loading
Loading