From eec48ff71881d8757b79dcd95aac9dac4d71bf72 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Sun, 12 May 2024 21:01:00 +0200 Subject: tidied this repo up and uploaded my new nvim from scratch config --- init-mini.lua | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 init-mini.lua (limited to 'init-mini.lua') diff --git a/init-mini.lua b/init-mini.lua new file mode 100644 index 0000000..0ac8d1e --- /dev/null +++ b/init-mini.lua @@ -0,0 +1,90 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or 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.opt.rtp:prepend(lazypath) +require("lazy").setup(plugins, opts) + + +vim.opt.number = true + +vim.opt.shiftwidth = 2 +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 + + +require('gitsigns').setup() + +local cmp = require'cmp' +cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + }) +}) + +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }), + matching = { disallow_symbol_nonprefix_matching = false } +}) + + +require'cmp'.setup { + sources = { + { name = 'nvim_lua' } + } +} + +-- Set up lspconfig. +local capabilities = require('cmp_nvim_lsp').default_capabilities() +require("neodev").setup({ + capabilities = capabilities, +}) +-- Replace with each lsp server you've enabled. +require('lspconfig').lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { + globals = {'vim'} + } + } + } +}) -- cgit v1.2.3