Skip to content

Commit

Permalink
Feat: Add nvim-treesitter and other TS-related plugins:
Browse files Browse the repository at this point in the history
- ts-comments.nvim to replace tcomment for comment handling (gcc map)
- nvim-treesitter-context to show code context as the buffer is scrolled
- indent-blankline.nvim to show indentation and scope guides
- rainbow-delimiters.nvim to color-match delimiters
- render-markdown.nvim for markdown rendering
  • Loading branch information
vicnett committed Nov 14, 2024
1 parent 9fa4656 commit 7f90ba0
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 3 deletions.
7 changes: 7 additions & 0 deletions vim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
"bullets.vim": { "branch": "master", "commit": "2253f970e54320dbd76fd6bb4f5a0bf2436ce232" },
"csv.vim": { "branch": "master", "commit": "bddfcbadd788ab11eb3dbba4550a38a412fe3705" },
"gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" },
"indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"mini.icons": { "branch": "main", "commit": "54686be7d58807906cb2c8c2216e0bf9c044f19a" },
"nvim-highlight-colors": { "branch": "main", "commit": "e967e2ba13fd4ca731b41d0e5cc1ac2edcd6e25e" },
"nvim-solarized-lua": { "branch": "master", "commit": "d69a263c97cbc765ca442d682b3283aefd61d4ac" },
"nvim-treesitter": { "branch": "master", "commit": "e1e3108cd23d7f967842261bd66126b6734d8907" },
"nvim-treesitter-context": { "branch": "master", "commit": "158377d700596367a91ea41818f76abdbf75a232" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "f22496dfdd46da4d571f5254c72eff65ff5a1c27" },
"render-markdown.nvim": { "branch": "main", "commit": "82184c4a3c3580a7a859b2cb7e58f16c10fd29ef" },
"tcomment_vim": { "branch": "master", "commit": "48ab639a461d9b8344f7fee06cb69b4374863b13" },
"ts-comments.nvim": { "branch": "main", "commit": "2002692ad1d3f6518d016550c20c2a890f0cbf0e" },
"vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" },
"vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" },
"vim-gutentags": { "branch": "master", "commit": "aa47c5e29c37c52176c44e61c780032dfacef3dd" },
Expand Down
6 changes: 6 additions & 0 deletions vim/lua/plugins/comments.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
return {
"folke/ts-comments.nvim",
opts = {},
event = "VeryLazy",
enabled = vim.fn.has("nvim-0.10.0") == 1,
}
3 changes: 3 additions & 0 deletions vim/lua/plugins/context.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {
"nvim-treesitter/nvim-treesitter-context",
}
56 changes: 56 additions & 0 deletions vim/lua/plugins/indent-blankline.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
return {
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
---@module "ibl"
---@type ibl.config

config = function()
-- Set line colors to be ones from Solarized
local highlight = {
"SolarizedMagenta",
"SolarizedYellow",
"SolarizedBlue",
"SolarizedOrange",
"SolarizedGreen",
"SolarizedViolet",
"SolarizedCyan",
}

local hooks = require("ibl.hooks")
-- create the highlight groups in the highlight setup hook, so they are
-- reset every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "SolarizedMagenta", { fg = "#D33682" })
vim.api.nvim_set_hl(0, "SolarizedYellow", { fg = "#B58900" })
vim.api.nvim_set_hl(0, "SolarizedBlue", { fg = "#268BD2" })
vim.api.nvim_set_hl(0, "SolarizedOrange", { fg = "#CB4B16" })
vim.api.nvim_set_hl(0, "SolarizedGreen", { fg = "#859900" })
vim.api.nvim_set_hl(0, "SolarizedViolet", { fg = "#6C71C4" })
vim.api.nvim_set_hl(0, "SolarizedCyan", { fg = "#2AA198" })
end)

-- Sync highlight colors with rainbow_delimiters
vim.g.rainbow_delimiters = { highlight = highlight }

local default_config = require("ibl.config").default_config
require("ibl").setup({
-- Don't enable by default, so as to not distract with rainbow colors
-- unless needed
enabled = false,
scope = { highlight = highlight },
indent = {
highlight = highlight,
-- Use default char instead of following listchars
char = default_config.indent.tab_char,
},
})

-- Sync scope line color with rainbow-delimiters
hooks.register(
hooks.type.SCOPE_HIGHLIGHT,
hooks.builtin.scope_highlight_from_extmark
)
end,
},
}
3 changes: 3 additions & 0 deletions vim/lua/plugins/rainbow-delimiters.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {
"https://gitlab.com/HiPhish/rainbow-delimiters.nvim",
}
8 changes: 8 additions & 0 deletions vim/lua/plugins/render-markdown.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
return {
"MeanderingProgrammer/render-markdown.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"echasnovski/mini.icons",
},
opts = {},
}
3 changes: 0 additions & 3 deletions vim/lua/plugins/tcomment.lua

This file was deleted.

11 changes: 11 additions & 0 deletions vim/lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
})
end,
}

0 comments on commit 7f90ba0

Please sign in to comment.