From 9da869feeea364bc1c56bd8100306ec4f68e54b7 Mon Sep 17 00:00:00 2001 From: siduck76 Date: Sat, 26 Jun 2021 18:20:25 +0530 Subject: [PATCH] replace vsnip with luasnip,clean some confs --- lua/compe-completion.lua | 17 +++++++++++++++-- lua/mappings.lua | 6 ++++-- lua/misc-utils.lua | 15 ++++++++++++++- lua/pluginList.lua | 36 ++++++++++++++++-------------------- 4 files changed, 49 insertions(+), 25 deletions(-) diff --git a/lua/compe-completion.lua b/lua/compe-completion.lua index b9170ae..259098b 100644 --- a/lua/compe-completion.lua +++ b/lua/compe-completion.lua @@ -16,10 +16,23 @@ M.config = function() documentation = true, source = { buffer = {kind = "﬘", true}, - vsnip = {kind = "﬌"}, - nvim_lsp = true + luasnip = {kind = "﬌", true}, + nvim_lsp = true, + nvim_lua = true, } } end +M.snippets = function() + local ls = require("luasnip") + + ls.config.set_config( + { + history = true, + updateevents = "TextChanged,TextChangedI" + } + ) + require("luasnip/loaders/from_vscode").load() +end + return M diff --git a/lua/mappings.lua b/lua/mappings.lua index 3c5fb85..5663f8a 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -30,8 +30,8 @@ map("n", "", [[ %y+]], opt) map("n", "n", [[ set nu!]], opt) -- Truezen.nvim -map("n", "z", [[ TZAtaraxis]], opt) -map("n", "m", [[ TZMinimalist]], opt) +map("n", "z", ":TZAtaraxis", opt) +map("n", "m", ":TZMinimalist", opt) map("n", "", [[ w ]], opt) -- vim.cmd("inoremap jh ") @@ -40,6 +40,8 @@ map("n", "", [[ w ]], opt) map("n", "/", ":CommentToggle", {noremap = true, silent = true}) map("v", "/", ":CommentToggle", {noremap = true, silent = true}) +map("n","",":BufDel", opt) + -- compe stuff local t = function(str) diff --git a/lua/misc-utils.lua b/lua/misc-utils.lua index dd44b1f..6452c21 100644 --- a/lua/misc-utils.lua +++ b/lua/misc-utils.lua @@ -1,7 +1,6 @@ local opt = vim.opt opt.ruler = false -opt.showmode = false opt.hidden = true opt.ignorecase = true opt.splitbelow = true @@ -50,4 +49,18 @@ end -- file extension specific tabbing -- vim.cmd([[autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4]]) + +-- blankline config + +M.blankline = function() + vim.g.indentLine_enabled = 1 + vim.g.indent_blankline_char = "▏" + + vim.g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard"} + vim.g.indent_blankline_buftype_exclude = {"terminal"} + + vim.g.indent_blankline_show_trailing_blankline_indent = false + vim.g.indent_blankline_show_first_indent_level = false +end + return M diff --git a/lua/pluginList.lua b/lua/pluginList.lua index ddd1b4d..c2129bc 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -45,7 +45,19 @@ return packer.startup( event = "InsertEnter", config = function() require("compe-completion").config() - end + end, + wants = {"LuaSnip"}, + requires = { + { + "L3MON4D3/LuaSnip", + wants = "friendly-snippets", + event = "InsertCharPre", + config = function() + require("compe-completion").snippets() + end + }, + "rafamadriz/friendly-snippets" + } } use { @@ -53,13 +65,6 @@ return packer.startup( cmd = "Neoformat" } - -- snippet support - use { - "hrsh7th/vim-vsnip", - event = "InsertCharPre" - } - use "rafamadriz/friendly-snippets" - -- file managing , picker etc use { "kyazdani42/nvim-tree.lua", @@ -79,9 +84,7 @@ return packer.startup( {"nvim-telescope/telescope-fzf-native.nvim", run = "make"}, {"nvim-telescope/telescope-media-files.nvim"} }, - cmd = { - "Telescope" - }, + cmd = "Telescope", config = function() require("telescope-nvim").config() end @@ -132,7 +135,7 @@ return packer.startup( use {"tweekmonster/startuptime.vim", cmd = "StartupTime"} - -- load autosave plugin only if its globally enabled + -- load autosave only if its globally enabled use { "907th/vim-auto-save", cond = function() @@ -164,14 +167,7 @@ return packer.startup( branch = "lua", event = "BufRead", setup = function() - vim.g.indentLine_enabled = 1 - vim.g.indent_blankline_char = "▏" - - vim.g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard"} - vim.g.indent_blankline_buftype_exclude = {"terminal"} - - vim.g.indent_blankline_show_trailing_blankline_indent = false - vim.g.indent_blankline_show_first_indent_level = false + require("misc-utils").blankline() end } end,