local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) end end vim.opt.rtp:prepend(lazypath) require('lazy').setup({ 'tpope/vim-sleuth', 'lambdalisue/suda.vim', 'lukas-reineke/indent-blankline.nvim', { 'windwp/nvim-autopairs', opts = {} }, { 'rainglow/vim', config = function() vim.cmd [[colorscheme bold-contrast]] end }, { 'nvim-telescope/telescope.nvim', tag = '0.1.8', dependencies = { 'nvim-lua/plenary.nvim', }, }, { 'folke/noice.nvim', event = 'VeryLazy', dependencies = { 'MunifTanjim/nui.nvim', 'hrsh7th/nvim-cmp', }, config = function() require('noice').setup({ lsp = { override = { ['vim.lsp.util.convert_input_to_markdown_lines'] = true, ['cmp.entry.get_documentation'] = true }, }, presets = { bottom_search = true, command_palette = true, long_message_to_split = true, inc_rename = false, lsp_doc_border = false, } }) end, }, { 'Bilal2453/luvit-meta', lazy = true }, { 'neovim/nvim-lspconfig', dependencies = { { 'j-hui/fidget.nvim', opts = {} }, { 'williamboman/mason.nvim', config = true }, 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', 'hrsh7th/cmp-nvim-lsp', }, config = function() vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), callback = function(event) local map = function(keys, func, desc, mode) mode = mode or 'n' vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') map('rn', vim.lsp.buf.rename, '[R]e[n]ame') map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') local client = vim.lsp.get_client_by_id(event.data.client_id) if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight, }) vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references, }) vim.api.nvim_create_autocmd('LspDetach', { group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), callback = function(event2) vim.lsp.buf.clear_references() vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } end, }) end if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') end end, }) local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) local servers = { clangd = {}, rust_analyzer = {}, lua_ls = { settings = { Lua = { completion = { callSnippet = 'Replace', }, }, }, }, } require('mason').setup() local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { 'stylua', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-lspconfig').setup { handlers = { function(server_name) local server = servers[server_name] or {} server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) require('lspconfig')[server_name].setup(server) end, }, } end, }, { 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons', }, config = function() local lualine = require('lualine') local colors = { bg = '#00000000', fg = '#bbc2cf', yellow = '#ECBE7B', cyan = '#008080', darkblue = '#081633', green = '#98be65', orange = '#FF8800', violet = '#a9a1e1', magenta = '#c678dd', blue = '#51afef', red = '#ec5f67', } local conditions = { buffer_not_empty = function() return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 end, hide_in_width = function() return vim.fn.winwidth(0) > 80 end, check_git_workspace = function() local filepath = vim.fn.expand('%:p:h') local gitdir = vim.fn.finddir('.git', filepath .. ';') return gitdir and #gitdir > 0 and #gitdir < #filepath end, } local config = { options = { component_separators = '', section_separators = '', theme = { normal = { c = { fg = colors.fg, bg = colors.bg } }, inactive = { c = { fg = colors.fg, bg = colors.bg } }, }, }, sections = { lualine_a = {}, lualine_b = {}, lualine_y = {}, lualine_z = {}, lualine_c = {}, lualine_x = {}, }, inactive_sections = { lualine_a = {}, lualine_b = {}, lualine_y = {}, lualine_z = {}, lualine_c = {}, lualine_x = {}, }, } local function ins_left(component) table.insert(config.sections.lualine_c, component) end local function ins_right(component) table.insert(config.sections.lualine_x, component) end ins_left { function() return '▊' end, color = { fg = colors.blue }, padding = { left = 0, right = 1 }, } ins_left { function() return '' end, color = function() local mode_color = { n = colors.red, i = colors.green, v = colors.blue, [''] = colors.blue, V = colors.blue, c = colors.magenta, no = colors.red, s = colors.orange, S = colors.orange, [''] = colors.orange, ic = colors.yellow, R = colors.violet, Rv = colors.violet, cv = colors.red, ce = colors.red, r = colors.cyan, rm = colors.cyan, ['r?'] = colors.cyan, ['!'] = colors.red, t = colors.red, } return { fg = mode_color[vim.fn.mode()] } end, padding = { right = 1 }, } ins_left { 'filesize', cond = conditions.buffer_not_empty, } ins_left { 'filename', cond = conditions.buffer_not_empty, color = { fg = colors.magenta, gui = 'bold' }, } ins_left { 'location' } ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } } ins_left { 'diagnostics', sources = { 'nvim_diagnostic' }, symbols = { error = ' ', warn = ' ', info = ' ' }, diagnostics_color = { error = { fg = colors.red }, warn = { fg = colors.yellow }, info = { fg = colors.cyan }, }, } ins_left { function() return '%=' end, } ins_left { function() local msg = 'No Active Lsp' local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') local clients = vim.lsp.get_active_clients() if next(clients) == nil then return msg end for _, client in ipairs(clients) do local filetypes = client.config.filetypes if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then return client.name end end return msg end, icon = ' LSP:', color = { fg = '#ffffff', gui = 'bold' }, } ins_right { 'o:encoding', fmt = string.upper, cond = conditions.hide_in_width, color = { fg = colors.green, gui = 'bold' }, } ins_right { 'fileformat', fmt = string.upper, icons_enabled = false, color = { fg = colors.green, gui = 'bold' }, } ins_right { 'branch', icon = '', color = { fg = colors.violet, gui = 'bold' }, } ins_right { 'diff', symbols = { added = ' ', modified = '󰝤 ', removed = ' ' }, diff_color = { added = { fg = colors.green }, modified = { fg = colors.orange }, removed = { fg = colors.red }, }, cond = conditions.hide_in_width, } ins_right { function() return '▊' end, color = { fg = colors.blue }, padding = { left = 1 }, } lualine.setup(config) end }, }) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' vim.opt.number = true vim.opt.mouse = 'a' vim.opt.showmode = false vim.opt.breakindent = false vim.opt.wrap = false vim.opt.undofile = false vim.opt.inccommand = 'split' vim.opt.clipboard = 'unnamedplus' vim.opt.cursorline = true vim.opt.scrolloff = 10 vim.opt.ignorecase = true vim.opt.smartcase = true vim.opt.splitright = true vim.opt.splitbelow = true vim.opt.tabstop = 4 vim.opt.shiftwidth = 4 vim.opt.expandtab = true vim.opt.smartindent = true vim.opt.autoindent = true vim.opt.termguicolors = true vim.opt.list = true vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } local telescope_builtin = require('telescope.builtin') vim.keymap.set('n', 'ff', telescope_builtin.find_files) vim.keymap.set('n', 'fg', telescope_builtin.live_grep) vim.keymap.set('n', 'fb', telescope_builtin.buffers) vim.keymap.set('n', 'fh', telescope_builtin.help_tags) vim.keymap.set('n', '', 'nohlsearch') vim.keymap.set('t', '', '') vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), callback = function() vim.highlight.on_yank() end, }) vim.api.nvim_command [[ hi Normal guibg=NONE hi Visual guibg=#212121 hi NonText guibg=NONE hi StatusLine guibg=#000000 hi SignColumn guibg=#000000 guifg=#000000 hi EndOfBuffer guibg=NONE hi VertSplit guifg=#00000000 guibg=NONE hi Comment gui=italic hi Macro gui=bold ]]