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,
|
||||
|
|
|
@ -155,8 +155,8 @@ end -- <<<
|
|||
M.neoscroll = function()
|
||||
require('neoscroll').setup({
|
||||
-- All these keys will be mapped to their corresponding default scrolling animation
|
||||
mappings = {'<C-u>', '<C-d>', '<C-b>', '<C-f>',
|
||||
'<C-y>', '<C-e>', 'zt', 'zz', 'zb',},
|
||||
mappings = { '<C-u>', '<C-d>', '<C-b>', '<C-f>', '<C-y>', '<C-e>',
|
||||
'zt', 'zz', 'zb', '<ScrollWheelUp>', '<ScrollWheelDown>', },
|
||||
hide_cursor = true, -- Hide cursor while scrolling
|
||||
stop_eof = true, -- Stop at <EOF> when scrolling downwards
|
||||
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
|
||||
|
|
|
@ -9,6 +9,7 @@ end
|
|||
-- }
|
||||
|
||||
return require('packer').startup(function()
|
||||
|
||||
-- Packer
|
||||
use { -- packer
|
||||
'wbthomason/packer.nvim'
|
||||
|
@ -73,7 +74,6 @@ return require('packer').startup(function()
|
|||
require('blake.lsp').cmp()
|
||||
end,
|
||||
requires = { -- nvim-cmp sources
|
||||
-- "saadparwaiz1/cmp_luasnip", --luasnip integration
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
|
@ -84,11 +84,6 @@ return require('packer').startup(function()
|
|||
"hrsh7th/cmp-look",
|
||||
}
|
||||
}
|
||||
-- use { -- code snippits
|
||||
-- "L3MON4D3/LuaSnip",
|
||||
-- -- "hrsh7th/vim-vsnip",
|
||||
-- -- "rafamadriz/friendly-snippets",
|
||||
-- }
|
||||
use { -- function parameter previews
|
||||
"ray-x/lsp_signature.nvim",
|
||||
after = "nvim-lspconfig",
|
||||
|
@ -179,6 +174,7 @@ return require('packer').startup(function()
|
|||
use { -- cheat.sh integration
|
||||
"dbeniamine/cheat.sh-vim",
|
||||
}
|
||||
|
||||
end)
|
||||
|
||||
-- vim:fdm=marker:fmr={,}:expandtab:tabstop=3:sw=3
|
||||
|
|
Loading…
Add table
Reference in a new issue