init.lua (1527B)
1 -- Load my vim config 2 vim.cmd([[ 3 set runtimepath^=~/.vim runtimepath+=~/.vim/after 4 let &packpath = &runtimepath 5 call setenv("MYOLDVIMRC", "~/.vim/vimrc") 6 source $MYOLDVIMRC 7 ]]) 8 9 -- Set <space> as the leader key 10 -- See `:help mapleader` 11 -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) 12 vim.g.mapleader = ' ' 13 vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true }) 14 15 -- Install Lazy 16 local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' 17 if not (vim.uv or vim.loop).fs_stat(lazypath) then 18 local lazyrepo = 'https://github.com/folke/lazy.nvim.git' 19 local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } 20 if vim.v.shell_error ~= 0 then 21 error('Error cloning lazy.nvim:\n' .. out) 22 end 23 end 24 vim.opt.rtp:prepend(lazypath) 25 26 -- Load everything from ./lua/plugins.lua, ./lua/plugins/*.lua 27 require('lazy').setup('plugins', { 28 performance = { 29 rtp = { 30 reset = false, 31 }, 32 }, 33 }) 34 35 -- Set completeopt to have a better completion experience 36 vim.o.completeopt = 'menuone,noselect' 37 38 require('highlight_on_yank') 39 require('mappings') 40 require('netrw_target') 41 42 vim.api.nvim_create_autocmd('LspAttach', { 43 group = vim.api.nvim_create_augroup('UserLspConfig', {}), 44 callback = function(ev) 45 local client = vim.lsp.get_client_by_id(ev.data.client_id) 46 if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then 47 vim.lsp.inlay_hint.enable(true, { bufnr = ev.buf }) 48 end 49 end, 50 })