My custom kickstart.nvim setup
This commit is contained in:
parent
1860184830
commit
c51b67a644
22 changed files with 1005 additions and 43 deletions
6
lua/custom/plugins/auto-tag.lua
Normal file
6
lua/custom/plugins/auto-tag.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
{
|
||||
'windwp/nvim-ts-autotag',
|
||||
after = 'nvim-treesitter',
|
||||
},
|
||||
}
|
||||
61
lua/custom/plugins/cattpuccin.lua
Normal file
61
lua/custom/plugins/cattpuccin.lua
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
-- Catppuccin is a Neovim theme plugin with flexible color schemes
|
||||
-- https://github.com/catppuccin/nvim
|
||||
|
||||
return {
|
||||
'catppuccin/nvim', -- GitHub repository
|
||||
as = 'catppuccin', -- Optional: rename the plugin to 'catppuccin'
|
||||
version = '*', -- Use the latest version
|
||||
dependencies = {
|
||||
'kyazdani42/nvim-web-devicons', -- Recommended for file icons
|
||||
},
|
||||
config = function()
|
||||
require('catppuccin').setup {
|
||||
flavour = 'frappe', -- Choose from "latte", "frappe", "macchiato", "mocha"
|
||||
background = {
|
||||
light = 'latte',
|
||||
dark = 'mocha',
|
||||
},
|
||||
transparent_background = false,
|
||||
show_end_of_buffer = true,
|
||||
term_colors = true,
|
||||
dim_inactive = {
|
||||
enabled = true,
|
||||
shade = 'dark',
|
||||
percentage = 0.15,
|
||||
},
|
||||
styles = {
|
||||
comments = { 'italic' },
|
||||
conditionals = { 'italic' },
|
||||
loops = {},
|
||||
functions = {},
|
||||
keywords = {},
|
||||
strings = {},
|
||||
variables = {},
|
||||
numbers = {},
|
||||
booleans = {},
|
||||
properties = {},
|
||||
types = {},
|
||||
operators = {},
|
||||
},
|
||||
color_overrides = {},
|
||||
custom_highlights = {},
|
||||
default_integrations = true,
|
||||
integrations = {
|
||||
cmp = true,
|
||||
gitsigns = true,
|
||||
nvimtree = true,
|
||||
treesitter = true,
|
||||
notify = false,
|
||||
mini = {
|
||||
enabled = true,
|
||||
indentscope_color = 'auto',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Set the colorscheme
|
||||
vim.cmd 'colorscheme catppuccin'
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
67
lua/custom/plugins/completion.lua
Normal file
67
lua/custom/plugins/completion.lua
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
-- ~/.config/nvim/lua/custom/plugins/completion.lua
|
||||
|
||||
return {
|
||||
-- Completion framework
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
config = function()
|
||||
local cmp = require 'cmp'
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn['vsnip#anonymous'](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<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.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif vim.fn == 1 then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>(vsnip-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 vim.fn['vsnip#jumpable'](-1) == 1 then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>(vsnip-jump-prev)', true, true, true), '')
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'vsnip' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
}),
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- LSP completion source
|
||||
{ 'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp' },
|
||||
|
||||
-- Buffer completion source
|
||||
{ 'hrsh7th/cmp-buffer', after = 'nvim-cmp' },
|
||||
|
||||
-- Path completion source
|
||||
{ 'hrsh7th/cmp-path', after = 'nvim-cmp' },
|
||||
|
||||
-- Snippet completion source
|
||||
{ 'hrsh7th/cmp-vsnip', after = 'nvim-cmp' },
|
||||
|
||||
-- Snippet engine
|
||||
{ 'hrsh7th/vim-vsnip', event = 'InsertEnter' },
|
||||
}
|
||||
3
lua/custom/plugins/dad-bod-completion.lua
Normal file
3
lua/custom/plugins/dad-bod-completion.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
'kristijanhusak/vim-dadbod-completion',
|
||||
}
|
||||
3
lua/custom/plugins/dadbod-ui.lua
Normal file
3
lua/custom/plugins/dadbod-ui.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
'kristijanhusak/vim-dadbod-ui',
|
||||
}
|
||||
3
lua/custom/plugins/dadbod.lua
Normal file
3
lua/custom/plugins/dadbod.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
'tpope/vim-dadbod',
|
||||
}
|
||||
118
lua/custom/plugins/dap.lua
Normal file
118
lua/custom/plugins/dap.lua
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
return {
|
||||
{
|
||||
'mfussenegger/nvim-dap',
|
||||
dependencies = {
|
||||
'leoluz/nvim-dap-go',
|
||||
'rcarriga/nvim-dap-ui',
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
'nvim-neotest/nvim-nio',
|
||||
'williamboman/mason.nvim',
|
||||
},
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
local ui = require 'dapui'
|
||||
|
||||
require('dapui').setup()
|
||||
require('dap-go').setup()
|
||||
require('nvim-dap-virtual-text').setup {}
|
||||
|
||||
-- Configuration for .NET Core (ASP.NET Core) using net8.0
|
||||
dap.adapters.coreclr = {
|
||||
type = 'executable',
|
||||
command = '/usr/local/bin/netcoredbg/netcoredbg', -- Update with the correct path to netcoredbg
|
||||
args = { '--interpreter=vscode' },
|
||||
}
|
||||
|
||||
dap.configurations.cs = {
|
||||
{
|
||||
type = 'coreclr',
|
||||
name = 'Launch ASP.NET Core',
|
||||
request = 'launch',
|
||||
preLaunchTask = function()
|
||||
-- Run the project before launching the debugger
|
||||
local build_cmd = 'dotnet publish --configuration Debug --runtime linux-x64 --self-contained'
|
||||
print('Running: ' .. build_cmd)
|
||||
vim.fn.system(build_cmd)
|
||||
end,
|
||||
program = function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
local dll = vim.fn.glob(cwd .. '/bin/Debug/net8.0/linux-x64/MelodyFitnessApi.dll', 0, 1)
|
||||
if #dll == 0 then
|
||||
print 'No DLL found in bin/Debug/net8.0/linux-x64'
|
||||
return ''
|
||||
end
|
||||
print('Using program: ' .. dll[1])
|
||||
return dll[1]
|
||||
end,
|
||||
cwd = '${workspaceFolder}',
|
||||
stopAtEntry = false,
|
||||
console = 'integratedTerminal',
|
||||
},
|
||||
{
|
||||
type = 'coreclr',
|
||||
name = 'Attach ASP.NET Core',
|
||||
request = 'attach',
|
||||
processId = require('dap.utils').pick_process,
|
||||
cwd = '${workspaceFolder}',
|
||||
},
|
||||
}
|
||||
|
||||
-- Configuration for Ionic Angular (JavaScript/TypeScript) using Firefox
|
||||
dap.adapters.chrome = {
|
||||
type = 'executable',
|
||||
command = 'node',
|
||||
args = { os.getenv 'HOME' .. '/.vscode/extensions/vscode-chrome-debug/out/src/chromeDebug.js' },
|
||||
}
|
||||
dap.configurations.javascript = {
|
||||
{
|
||||
type = 'chrome',
|
||||
name = 'Attach to Chrome (Ionic App)',
|
||||
request = 'attach',
|
||||
program = '${file}',
|
||||
cwd = vim.fn.getcwd(),
|
||||
sourceMaps = true,
|
||||
protocol = 'inspector',
|
||||
port = 9222, -- Port where Chrome is listening
|
||||
url = 'https://localhost:8100/login', -- URL of your running Ionic app
|
||||
webRoot = '${workspaceFolder}',
|
||||
timeout = 20000, -- Optional: Increase if you experience timeouts
|
||||
address = '0.0.0.0',
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.typescript = dap.configurations.javascript
|
||||
|
||||
vim.keymap.set('n', '<space>tb', dap.toggle_breakpoint)
|
||||
vim.keymap.set('n', '<space>gb', dap.run_to_cursor)
|
||||
|
||||
vim.keymap.set('n', '<space>?', function()
|
||||
require('dapui').eval(nil, { enter = true })
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', '<F1>', dap.continue)
|
||||
vim.keymap.set('n', '<F2>', dap.step_into)
|
||||
vim.keymap.set('n', '<F3>', dap.step_over)
|
||||
vim.keymap.set('n', '<F4>', dap.step_out)
|
||||
vim.keymap.set('n', '<F5>', dap.step_back)
|
||||
vim.keymap.set('n', '<F12>', dap.restart)
|
||||
|
||||
-- Key mapping to toggle the DAP UI
|
||||
vim.keymap.set('n', '<Leader>dui', function()
|
||||
ui.toggle()
|
||||
end)
|
||||
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
ui.open()
|
||||
end
|
||||
dap.listeners.before.launch.dapui_config = function()
|
||||
ui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated.dapui_config = function()
|
||||
ui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited.dapui_config = function()
|
||||
ui.close()
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
3
lua/custom/plugins/git-fugitive.lua
Normal file
3
lua/custom/plugins/git-fugitive.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
'tpope/vim-fugitive',
|
||||
}
|
||||
19
lua/custom/plugins/lazy-git.lua
Normal file
19
lua/custom/plugins/lazy-git.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
'kdheepak/lazygit.nvim',
|
||||
cmd = {
|
||||
'LazyGit',
|
||||
'LazyGitConfig',
|
||||
'LazyGitCurrentFile',
|
||||
'LazyGitFilter',
|
||||
'LazyGitFilterCurrentFile',
|
||||
},
|
||||
-- optional for floating window border decoration
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
-- setting the keybinding for LazyGit with 'keys' is recommended in
|
||||
-- order to load the plugin when the command is run for the first time
|
||||
keys = {
|
||||
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
|
||||
},
|
||||
}
|
||||
46
lua/custom/plugins/lualine.lua
Normal file
46
lua/custom/plugins/lualine.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'catppuccin',
|
||||
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 = { 'buffers' }, -- Show buffers in the main statusline
|
||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
||||
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 = {},
|
||||
}
|
||||
end,
|
||||
}
|
||||
77
lua/custom/plugins/neorg.lua
Normal file
77
lua/custom/plugins/neorg.lua
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
-- neorg_setup.lua
|
||||
return {
|
||||
-- Dependency for Neorg: a colorscheme compatible with treesitter
|
||||
{
|
||||
'rebelot/kanagawa.nvim',
|
||||
config = function()
|
||||
vim.cmd.colorscheme 'kanagawa'
|
||||
end,
|
||||
},
|
||||
|
||||
-- Treesitter configuration necessary for Neorg
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
opts = {
|
||||
ensure_installed = { 'c', 'lua', 'vim', 'vimdoc', 'query' },
|
||||
highlight = { enable = true },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('nvim-treesitter.configs').setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- Dependency manager for Neorg
|
||||
{
|
||||
'vhyrro/luarocks.nvim',
|
||||
priority = 1000,
|
||||
config = true,
|
||||
},
|
||||
|
||||
-- Main Neorg setup
|
||||
{
|
||||
'nvim-neorg/neorg',
|
||||
dependencies = { 'luarocks.nvim' },
|
||||
version = '*',
|
||||
config = function()
|
||||
require('neorg').setup {
|
||||
load = {
|
||||
['core.defaults'] = {}, -- Load all the default modules
|
||||
['core.concealer'] = {}, -- Allows for use of icons
|
||||
['core.export'] = {
|
||||
config = {
|
||||
export_dir = '~/notes/exports', -- Sets the export directory for all files
|
||||
exporters = { -- Defines the exporters available and their settings
|
||||
markdown = { -- Markdown exporter settings
|
||||
extensions = { 'md' }, -- Specifies the file extensions to use when exporting to Markdown
|
||||
},
|
||||
html = { -- HTML exporter settings
|
||||
extensions = { 'html' }, -- Specifies the file extensions to use when exporting to HTML
|
||||
},
|
||||
pdf = { -- PDF exporter settings
|
||||
extensions = { 'pdf' }, -- Specifies the file extensions to use when exporting to PDF
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
['core.journal'] = {
|
||||
config = {
|
||||
workspace = 'notes', -- Specifies the workspace for journaling
|
||||
},
|
||||
},
|
||||
['core.dirman'] = {
|
||||
config = {
|
||||
workspaces = {
|
||||
notes = '~/notes', -- Path to your notes directory
|
||||
},
|
||||
default_workspace = 'notes', -- Sets default workspace
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
vim.wo.foldlevel = 99 -- Set the foldlevel for vim
|
||||
vim.wo.conceallevel = 2 -- Set the conceallevel for better visibility
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
24
lua/custom/plugins/noice.lua
Normal file
24
lua/custom/plugins/noice.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
return {
|
||||
'folke/noice.nvim',
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
-- add any options here
|
||||
lsp = {
|
||||
override = {
|
||||
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
|
||||
['vim.lsp.util.stylize_markdown'] = true,
|
||||
['cmp.entry.get_documentation'] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local noice = require 'noice'
|
||||
noice.setup {
|
||||
-- any options for noice
|
||||
}
|
||||
end,
|
||||
dependencies = {
|
||||
'MunifTanjim/nui.nvim',
|
||||
'rcarriga/nvim-notify',
|
||||
},
|
||||
}
|
||||
8
lua/custom/plugins/notify.lua
Normal file
8
lua/custom/plugins/notify.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
'rcarriga/nvim-notify',
|
||||
config = function()
|
||||
require('notify').setup {
|
||||
background_colour = '#000000',
|
||||
}
|
||||
end,
|
||||
}
|
||||
77
lua/custom/plugins/obsidian.lua
Normal file
77
lua/custom/plugins/obsidian.lua
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
return {
|
||||
'epwalsh/obsidian.nvim',
|
||||
version = '*',
|
||||
lazy = false,
|
||||
ft = 'markdown',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
opts = {
|
||||
workspaces = {
|
||||
{
|
||||
name = 'personal',
|
||||
path = '/home/martin/Obsidian/vaults/personal',
|
||||
default_tags = { 'personal-notes' },
|
||||
overrides = {
|
||||
notes_subdir = 'vaults/personal/notes/',
|
||||
},
|
||||
},
|
||||
{
|
||||
name = 'work',
|
||||
path = '/home/martin/Obsidian/vaults/work',
|
||||
default_tags = { 'work-notes' },
|
||||
overrides = {
|
||||
notes_subdir = 'vaults/work/notes/',
|
||||
},
|
||||
},
|
||||
{
|
||||
name = 'daily',
|
||||
path = '/home/martin/Obsidian/vaults/daily',
|
||||
overrides = {
|
||||
notes_subdir = 'notes',
|
||||
},
|
||||
},
|
||||
},
|
||||
templates = {
|
||||
folder = '/home/martin/Obsidian/templates',
|
||||
date_format = '%Y-%m-%d',
|
||||
time_format = '%H:%M',
|
||||
},
|
||||
daily_notes = {
|
||||
date_format = '%Y-%m-%d',
|
||||
alias_format = '%B %-d, %Y',
|
||||
default_tags = { 'daily-notes' },
|
||||
template = 'daily.md',
|
||||
},
|
||||
completion = {
|
||||
nvim_cmp = true,
|
||||
min_chars = 2,
|
||||
},
|
||||
mappings = {
|
||||
['gf'] = {
|
||||
action = function()
|
||||
return require('obsidian').util.gf_passthrough()
|
||||
end,
|
||||
opts = { noremap = false, expr = true, buffer = true },
|
||||
},
|
||||
},
|
||||
new_notes_location = 'notes_subdir',
|
||||
note_id_func = function(title)
|
||||
local suffix = ''
|
||||
local current_time = os.date '%Y-%m-%d-%H%M'
|
||||
if title ~= nil then
|
||||
suffix = title:gsub(' ', '-'):gsub('[^A-Za-z0-9-]', ''):lower()
|
||||
else
|
||||
for _ = 1, 4 do
|
||||
suffix = suffix .. string.char(math.random(65, 90))
|
||||
end
|
||||
end
|
||||
return current_time .. '-' .. suffix
|
||||
end,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('obsidian').setup(opts)
|
||||
-- Load the custom key mappings
|
||||
require('obsidian_keymaps').setup_keymaps()
|
||||
end,
|
||||
}
|
||||
5
lua/custom/plugins/rest_nvim.lua
Normal file
5
lua/custom/plugins/rest_nvim.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
-- 'rest-nvim/rest.nvim',
|
||||
-- dependencies = { 'luarocks.nvim', 'nvim-lua/plenary.nvim' },
|
||||
-- config = function() end,
|
||||
}
|
||||
24
lua/custom/plugins/transparent.lua
Normal file
24
lua/custom/plugins/transparent.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
-- transparent.nvim plugin configuration
|
||||
-- https://github.com/xiyaowong/transparent.nvim
|
||||
|
||||
return {
|
||||
'xiyaowong/transparent.nvim', -- GitHub repository
|
||||
as = 'transparent', -- Optional: rename the plugin to 'transparent'
|
||||
config = function()
|
||||
require('transparent').setup({
|
||||
groups = { -- table: default groups
|
||||
'Normal', 'NormalNC', 'Comment', 'Constant', 'Special', 'Identifier',
|
||||
'Statement', 'PreProc', 'Type', 'Underlined', 'Todo', 'String', 'Function',
|
||||
'Conditional', 'Repeat', 'Operator', 'Structure', 'LineNr', 'NonText',
|
||||
'SignColumn', 'CursorLine', 'CursorLineNr', 'StatusLine', 'StatusLineNC',
|
||||
'EndOfBuffer',
|
||||
},
|
||||
extra_groups = { -- extra highlight groups to clear
|
||||
'all', -- Also clear background for all highlight groups
|
||||
},
|
||||
exclude_groups = {}, -- exclude these highlight groups from being cleared
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
96
lua/custom/plugins/treesitter.lua
Normal file
96
lua/custom/plugins/treesitter.lua
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
-- ~/.config/nvim/lua/custom/plugins/treesitter.lua
|
||||
|
||||
return {
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
version = false, -- last release is way too old and doesn't work on Windows
|
||||
build = ':TSUpdate',
|
||||
event = { 'BufRead', 'BufNewFile' },
|
||||
lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline
|
||||
init = function(plugin)
|
||||
-- PERF: add nvim-treesitter queries to the rtp and its custom query predicates early
|
||||
-- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which
|
||||
-- no longer triggers the **nvim-treesitter** module to be loaded in time.
|
||||
-- Luckily, the only things that those plugins need are the custom queries, which we make available
|
||||
-- during startup.
|
||||
require('lazy.core.loader').add_to_rtp(plugin)
|
||||
require 'nvim-treesitter.query_predicates'
|
||||
end,
|
||||
cmd = { 'TSUpdateSync', 'TSUpdate', 'TSInstall' },
|
||||
keys = {
|
||||
{ '<c-space>', desc = 'Increment Selection' },
|
||||
{ '<bs>', desc = 'Decrement Selection', mode = 'x' },
|
||||
},
|
||||
opts_extend = { 'ensure_installed' },
|
||||
---@type TSConfig
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
opts = {
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'c',
|
||||
'diff',
|
||||
'html',
|
||||
'javascript',
|
||||
'jsdoc',
|
||||
'json',
|
||||
'jsonc',
|
||||
'lua',
|
||||
'luadoc',
|
||||
'luap',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'printf',
|
||||
'python',
|
||||
'query',
|
||||
'regex',
|
||||
'toml',
|
||||
'tsx',
|
||||
'typescript',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'xml',
|
||||
'yaml',
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = '<C-space>',
|
||||
node_incremental = '<C-space>',
|
||||
scope_incremental = false,
|
||||
node_decremental = '<bs>',
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
move = {
|
||||
enable = true,
|
||||
goto_next_start = { [']f'] = '@function.outer', [']c'] = '@class.outer', [']a'] = '@parameter.inner' },
|
||||
goto_next_end = { [']F'] = '@function.outer', [']C'] = '@class.outer', [']A'] = '@parameter.inner' },
|
||||
goto_previous_start = { ['[f'] = '@function.outer', ['[c'] = '@class.outer', ['[a'] = '@parameter.inner' },
|
||||
goto_previous_end = { ['[F'] = '@function.outer', ['[C'] = '@class.outer', ['[A'] = '@parameter.inner' },
|
||||
},
|
||||
},
|
||||
},
|
||||
---@param opts TSConfig
|
||||
config = function(_, opts)
|
||||
-- Ensure the list is deduplicated manually
|
||||
if type(opts.ensure_installed) == 'table' then
|
||||
local seen = {}
|
||||
local deduped = {}
|
||||
for _, item in ipairs(opts.ensure_installed) do
|
||||
if not seen[item] then
|
||||
table.insert(deduped, item)
|
||||
seen[item] = true
|
||||
end
|
||||
end
|
||||
opts.ensure_installed = deduped
|
||||
end
|
||||
require('nvim-treesitter.configs').setup(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
'windwp/nvim-ts-autotag',
|
||||
after = 'nvim-treesitter',
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue