From f448ef05de4848af9aa6e5a3c246693aa670ab69 Mon Sep 17 00:00:00 2001 From: Jim Richter Date: Wed, 17 Nov 2021 13:55:37 +0100 Subject: [PATCH] some stuff --- configs/nvim/.gitignore | 1 + configs/nvim/init.lua | 5 +++- configs/nvim/lua/plugins.lua | 23 +++++++++++++----- configs/nvim/lua/snippets.lua | 45 +++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 configs/nvim/.gitignore create mode 100644 configs/nvim/lua/snippets.lua diff --git a/configs/nvim/.gitignore b/configs/nvim/.gitignore new file mode 100644 index 0000000..8cb205e --- /dev/null +++ b/configs/nvim/.gitignore @@ -0,0 +1 @@ +plugin diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua index 1642200..16be235 100644 --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -10,6 +10,9 @@ local opt = vim.opt require ("plugins") if u.has_plugin("cmp") then + + vim.g.did_load_filetypes = 1 + -- Global options o.number = true -- show line number o.showmatch = true -- show matching brackets @@ -20,7 +23,6 @@ if u.has_plugin("cmp") then set autoindent set expandtab set shiftwidth=2 - set smartindent set softtabstop=2 set tabstop=2 ]] @@ -171,6 +173,7 @@ if u.has_plugin("cmp") then -- Autocompletion Setup o.completeopt = "menuone,noselect,noinsert" require "autocomplete" + require "snippets" -- LSP Config require "lspinstaller-conf" diff --git a/configs/nvim/lua/plugins.lua b/configs/nvim/lua/plugins.lua index 50ac0ab..d0a8739 100644 --- a/configs/nvim/lua/plugins.lua +++ b/configs/nvim/lua/plugins.lua @@ -5,7 +5,10 @@ return require("packer").startup(function() -- General Helper Functions use "nvim-lua/plenary.nvim" - + + -- Faster Filetype Detection + use "nathom/filetype.nvim" + use "alexghergh/nvim-tmux-navigation" -- Theming Section @@ -21,6 +24,8 @@ return require("packer").startup(function() use "karb94/neoscroll.nvim" use "tpope/vim-fugitive" + use "tpope/vim-surround" + use "editorconfig/editorconfig-vim" -- Code Navigation use "dense-analysis/ale" @@ -35,14 +40,20 @@ return require("packer").startup(function() -- use "lervag/wiki.vim" -- Syntax / Autocomplete - use "preservim/nerdcommenter" use "neovim/nvim-lspconfig" - use "williamboman/nvim-lsp-installer" - use "nvim-lua/lsp-status.nvim" - use "hrsh7th/nvim-cmp" + use "hrsh7th/nvim-cmp" use "hrsh7th/cmp-nvim-lsp" use "hrsh7th/cmp-path" - use "weilbith/nvim-code-action-menu" -- Need to find better alternative + use "hrsh7th/cmp-buffer" + use "hrsh7th/cmp-cmdline" + use "L3MON4D3/LuaSnip" + use "saadparwaiz1/cmp_luasnip" + use "rafamadriz/friendly-snippets" + + use "tpope/vim-commentary" + + use "williamboman/nvim-lsp-installer" + use "nvim-lua/lsp-status.nvim" use "L3MON4D3/LuaSnip" use "windwp/nvim-autopairs" use "neoclide/jsonc.vim" diff --git a/configs/nvim/lua/snippets.lua b/configs/nvim/lua/snippets.lua new file mode 100644 index 0000000..c83f529 --- /dev/null +++ b/configs/nvim/lua/snippets.lua @@ -0,0 +1,45 @@ +local ls = require("luasnip") + +-- some shorthands... +local s = ls.snippet +local sn = ls.snippet_node +local t = ls.text_node +local i = ls.insert_node +local f = ls.function_node +local c = ls.choice_node +local d = ls.dynamic_node + +local types = require("luasnip.util.types") + +-- Every unspecified option will be set to the default. +ls.config.set_config({ + history = true, + -- Update more often, :h events for more info. + updateevents = "TextChanged,TextChangedI", + ext_opts = { + [types.choiceNode] = { + active = { + virt_text = { { "choiceNode", "Comment" } }, + }, + }, + }, + -- treesitter-hl has 100, use something higher (default is 200). + ext_base_prio = 300, + -- minimal increase in priority. + ext_prio_increase = 1, + enable_autosnippets = true, +}) + + +ls.snippets = { + all = { + + }, + svelte = { + s("slt", { + t(''), + }), + } +}