diff options
author | Max Christian Pohle | 2024-05-12 21:01:00 +0200 |
---|---|---|
committer | Max Christian Pohle | 2024-05-12 21:01:00 +0200 |
commit | eec48ff71881d8757b79dcd95aac9dac4d71bf72 (patch) | |
tree | 8e21c80a8fecbcf7a6b36c3db1d2aa061bda1959 /init-mini.lua | |
parent | f3eb203b4ad79090e36982e7b417c0cf0de52646 (diff) | |
download | vim-eec48ff71881d8757b79dcd95aac9dac4d71bf72.tar.bz2 vim-eec48ff71881d8757b79dcd95aac9dac4d71bf72.zip |
tidied this repo up and uploaded my new nvim from scratch config
Diffstat (limited to 'init-mini.lua')
-rw-r--r-- | init-mini.lua | 90 |
1 files changed, 90 insertions, 0 deletions
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 @@ | |||
1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | ||
2 | if not (vim.uv or vim.loop).fs_stat(lazypath) then | ||
3 | vim.fn.system({ | ||
4 | "git", | ||
5 | "clone", | ||
6 | "--filter=blob:none", | ||
7 | "https://github.com/folke/lazy.nvim.git", | ||
8 | "--branch=stable", -- latest stable release | ||
9 | lazypath, | ||
10 | }) | ||
11 | end | ||
12 | vim.opt.rtp:prepend(lazypath) | ||
13 | require("lazy").setup(plugins, opts) | ||
14 | |||
15 | |||
16 | vim.opt.number = true | ||
17 | |||
18 | vim.opt.shiftwidth = 2 | ||
19 | vim.opt.tabstop = 2 | ||
20 | vim.opt.softtabstop = 2 | ||
21 | |||
22 | |||
23 | require('gitsigns').setup() | ||
24 | |||
25 | local cmp = require'cmp' | ||
26 | cmp.setup({ | ||
27 | snippet = { | ||
28 | -- REQUIRED - you must specify a snippet engine | ||
29 | expand = function(args) | ||
30 | require('luasnip').lsp_expand(args.body) -- For `luasnip` users. | ||
31 | vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) | ||
32 | end, | ||
33 | }, | ||
34 | mapping = cmp.mapping.preset.insert({ | ||
35 | ['<C-b>'] = cmp.mapping.scroll_docs(-4), | ||
36 | ['<C-f>'] = cmp.mapping.scroll_docs(4), | ||
37 | ['<C-Space>'] = cmp.mapping.complete(), | ||
38 | ['<C-e>'] = cmp.mapping.abort(), | ||
39 | ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. | ||
40 | }), | ||
41 | sources = cmp.config.sources({ | ||
42 | { name = 'nvim_lsp' }, | ||
43 | { name = 'luasnip' }, -- For luasnip users. | ||
44 | }, { | ||
45 | { name = 'buffer' }, | ||
46 | }) | ||
47 | }) | ||
48 | |||
49 | -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). | ||
50 | cmp.setup.cmdline({ '/', '?' }, { | ||
51 | mapping = cmp.mapping.preset.cmdline(), | ||
52 | sources = { | ||
53 | { name = 'buffer' } | ||
54 | } | ||
55 | }) | ||
56 | |||
57 | -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). | ||
58 | cmp.setup.cmdline(':', { | ||
59 | mapping = cmp.mapping.preset.cmdline(), | ||
60 | sources = cmp.config.sources({ | ||
61 | { name = 'path' } | ||
62 | }, { | ||
63 | { name = 'cmdline' } | ||
64 | }), | ||
65 | matching = { disallow_symbol_nonprefix_matching = false } | ||
66 | }) | ||
67 | |||
68 | |||
69 | require'cmp'.setup { | ||
70 | sources = { | ||
71 | { name = 'nvim_lua' } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | -- Set up lspconfig. | ||
76 | local capabilities = require('cmp_nvim_lsp').default_capabilities() | ||
77 | require("neodev").setup({ | ||
78 | capabilities = capabilities, | ||
79 | }) | ||
80 | -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled. | ||
81 | require('lspconfig').lua_ls.setup({ | ||
82 | capabilities = capabilities, | ||
83 | settings = { | ||
84 | Lua = { | ||
85 | diagnostics = { | ||
86 | globals = {'vim'} | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | }) | ||