treesitter

This commit is contained in:
Your Name 2026-03-06 22:53:55 +08:00
parent 4c2f34b689
commit 7c070a47e4
4 changed files with 52 additions and 24 deletions

View File

@ -933,28 +933,6 @@ require('lazy').setup({
}, },
}, },
{ -- You can easily change to a different colorscheme.
-- Change the name of the colorscheme plugin below, and then
-- change the command in the config to whatever the name of that colorscheme is.
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim',
priority = 1000, -- Make sure to load this before all the other start plugins.
config = function()
---@diagnostic disable-next-line: missing-fields
require('tokyonight').setup {
styles = {
comments = { italic = false }, -- Disable italics in comments
},
}
-- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night'
end,
},
-- Highlight todo, notes, etc in comments -- Highlight todo, notes, etc in comments
{ {
'folke/todo-comments.nvim', 'folke/todo-comments.nvim',
@ -982,7 +960,17 @@ require('lazy').setup({
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes -- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] ['] -- - sr)' - [S]urround [R]eplace [)] [']
require('mini.surround').setup() require('mini.surround').setup {
mappings = {
add = 'ra', -- Add surrounding in Normal and Visual modes
delete = 'rd', -- Delete surrounding
find = 'rf', -- Find surrounding (to the right)
find_left = 'rF', -- Find surrounding (to the left)
highlight = 'rh', -- Highlight surrounding
replace = 'rr', -- Replace surrounding
update_n_lines = 'rn', -- Update `n_lines`
},
}
-- Simple and easy statusline. -- Simple and easy statusline.
-- You could remove this setup call if you don't like it, -- You could remove this setup call if you don't like it,
@ -1009,7 +997,28 @@ require('lazy').setup({
branch = 'main', branch = 'main',
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro` -- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
config = function() config = function()
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' } local parsers = {
'jsx',
'tsx',
'javascript',
'typescript',
'rust',
'zig',
'bash',
'c',
'cpp',
'python',
'vimdoc',
'vim',
'lua',
'php',
'html',
'svelte',
'markdown',
'markdown_inline',
'yaml',
'json',
}
require('nvim-treesitter').install(parsers) require('nvim-treesitter').install(parsers)
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
callback = function(args) callback = function(args)

9
test.jsx Normal file
View File

@ -0,0 +1,9 @@
const Component = (props) => {
return (
<>
<h1>Hello Mantap</h1>
</>
);
};
export default Component;

1
test.py Normal file
View File

@ -0,0 +1 @@
print("hello world")

9
test.tsx Normal file
View File

@ -0,0 +1,9 @@
const Component = (props) => {
return (
<>
<h1>Hello World</h1>
</>
);
};
export default Component;