init.lua (2670B)
1 vim.cmd([[ 2 set runtimepath^=~/.vim runtimepath+=~/.vim/after 3 let &packpath = &runtimepath 4 call setenv("MYOLDVIMRC", "~/.vim/vimrc") 5 source $MYOLDVIMRC 6 ]]) 7 8 -- Install Lazy 9 local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 10 if not vim.uv.fs_stat(lazypath) then 11 vim.fn.system({ 12 "git", 13 "clone", 14 "--filter=blob:none", 15 "https://github.com/folke/lazy.nvim.git", 16 "--branch=stable", -- latest stable release 17 lazypath, 18 }) 19 end 20 21 vim.opt.rtp:prepend(lazypath) 22 23 require('lazy').setup('plugins', { 24 performance = { 25 rtp = { 26 reset = false, 27 }, 28 }, 29 }) 30 31 -- Set completeopt to have a better completion experience 32 vim.o.completeopt = 'menuone,noselect' 33 34 -- [[ Basic Keymaps ]] 35 -- Set <space> as the leader key 36 -- See `:help mapleader` 37 -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) 38 vim.g.mapleader = ' ' 39 40 -- Keymaps for better default experience 41 -- See `:help vim.keymap.set()` 42 vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true }) 43 44 -- [[ Highlight on yank ]] 45 -- See `:help vim.highlight.on_yank()` 46 local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) 47 vim.api.nvim_create_autocmd('TextYankPost', { 48 callback = function() 49 vim.highlight.on_yank() 50 end, 51 group = highlight_group, 52 pattern = '*', 53 }) 54 55 56 -- Diagnostic keymaps 57 vim.keymap.set('n', '[d', function() vim.diagnostic.jump({ count = -1, float = true }) end) 58 vim.keymap.set('n', ']d', function() vim.diagnostic.jump({ count = 1, float = true }) end) 59 vim.keymap.set('n', ']e', 60 function() vim.diagnostic.jump({ count = 1, float = true, severity = vim.diagnostic.severity.ERROR }) end) 61 vim.keymap.set('n', '[e', 62 function() vim.diagnostic.jump({ count = -1, float = true, severity = vim.diagnostic.severity.ERROR }) end) 63 vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float) 64 vim.keymap.set('n', '<leader>q', function() vim.diagnostic.setloclist({ severity = vim.diagnostic.severity.ERROR }) end) 65 66 -- 'i' that indents correctly on empty lines 67 vim.keymap.set('n', 'i', function() 68 if #vim.fn.getline(".") == 0 then 69 return [["_cc]] 70 else 71 return "i" 72 end 73 end, { expr = true }) 74 75 require('llm') 76 require('netrw_target') 77 78 vim.cmd([[ 79 nnoremap <leader><C-e><C-u> :<c-u>exe "vsplit ~/.vim/snippets/"..&filetype..".snippets"<CR> 80 ]]) 81 82 vim.api.nvim_create_autocmd('LspAttach', { 83 group = vim.api.nvim_create_augroup('UserLspConfig', {}), 84 callback = function(ev) 85 local client = vim.lsp.get_client_by_id(ev.data.client_id) 86 if client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then 87 vim.lsp.inlay_hint.enable(true, { bufnr = ev.buf }) 88 end 89 end, 90 })