diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..2dbd762 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,40 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "8d3aa5c22c2d45e788c7a5fe13ad77368b783c20" }, + "DAPInstall.nvim": { "branch": "main", "commit": "1da66b6015bdec638a3bf903506646544f8fbe25" }, + "LuaSnip": { "branch": "master", "commit": "bc8ec05022743d3f08bda7a76c6bb5e9a9024581" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-calc": { "branch": "main", "commit": "50792f34a628ea6eb31d2c90e8df174671e4e7a0" }, + "cmp-cmdline": { "branch": "main", "commit": "8fcc934a52af96120fe26358985c10c035984b53" }, + "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, + "friendly-snippets": { "branch": "main", "commit": "8d91ba2dc2421a54981115f61b914974f938fa77" }, + "gitsigns.nvim": { "branch": "main", "commit": "f412f51d0eaf0905a2759c8087090071689bb8fb" }, + "impatient.nvim": { "branch": "main", "commit": "c90e273f7b8c50a02f956c24ce4804a47f18162e" }, + "indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" }, + "lazy.nvim": { "branch": "main", "commit": "57cce98dfdb2f2dd05a0567d89811e6d0505e13b" }, + "lsp_signature.nvim": { "branch": "master", "commit": "1882019270be445a8cad4353f1530574f2b2d02d" }, + "lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "b64fdede85fd5e0b720ce722919e0a9b95ed6547" }, + "mason.nvim": { "branch": "main", "commit": "baee73f710fda10d3f946dc98f14b6923f38e3f1" }, + "nord.nvim": { "branch": "main", "commit": "e7d7135a1c5034deea72a5d8d42a25fdb93c85c1" }, + "null-ls.nvim": { "branch": "main", "commit": "defa0518762abb32279d601443344fb9773f9330" }, + "nvim-autopairs": { "branch": "master", "commit": "0fd6519d44eac3a6736aafdb3fe9da916c3701d4" }, + "nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" }, + "nvim-dap": { "branch": "master", "commit": "1dd02e82c77d558e30ba831db4c2e7ed534e874f" }, + "nvim-dap-ui": { "branch": "master", "commit": "56a2df0e96bfa64ebd6967e7cad877a1530633d5" }, + "nvim-lspconfig": { "branch": "master", "commit": "94291c924f0efdbc16ac625cf77ae7d3a7fa5821" }, + "nvim-navic": { "branch": "master", "commit": "5b37ffc213f37acb529eda2b319deee4c5b8c55b" }, + "nvim-notify": { "branch": "master", "commit": "50d037041ada0895aeba4c0215cde6d11b7729c4" }, + "nvim-tree.lua": { "branch": "master", "commit": "45400cd7e02027937cd5e49845545e606ecf5a1f" }, + "nvim-treesitter": { "branch": "master", "commit": "2f3113ff6d554e3fe4da3610135c2f404f7aa270" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "b55fe6175f0001347a433c9df358c8cbf8a4e90f" }, + "nvim-web-devicons": { "branch": "master", "commit": "d92b3f4275f4774c0cb23b8b094a41d1dbb3e78c" }, + "playground": { "branch": "master", "commit": "4044b53c4d4fcd7a78eae20b8627f78ce7dc6f56" }, + "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" }, + "telescope.nvim": { "branch": "master", "commit": "942fe5faef47b21241e970551eba407bc10d9547" }, + "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" }, + "which-key.nvim": { "branch": "main", "commit": "4b73390eec680b4c061ea175eb32c0ff3412271d" } +} \ No newline at end of file diff --git a/.config/nvim/lua/core/options.lua b/.config/nvim/lua/core/options.lua index 01065e6..8ef3a65 100644 --- a/.config/nvim/lua/core/options.lua +++ b/.config/nvim/lua/core/options.lua @@ -12,7 +12,6 @@ local ok, err = pcall(function() -- vim.cmd('colorscheme catppuccin-macchiato') -- vim.cmd('colorscheme aquarium') opt.termguicolors = true - vim.cmd('colorscheme nord') end) if not ok then diff --git a/.config/nvim/lua/core/plugins.lua b/.config/nvim/lua/core/plugins.lua index f86e5c9..390cbc9 100644 --- a/.config/nvim/lua/core/plugins.lua +++ b/.config/nvim/lua/core/plugins.lua @@ -1,260 +1,221 @@ -local ok, packer = pcall(require,"packer") -if not ok then - vim.notify("Failed to load packer\n\n") - return +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end - -vim.api.nvim_create_autocmd("BufWritePost", { - pattern = "*/core/plugins.lua", - callback = function(arg) - vim.cmd("source "..arg.file) - vim.cmd("PackerInstall") - end, -}) - -packer.startup{ - function(use) - use {"wbthomason/packer.nvim"} - - use { - "lewis6991/impatient.nvim", - config = function() require('impatient') end - } - - -- Colorchemes - use 'gbprod/nord.nvim' - -- use {"catppuccin/nvim", as = "catppuccin"} - -- use {"tiagovla/tokyodark.nvim"} - -- use {'Everblush/everblush.nvim',as = 'everblush'} - -- use {"frenzyexists/aquarium-vim"} - -- use {"rebelot/kanagawa.nvim"} - -- use {"projekt0n/github-nvim-theme"} - -- use {"Mofiqul/vscode.nvim"} - - use {"dstein64/vim-startuptime"} - - use { - "kyazdani42/nvim-tree.lua", - requires = { "kyazdani42/nvim-web-devicons" }, - config = function() require("plugins.nvim-tree") end - } - - use { - "rcarriga/nvim-notify", - config = function() - require("notify").setup({ - on_open = function(win) - vim.api.nvim_win_set_config(win,{focusable = false}) - end, - }) - end, - } - - use { - "lewis6991/gitsigns.nvim", - config = function() require("gitsigns").setup{keymaps = {}} end - } +vim.opt.rtp:prepend(lazypath) - use { - "akinsho/toggleterm.nvim", tag = 'v2.*', - config = function() require("toggleterm").setup() end - } - - use { - "windwp/nvim-autopairs", - config = function() require("nvim-autopairs").setup() end - } - - use { - "lukas-reineke/indent-blankline.nvim", - config = function() - require("indent_blankline").setup{ - show_end_of_line = true, - space_char_blankline = " ", - } - end - } - - use { - "numToStr/Comment.nvim", - config = function() require('Comment').setup() end - } - - use { - "folke/todo-comments.nvim", - requires = "nvim-lua/plenary.nvim", - config = function() require("todo-comments").setup() end - } - - use { - "nvim-treesitter/nvim-treesitter", - requires = { - "nvim-treesitter/playground", - "nvim-treesitter/nvim-treesitter-textobjects", - }, - run = function() vim.cmd("TSUpdate") end, - config = function() require("plugins.treesitter") end - } +require("lazy").setup({ + { + "lewis6991/impatient.nvim", + opts = {} + config = function() require('impatient') end + }, - use { - "nvim-telescope/telescope.nvim", - requires = {"nvim-lua/plenary.nvim"}, - config = function() require("plugins.telescope") end - } - - -- Language Server Protocol - use { - "neovim/nvim-lspconfig", - requires = { "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim" }, - config = function() - require("lsp") - require("mason").setup() - end - } - - use { - "hrsh7th/nvim-cmp", - requires = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - "hrsh7th/cmp-buffer", - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-calc", - "hrsh7th/cmp-emoji", - "hrsh7th/cmp-cmdline", - }, - config = function() require("plugins.cmp") end - } - - use { - "onsails/lspkind-nvim", - config = function() - local lspkind = require("lspkind") - lspkind.init{ - mode = 'symbol_text', - preset = 'codicons', - - symbol_map = { - Text = "", - Method = "", - Function = "", - Constructor = "", - Field = "ﰠ", - Variable = "", - Class = "ﴯ", - Interface = "", - Module = "", - Property = "ﰠ", - Unit = "塞", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "פּ", - Event = "", - Operator = "", - TypeParameter = "" - } - } - end - } - - use { - "L3MON4D3/LuaSnip", - requires = {"rafamadriz/friendly-snippets"}, - config = function() require("plugins.luasnip") end - } - - use { - "jose-elias-alvarez/null-ls.nvim", - config = function() require("plugins.null-ls") end - } - - use { - "SmiteshP/nvim-navic", - requires = {"neovim/nvim-lspconfig"}, - config = function() - local navic = require("nvim-navic") - navic.setup { - highlight = false, - separator = " > ", - depth_limit = 0.01, - depth_limit_indicator = "..", - safe_output = true - } - end, - } - - use { - "ray-x/lsp_signature.nvim", - config = function() - local lsp_signature = require("lsp_signature") - - lsp_signature.setup{ - hint_enable = false, - verbose = true - } - - end - } - - use { - "j-hui/fidget.nvim", - config = function() require("fidget").setup() end - } - - -- Debug Adapter Protocol - use { - "mfussenegger/nvim-dap", - requires = { - "arywz11/DAPInstall.nvim", - "rcarriga/nvim-dap-ui" - }, - config = function() require("plugins.dap") end, - } - - end, - - config = { - display = { - open_fn = function() - return require("packer.util").float{border = "rounded"} - end - } - } -} - - -local function bootstrap() - local fn = vim.fn - local packer_install_path = - fn.stdpath("data").."/site/pack/packer/opt/packer.nvim" - local not_installed = fn.empty(fn.glob(packer_install_path)) == 1 - - if not_installed then - print("`packer.nvim` is not installed, installing...") - local repo = "https://github.com/wbthomason/packer.nvim" - vim.cmd(("!git clone %s %s"):format(repo, packer_install_path)) - end - - vim.cmd("packadd packer.nvim") - require("packer").startup { - load, - config = { - git = {clone_timeout = 240}, - }, - } + -- Colorchemes + { + "gbprod/nord.nvim", + priority = 1000, + config = function() + vim.cmd.colorscheme "nord" + end + }, + -- use {"catppuccin/nvim", as = "catppuccin"} + -- use {"tiagovla/tokyodark.nvim"} + -- use {'Everblush/everblush.nvim',as = 'everblush'} + -- use {"frenzyexists/aquarium-vim"} + -- use {"rebelot/kanagawa.nvim"} + -- use {"projekt0n/github-nvim-theme"} + -- use {"Mofiqul/vscode.nvim"} - if not_installed then - vim.cmd("PackerSync") - end -end + { + "kyazdani42/nvim-tree.lua", + dependencies = { "kyazdani42/nvim-web-devicons" }, + config = function() require("plugins.nvim-tree") end + }, + + { + "rcarriga/nvim-notify", + config = function() + require("notify").setup({ + on_open = function(win) + vim.api.nvim_win_set_config(win,{focusable = false}) + end, + }) + end + }, -return bootstrap + { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + } + }, + + { "windwp/nvim-autopairs", opts = {} }, + + { + "lukas-reineke/indent-blankline.nvim", + opts = { + char = '┊', + show_trailing_blankline_indent = false, + } + }, + + { + "numToStr/Comment.nvim", + opts = {} + }, + + { + "folke/todo-comments.nvim", + dependencies = "nvim-lua/plenary.nvim", + opts = {} + }, + + { + "nvim-treesitter/nvim-treesitter", + dependencies = { + "nvim-treesitter/playground", + "nvim-treesitter/nvim-treesitter-textobjects", + }, + build = function() vim.cmd("TSUpdate") end, + config = function() require("plugins.treesitter") end + }, + + { + "nvim-telescope/telescope.nvim", + dependencies = {"nvim-lua/plenary.nvim"}, + config = function() require("plugins.telescope") end + }, + + -- Language Server Protocol + { + "neovim/nvim-lspconfig", + dependencies = { + {"williamboman/mason.nvim", opts}, + "williamboman/mason-lspconfig.nvim", + {"j-hui/fidget.nvim", opts = {}} + }, + config = function() + require("lsp") + require("mason").setup() + end + }, + + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + "hrsh7th/cmp-buffer", + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-calc", + "hrsh7th/cmp-emoji", + "hrsh7th/cmp-cmdline", + }, + config = function() require("plugins.cmp") end + }, + + { + "onsails/lspkind-nvim", + config = function() + require("lspkind").init{ + mode = 'symbol_text', + preset = 'codicons', + + symbol_map = { + Text = "", + Method = "", + Function = "", + Constructor = "", + Field = "ﰠ", + Variable = "", + Class = "ﴯ", + Interface = "", + Module = "", + Property = "ﰠ", + Unit = "塞", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "פּ", + Event = "", + Operator = "", + TypeParameter = "" + } + } + end + }, + + {"folke/which-key.nvim", opts = {}, lazy = true}, + + { + "L3MON4D3/LuaSnip", + dependencies = {"rafamadriz/friendly-snippets"}, + config = function() require("plugins.luasnip") end + }, + + { + "jose-elias-alvarez/null-ls.nvim", + config = function() require("plugins.null-ls") end + }, + + { + "SmiteshP/nvim-navic", + dependencies = {"neovim/nvim-lspconfig"}, + config = function() + local navic = require("nvim-navic") + navic.setup { + highlight = false, + separator = " > ", + depth_limit = 0.01, + depth_limit_indicator = "..", + safe_output = true + } + end, + }, + + { + "ray-x/lsp_signature.nvim", + config = function() + local lsp_signature = require("lsp_signature") + + lsp_signature.setup{ + hint_enable = false, + verbose = true + } + + end + }, + + -- Debug Adapter Protocol + { + "mfussenegger/nvim-dap", + dependencies = { + "arywz11/DAPInstall.nvim", + "rcarriga/nvim-dap-ui" + }, + config = function() require("plugins.dap") end, + } +}) diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index d2e0714..fd85578 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -32,12 +32,10 @@ capabilities.textDocument.foldingRange = { lineFoldingOnly = true, } - local navic = require("nvim-navic") vim.g.lsp_capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - vim.g.lsp_on_attach = function(client,bufnr) print("Attaching to:",client.name) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr,...) end diff --git a/.config/nvim/lua/lsp/servers/clangd.lua b/.config/nvim/lua/lsp/servers/clangd.lua index 21e163a..579d568 100644 --- a/.config/nvim/lua/lsp/servers/clangd.lua +++ b/.config/nvim/lua/lsp/servers/clangd.lua @@ -1,14 +1,14 @@ return { - filetypes = {"c","cpp","objc","objcpp"}, - - on_attach = vim.g.lsp_on_attach, - handlers = vim.g.lsp_handlers, - capabilities = vim.g.lsp_capabilities, - - root_dir = require"lspconfig.util".root_pattern{ - "CMakeList.txt", - "compile_flags.txt", - ".git", - vim.fn.getcwd() - } + filetypes = {"c","cpp","objc","objcpp"}, + + on_attach = vim.g.lsp_on_attach, + handlers = vim.g.lsp_handlers, + capabilities = vim.g.lsp_capabilities, + + root_dir = require"lspconfig.util".root_pattern{ + "CMakeList.txt", + "compile_flags.txt", + ".git", + vim.fn.getcwd() + } } diff --git a/.config/nvim/lua/lsp/servers/cssls.lua b/.config/nvim/lua/lsp/servers/cssls.lua index 902e335..819f2dc 100644 --- a/.config/nvim/lua/lsp/servers/cssls.lua +++ b/.config/nvim/lua/lsp/servers/cssls.lua @@ -1,13 +1,13 @@ return { - cmd = { vim.g.lsp_path .. "vscode-css-language-server", "--stdio"}, - filetypes = {"css", "scss", "less" }, - - on_attach = vim.g.lsp_on_attach, - handlers = vim.g.lsp_handler, - capabilities = vim.g.lsp_capabilities, - - root_dir = require"lspconfig.util".root_pattern{ - "package.json", - ".git" - }, + cmd = { vim.g.lsp_path .. "vscode-css-language-server", "--stdio"}, + filetypes = {"css", "scss", "less" }, + + on_attach = vim.g.lsp_on_attach, + handlers = vim.g.lsp_handler, + capabilities = vim.g.lsp_capabilities, + + root_dir = require"lspconfig.util".root_pattern{ + "package.json", + ".git" + }, } diff --git a/.config/nvim/lua/lsp/servers/gopls.lua b/.config/nvim/lua/lsp/servers/gopls.lua index 032e9fc..8a7928f 100644 --- a/.config/nvim/lua/lsp/servers/gopls.lua +++ b/.config/nvim/lua/lsp/servers/gopls.lua @@ -1,14 +1,14 @@ return { - cmd = {vim.g.lsp_path .. "gopls"}, - filetypes = {"go", "gomod"}, - - on_attach = vim.g.lsp_on_attach, - handlers = vim.g.lsp_handler, - capabilities = vim.g.lsp_capabilities, - - root_dir = require"lspconfig.util".root_pattern{ - "go.mod", - ".git", - vim.fn.getcwd(), - }, + cmd = {vim.g.lsp_path .. "gopls"}, + filetypes = {"go", "gomod"}, + + on_attach = vim.g.lsp_on_attach, + handlers = vim.g.lsp_handler, + capabilities = vim.g.lsp_capabilities, + + root_dir = require"lspconfig.util".root_pattern{ + "go.mod", + ".git", + vim.fn.getcwd(), + }, } diff --git a/.config/nvim/lua/lsp/servers/html.lua b/.config/nvim/lua/lsp/servers/html.lua index 6ae86b4..5fbd646 100644 --- a/.config/nvim/lua/lsp/servers/html.lua +++ b/.config/nvim/lua/lsp/servers/html.lua @@ -1,17 +1,17 @@ return { - cmd = {vim.g.lsp_path .. "vscode-html-language-server", "--stdio"}, - filetypes = {"html"}, - - on_attach = vim.g.lsp_on_attach, - handlers = vim.g.lsp_handler, - capabilities = vim.g.lsp_capabilities, + cmd = {vim.g.lsp_path .. "vscode-html-language-server", "--stdio"}, + filetypes = {"html"}, + + on_attach = vim.g.lsp_on_attach, + handlers = vim.g.lsp_handler, + capabilities = vim.g.lsp_capabilities, - init_options = { - configurationSection = { "html", "css", "javascript" }, - embeddedLanguages = { - css = true, - javascript = true - }, - provideFormatter = true + init_options = { + configurationSection = { "html", "css", "javascript" }, + embeddedLanguages = { + css = true, + javascript = true }, + provideFormatter = true + }, } diff --git a/.config/nvim/lua/lsp/servers/pylsp.lua b/.config/nvim/lua/lsp/servers/pylsp.lua new file mode 100644 index 0000000..0e11004 --- /dev/null +++ b/.config/nvim/lua/lsp/servers/pylsp.lua @@ -0,0 +1,19 @@ +return { + cmd = {vim.g.lsp_path .. "pylsp"}, + filetypes = {"python"}, + + on_attach = vim.g.lsp_on_attach, + handlers = vim.g.lsp_handlers, + capabilities = vim.g.lsp_capabilities, + + settings = { + pylsp = { + plugins = { + pycodestyle = { + ignore = {'W391','W293'}, + maxLineLength = 90 + } + } + } + }, +} diff --git a/.config/nvim/lua/lsp/servers/pyright.lua b/.config/nvim/lua/lsp/servers/pyright.lua deleted file mode 100644 index 53c6e85..0000000 --- a/.config/nvim/lua/lsp/servers/pyright.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - cmd = {vim.g.lsp_path .. "pyright-langserver", "--stdio"}, - filetypes = {"python"}, - - on_attach = vim.g.lsp_on_attach, - handlers = vim.g.lsp_handlers, - capabilities = vim.g.lsp_capabilities, -} diff --git a/.config/nvim/lua/lsp/servers/tsserver.lua b/.config/nvim/lua/lsp/servers/tsserver.lua index 4f0c942..de489f7 100644 --- a/.config/nvim/lua/lsp/servers/tsserver.lua +++ b/.config/nvim/lua/lsp/servers/tsserver.lua @@ -1,16 +1,16 @@ return { - cmd = {vim.g.lsp_path .. "typescript-language-server", "--stdio"}, - filetypes = {"javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx"}, - - on_attach = vim.g.lsp_on_attach, - handlers = vim.g.lsp_handlers, - capabilities = vim.g.lsp_capabilities, + cmd = {vim.g.lsp_path .. "typescript-language-server", "--stdio"}, + filetypes = {"javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx"}, + + on_attach = vim.g.lsp_on_attach, + handlers = vim.g.lsp_handlers, + capabilities = vim.g.lsp_capabilities, - init_options = {hostInfo = "neovim"}, - root_dir = require"lspconfig.util".root_pattern{ - "package.json", - "tsconfig.json", - "jsconfig.json", - ".git", - }, + init_options = {hostInfo = "neovim"}, + root_dir = require"lspconfig.util".root_pattern{ + "package.json", + "tsconfig.json", + "jsconfig.json", + ".git", + }, } diff --git a/.config/nvim/lua/plugins/luasnip.lua b/.config/nvim/lua/plugins/luasnip.lua new file mode 100644 index 0000000..78b96d9 --- /dev/null +++ b/.config/nvim/lua/plugins/luasnip.lua @@ -0,0 +1,71 @@ +local ok, ls = pcall(require,"luasnip") +if not ok then + vim.notify("Failed load luasnip\n") +end + +local s = ls.s + +local fmt = require("luasnip.extras.fmt").fmt + +local i = ls.insert_node + +local rep = require("luasnip.extras").rep + +ls.setup({ + history = true, + + update_events = "TextChanged,TextChangedI", + + enable_autosnippets = true, +}) + + +ls.add_snippets("lua", { + s( + "reqm", + fmt( + [[ + local ok, {} = pcall(require,"{}") + if not ok then + vim.notify("Failed load {}\n") + end + ]], { + i(1, "mod"), + i(2), + rep(2), + } + ) + ) +}) + +-- Configuring keybinds +local mapopts = { silent = true, expr = true } + +-- c-k is expansion key +vim.keymap.set({ "s", "i" }, "", function() + if ls.expand_or_jumpable() then + ls.expand_or_jump() + else + return "" + end +end, mapopt) + +-- c-j is jump backwards key +vim.keymap.set({ "s", "i" }, "", function() + if ls.jumpable(-1) then + ls.jump(-1) + else + return "" + end +end, mapopt) + +-- c-l is selecting withing a list of options +vim.keymap.set({ "s", "i" }, "", function() + if ls.choice_active() then + ls.change_choice(1) + else + return ""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - }, - n = { - ["q"] = actions.close, - } - }, - } + defaults = { + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + }, + n = { + ["q"] = actions.close, + } + }, + } } local keymap = vim.keymap.set @@ -31,11 +31,9 @@ keymap("n",";",builtin.current_buffer_fuzzy_find) keymap("n","b",builtin.buffers) keymap("n","e",function() - builtin.diagnostics{bufnr = 0,severity_limit = "WARN"} + builtin.diagnostics{bufnr = 0,severity_limit = "WARN"} end) + keymap("n","E",function() - builtin.diagnostics{severity_limit = "WARN"} + builtin.diagnostics{severity_limit = "WARN"} end) - - -