nvim: treesitter overhaul and actually removed luasnip
This commit is contained in:
parent
6fd7e97780
commit
16b13b9f7a
3 changed files with 38 additions and 50 deletions
|
@ -29,10 +29,36 @@ end -- <<<
|
|||
|
||||
-- treesitter >>>
|
||||
M.treesitter = function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- install the necessary parsers
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cmake",
|
||||
"comment",
|
||||
"cpp",
|
||||
"css",
|
||||
"dockerfile",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"python",
|
||||
"r",
|
||||
"regex",
|
||||
"rst",
|
||||
"rust",
|
||||
"toml",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
--ignore_install = { "javascript", "java" }, -- List of parsers to ignore installing
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
|
@ -42,9 +68,6 @@ M.treesitter = function()
|
|||
node_decremental = 'grm',
|
||||
},
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
|
@ -79,23 +102,6 @@ M.treesitter = function()
|
|||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- require'nvim-treesitter.configs'.setup {
|
||||
-- ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
-- --ignore_install = { "javascript", "java" }, -- List of parsers to ignore installing
|
||||
-- highlight = {
|
||||
-- enable = true, -- false will disable the whole extension
|
||||
-- -- disable = { "c", "rust" }, -- list of language that will be disabled
|
||||
-- -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- -- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- -- Instead of true it can also be a list of languages
|
||||
-- additional_vim_regex_highlighting = false,
|
||||
-- },
|
||||
-- indent = {
|
||||
-- enable = true
|
||||
-- }
|
||||
-- }
|
||||
end -- <<<
|
||||
|
||||
-- cmp >>>
|
||||
|
@ -104,17 +110,9 @@ M.cmp = function()
|
|||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||
|
||||
-- luasnip setup
|
||||
-- local luasnip = require 'luasnip'
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require 'cmp'
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
-- expand = function(args)
|
||||
-- require('luasnip').lsp_expand(args.body)
|
||||
-- end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
|
@ -129,8 +127,6 @@ M.cmp = function()
|
|||
['<Tab>'] = function(fallback)
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n')
|
||||
-- elseif luasnip.expand_or_jumpable() then
|
||||
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '')
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
|
@ -138,8 +134,6 @@ M.cmp = function()
|
|||
['<S-Tab>'] = function(fallback)
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-p>', true, true, true), 'n')
|
||||
-- elseif luasnip.jumpable(-1) then
|
||||
-- vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '')
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
|
@ -149,7 +143,6 @@ M.cmp = function()
|
|||
{ name = 'path' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'calc' },
|
||||
-- { name = 'luasnip' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'nvim_lua' },
|
||||
{ name = 'spell' },
|
||||
|
@ -163,14 +156,13 @@ M.cmp = function()
|
|||
|
||||
-- set a name for each source
|
||||
vim_item.menu = ({
|
||||
path = "[Path]",
|
||||
buffer = "[Buffer]",
|
||||
calc = "[Calc]",
|
||||
-- luasnip = "[LuaSnip]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
spell = "[Spell]",
|
||||
treesitter = "[TS]",
|
||||
path = "(Path)",
|
||||
buffer = "(Buffer)",
|
||||
calc = "(Calc)",
|
||||
nvim_lsp = "(LSP)",
|
||||
nvim_lua = "(Lua)",
|
||||
spell = "(Spell)",
|
||||
treesitter = "(TS)",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue