-- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info 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 ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- NOTE: General -- 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically { 'm4xshen/autoclose.nvim', opts = {} }, { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = {} }, -- { -- "folke/tokyonight.nvim", -- priority = 1000, -- config = function() -- require('tokyonight').setup { -- styles = { -- comments = { italic = false }, -- Disable italics in comments -- }, -- } -- vim.cmd.colorscheme 'tokyonight-night' -- end -- }, { 'navarasu/onedark.nvim', config = function () require('onedark').load() end }, -- NOTE: Telescope -- { 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim', { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make', cond = function() return vim.fn.executable 'make' == 1 end, }, }, config = function() local actions = require('telescope.actions') local actions_state = require('telescope.actions.state') require('telescope').setup({ defaults = { mappings = require('config.keymaps').telescope_defaults(actions) }, pickers = { find_files = { mappings = { i = { [""] = function(prompt_bufnr) local selection = actions_state.get_selected_entry() actions.close(prompt_bufnr) local bufname = vim.api.nvim_buf_get_name(0) local is_empty = bufname == "" and not vim.bo.modified if is_empty then vim.cmd("edit" .. vim.fn.fnameescape(selection.path or selection.filename)) else vim.cmd("tabnew " .. vim.fn.fnameescape(selection.path or selection.filename)) end end } } } } }) pcall(require('telescope').load_extension, 'fzf') end }, -- NOTE: AutoCompletions, LSP -- { 'saghen/blink.cmp', event = 'VimEnter', version = '1.*', dependencies = { { 'L3MON4D3/LuaSnip', version = '2.*', build = (function() if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then return end return 'make install_jsregexp' end)(), dependencies = { -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets -- { -- 'rafamadriz/friendly-snippets', -- config = function() -- require('luasnip.loaders.from_vscode').lazy_load() -- end, -- }, }, opts = {}, }, 'folke/lazydev.nvim', }, ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { keymap = { preset = 'default', [''] = { 'select_prev' }, [''] = { 'select_next' }, [''] = { 'select_and_accept', 'fallback'}, -- [''] = { 'hide' }, }, appearance = { nerd_font_variant = 'mono' }, completion = { -- By default, you may press `` to show the documentation. -- Optionally, set `auto_show = true` to show the documentation after a delay. documentation = { auto_show = false, auto_show_delay_ms = 500 }, }, sources = { default = { 'lsp', 'path', 'snippets', 'lazydev' }, providers = { lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, }, }, snippets = { preset = 'luasnip' }, -- Blink.cmp includes an optional, recommended rust fuzzy matcher, -- which automatically downloads a prebuilt binary when enabled. -- -- By default, we use the Lua implementation instead, but you may enable -- the rust implementation via `'prefer_rust_with_warning'` -- -- See :h blink-cmp-config-fuzzy for more information fuzzy = { implementation = 'lua' }, -- Shows a signature help window while you type arguments for a function signature = { enabled = true }, }, }, { -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins -- used for completion, annotations and signatures of Neovim apis 'folke/lazydev.nvim', ft = 'lua', opts = { library = { -- Load luvit types when the `vim.uv` word is found { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, }, }, }, { "williamboman/mason.nvim", opts = {} }, { 'neovim/nvim-lspconfig', dependencies = { { "williamboman/mason.nvim", opts = {} }, 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Useful status updates for LSP. { 'j-hui/fidget.nvim', opts = {} }, -- completeions 'saghen/blink.cmp', }, config = function() vim.diagnostic.config { severity_sort = true, float = { border = 'rounded', source = 'if_many' }, underline = { severity = vim.diagnostic.severity.ERROR }, signs = vim.g.have_nerd_font and { text = { [vim.diagnostic.severity.ERROR] = '󰅚 ', [vim.diagnostic.severity.WARN] = '󰀪 ', [vim.diagnostic.severity.INFO] = '󰋽 ', [vim.diagnostic.severity.HINT] = '󰌶 ', }, } or {}, virtual_text = { source = 'if_many', spacing = 2, format = function(diagnostic) local diagnostic_message = { [vim.diagnostic.severity.ERROR] = diagnostic.message, [vim.diagnostic.severity.WARN] = diagnostic.message, [vim.diagnostic.severity.INFO] = diagnostic.message, [vim.diagnostic.severity.HINT] = diagnostic.message, } return diagnostic_message[diagnostic.severity] end, }, } local capabilities = require('blink.cmp').get_lsp_capabilities() local servers = { -- clangd = {}, -- pyright = {}, rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`ts_ls`) will work just fine -- ts_ls = {}, -- lua_ls = { -- cmd = { ... }, -- filetypes = { ... }, -- capabilities = {}, settings = { Lua = { completion = { callSnippet = 'Replace', }, -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings -- diagnostics = { disable = { 'missing-fields' } }, }, }, }, } local ensure_installed = vim.tbl_keys(servers or {}) require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-lspconfig').setup { ensure_installed = {}, -- explicitly set to an empty table (already done using mason tool installer) automatic_installation = false, handlers = { function(server_name) local server = servers[server_name] or {} -- This handles overriding only values explicitly passed -- by the server configuration above. Useful when disabling -- certain features of an LSP (for example, turning off formatting for ts_ls) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) require('lspconfig')[server_name].setup(server) end, } } end }, -- NOTE: TreeSitter { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', main = 'nvim-treesitter.configs', -- Sets main module to use for opts opts = { ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'rust' }, auto_install = true, highlight = { enable = true, -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. -- If you are experiencing weird indenting issues, add the language to -- the list of additional_vim_regex_highlighting and disabled languages for indent. -- additional_vim_regex_highlighting = { 'ruby' }, }, -- indent = { enable = true, disable = { 'ruby' } }, }, -- There are additional nvim-treesitter modules that you can use to interact -- with nvim-treesitter. You should go explore a few and see what interests you: -- -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects }, -- NOTE: UI -- { 'nanozuki/tabby.nvim', dependencies = 'nvim-tree/nvim-web-devicons', config = function() local theme = { -- this is carbonfox theme fill = 'TabLineFill', head = { fg = '#75beff', bg = '#1c1e26' }, current_tab = { fg = '#1c1e26', bg = '#75beff' }, tab = { fg = '#c5cdd9', bg = '#1c1e26' }, win = { fg = '#1c1e26', bg = '#75beff' }, tail = { fg = '#75beff', bg = '#1c1e26' }, } require('tabby.tabline').set(function(line) return { { { '  ', hl = theme.head }, line.sep('', theme.head, theme.fill), }, line.tabs().foreach(function(tab) local hl = tab.is_current() and theme.current_tab or theme.tab -- remove count of wins in tab with [n+] included in tab.name() local name = tab.name() local index = string.find(name, "%[%d") local tab_name = index and string.sub(name, 1, index - 1) or name -- indicate if any of buffers in tab have unsaved changes local modified = false local win_ids = require('tabby.module.api').get_tab_wins(tab.id) for _, win_id in ipairs(win_ids) do if pcall(vim.api.nvim_win_get_buf, win_id) then local bufid = vim.api.nvim_win_get_buf(win_id) if vim.api.nvim_buf_get_option(bufid, "modified") then modified = true break end end end return { line.sep('', hl, theme.fill), tab_name, modified and '', line.sep('', hl, theme.fill), hl = hl, margin = ' ', } end), line.spacer(), { line.sep('', theme.tail, theme.fill), { '  ', hl = theme.tail }, }, hl = theme.fill, } end) end }, { 'lewis6991/gitsigns.nvim', opts = { signs = { add = { text = '┃' }, change = { text = '┃' }, delete = { text = '_' }, topdelete = { text = '‾' }, changedelete = { text = '~' }, untracked = { text = '┆' }, }, signs_staged = { add = { text = '┃' }, change = { text = '┃' }, delete = { text = '_' }, topdelete = { text = '‾' }, changedelete = { text = '~' }, untracked = { text = '┆' }, }, signs_staged_enable = true, signcolumn = true } }, { 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons' }, opts = {} } })