From 16b13b9f7abc95558e248a7762ff1475d8bfb707 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Sat, 25 Sep 2021 02:19:19 -0700 Subject: [PATCH] nvim: treesitter overhaul and actually removed luasnip --- .config/nvim/lua/blake/lsp.lua | 76 +++++++++++++----------------- .config/nvim/lua/blake/other.lua | 4 +- .config/nvim/lua/blake/plugins.lua | 8 +--- 3 files changed, 38 insertions(+), 50 deletions(-) diff --git a/.config/nvim/lua/blake/lsp.lua b/.config/nvim/lua/blake/lsp.lua index 2fc214e..4467277 100644 --- a/.config/nvim/lua/blake/lsp.lua +++ b/.config/nvim/lua/blake/lsp.lua @@ -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 = { [''] = cmp.mapping.select_prev_item(), [''] = cmp.mapping.select_next_item(), @@ -129,8 +127,6 @@ M.cmp = function() [''] = function(fallback) if vim.fn.pumvisible() == 1 then vim.fn.feedkeys(vim.api.nvim_replace_termcodes('', true, true, true), 'n') - -- elseif luasnip.expand_or_jumpable() then - -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes('luasnip-expand-or-jump', true, true, true), '') else fallback() end @@ -138,8 +134,6 @@ M.cmp = function() [''] = function(fallback) if vim.fn.pumvisible() == 1 then vim.fn.feedkeys(vim.api.nvim_replace_termcodes('', true, true, true), 'n') - -- elseif luasnip.jumpable(-1) then - -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes('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, diff --git a/.config/nvim/lua/blake/other.lua b/.config/nvim/lua/blake/other.lua index 42195bf..a4e89f1 100644 --- a/.config/nvim/lua/blake/other.lua +++ b/.config/nvim/lua/blake/other.lua @@ -155,8 +155,8 @@ end -- <<< M.neoscroll = function() require('neoscroll').setup({ -- All these keys will be mapped to their corresponding default scrolling animation - mappings = {'', '', '', '', - '', '', 'zt', 'zz', 'zb',}, + mappings = { '', '', '', '', '', '', + 'zt', 'zz', 'zb', '', '', }, hide_cursor = true, -- Hide cursor while scrolling stop_eof = true, -- Stop at when scrolling downwards use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope diff --git a/.config/nvim/lua/blake/plugins.lua b/.config/nvim/lua/blake/plugins.lua index 20f1bcf..83718c6 100644 --- a/.config/nvim/lua/blake/plugins.lua +++ b/.config/nvim/lua/blake/plugins.lua @@ -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