nvim: treesitter overhaul and actually removed luasnip

This commit is contained in:
PowerUser64 2021-09-25 02:19:19 -07:00
parent 6fd7e97780
commit 16b13b9f7a
3 changed files with 38 additions and 50 deletions

View file

@ -29,10 +29,36 @@ end -- <<<
-- treesitter >>> -- treesitter >>>
M.treesitter = function() 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 = { highlight = {
enable = true, -- false will disable the whole extension enable = true, -- false will disable the whole extension
}, },
indent = {
enable = true
},
incremental_selection = { incremental_selection = {
enable = true, enable = true,
keymaps = { keymaps = {
@ -42,9 +68,6 @@ M.treesitter = function()
node_decremental = 'grm', node_decremental = 'grm',
}, },
}, },
indent = {
enable = true,
},
textobjects = { textobjects = {
select = { select = {
enable = true, 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 -- <<< end -- <<<
-- cmp >>> -- cmp >>>
@ -104,17 +110,9 @@ M.cmp = function()
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
-- luasnip setup
-- local luasnip = require 'luasnip'
-- nvim-cmp setup -- nvim-cmp setup
local cmp = require 'cmp' local cmp = require 'cmp'
cmp.setup { cmp.setup {
snippet = {
-- expand = function(args)
-- require('luasnip').lsp_expand(args.body)
-- end,
},
mapping = { mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(), ['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(), ['<C-n>'] = cmp.mapping.select_next_item(),
@ -129,8 +127,6 @@ M.cmp = function()
['<Tab>'] = function(fallback) ['<Tab>'] = function(fallback)
if vim.fn.pumvisible() == 1 then if vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n') 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 else
fallback() fallback()
end end
@ -138,8 +134,6 @@ M.cmp = function()
['<S-Tab>'] = function(fallback) ['<S-Tab>'] = function(fallback)
if vim.fn.pumvisible() == 1 then if vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-p>', true, true, true), 'n') 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 else
fallback() fallback()
end end
@ -149,7 +143,6 @@ M.cmp = function()
{ name = 'path' }, { name = 'path' },
{ name = 'buffer' }, { name = 'buffer' },
{ name = 'calc' }, { name = 'calc' },
-- { name = 'luasnip' },
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'nvim_lua' }, { name = 'nvim_lua' },
{ name = 'spell' }, { name = 'spell' },
@ -163,14 +156,13 @@ M.cmp = function()
-- set a name for each source -- set a name for each source
vim_item.menu = ({ vim_item.menu = ({
path = "[Path]", path = "(Path)",
buffer = "[Buffer]", buffer = "(Buffer)",
calc = "[Calc]", calc = "(Calc)",
-- luasnip = "[LuaSnip]", nvim_lsp = "(LSP)",
nvim_lsp = "[LSP]", nvim_lua = "(Lua)",
nvim_lua = "[Lua]", spell = "(Spell)",
spell = "[Spell]", treesitter = "(TS)",
treesitter = "[TS]",
})[entry.source.name] })[entry.source.name]
return vim_item return vim_item
end, end,

View file

@ -155,8 +155,8 @@ end -- <<<
M.neoscroll = function() M.neoscroll = function()
require('neoscroll').setup({ require('neoscroll').setup({
-- All these keys will be mapped to their corresponding default scrolling animation -- All these keys will be mapped to their corresponding default scrolling animation
mappings = {'<C-u>', '<C-d>', '<C-b>', '<C-f>', mappings = { '<C-u>', '<C-d>', '<C-b>', '<C-f>', '<C-y>', '<C-e>',
'<C-y>', '<C-e>', 'zt', 'zz', 'zb',}, 'zt', 'zz', 'zb', '<ScrollWheelUp>', '<ScrollWheelDown>', },
hide_cursor = true, -- Hide cursor while scrolling hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards stop_eof = true, -- Stop at <EOF> when scrolling downwards
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope

View file

@ -9,6 +9,7 @@ end
-- } -- }
return require('packer').startup(function() return require('packer').startup(function()
-- Packer -- Packer
use { -- packer use { -- packer
'wbthomason/packer.nvim' 'wbthomason/packer.nvim'
@ -73,7 +74,6 @@ return require('packer').startup(function()
require('blake.lsp').cmp() require('blake.lsp').cmp()
end, end,
requires = { -- nvim-cmp sources requires = { -- nvim-cmp sources
-- "saadparwaiz1/cmp_luasnip", --luasnip integration
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer", "hrsh7th/cmp-buffer",
@ -84,11 +84,6 @@ return require('packer').startup(function()
"hrsh7th/cmp-look", "hrsh7th/cmp-look",
} }
} }
-- use { -- code snippits
-- "L3MON4D3/LuaSnip",
-- -- "hrsh7th/vim-vsnip",
-- -- "rafamadriz/friendly-snippets",
-- }
use { -- function parameter previews use { -- function parameter previews
"ray-x/lsp_signature.nvim", "ray-x/lsp_signature.nvim",
after = "nvim-lspconfig", after = "nvim-lspconfig",
@ -179,6 +174,7 @@ return require('packer').startup(function()
use { -- cheat.sh integration use { -- cheat.sh integration
"dbeniamine/cheat.sh-vim", "dbeniamine/cheat.sh-vim",
} }
end) end)
-- vim:fdm=marker:fmr={,}:expandtab:tabstop=3:sw=3 -- vim:fdm=marker:fmr={,}:expandtab:tabstop=3:sw=3