vim.o.number = true vim.o.wrap = false vim.o.tabstop = 4 vim.o.shiftwidth = 4 vim.o.smartcase = true vim.o.ignorecase = true vim.o.hlsearch = false vim.o.signcolumn = 'yes' vim.g.mapleader = ',' -- Set up 'mini.deps' (customize to your liking) require('mini.deps').setup() local add = MiniDeps.add add({ source = 'neovim/nvim-lspconfig' }) add({ source = 'chomosuke/typst-preview.nvim' }) add({ source = 'williamboman/mason.nvim' }) add({ source = 'stevearc/conform.nvim' }) add({ source = 'williamboman/mason-lspconfig.nvim' }) add({ source = 'mhartington/formatter.nvim' }) add({ source = 'mfussenegger/nvim-lint' }) add({ source = 'akinsho/toggleterm.nvim' }) -- Add to current session (install if absent) add({ source = 'neovim/nvim-lspconfig', -- Supply dependencies near target plugin depends = { 'williamboman/mason.nvim' }, }) add({ source = 'seblyng/roslyn.nvim', }) add({ source = 'tris203/rzls.nvim', }) add({ source = 'nvim-treesitter/nvim-treesitter', -- Use 'master' while monitoring updates in 'main' checkout = 'master', monitor = 'main', -- Perform action after every checkout hooks = { post_checkout = function() vim.cmd('TSUpdate') end }, }) add({ source = 'simrat39/rust-tools.nvim' }) add({ -- Completion framework: source = 'hrsh7th/nvim-cmp', -- LSP completion source: depends = {'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lua', 'hrsh7th/cmp-nvim-lsp-signature-help', 'hrsh7th/cmp-vsnip', 'hrsh7th/cmp-path', 'hrsh7th/cmp-buffer', 'hrsh7th/vim-vsnip', }, }) add({ source = "catppuccin/nvim", name = "catppuccin" }) require('mini.files').setup({ mappings = { show_help = 'gh', }, }) require('mini.icons').setup({style = 'ascii'}) require('mini.pick').setup({}) require('mini.snippets').setup({}) require('mini.notify').setup({}) require('mini.statusline').setup({}) require('mini.tabline').setup({}) require('mini.git').setup({}) local imap_expr = function(lhs, rhs) vim.keymap.set('i', lhs, rhs, { expr = true }) end imap_expr('', [[pumvisible() ? "\" : "\"]]) imap_expr('', [[pumvisible() ? "\" : "\"]]) _G.cr_action = function() -- If there is selected item in popup, accept it with if vim.fn.complete_info()['selected'] ~= -1 then return '\25' end -- Fall back to plain ``. You might want to customize according -- to other plugins. For example if 'mini.pairs' is set up, replace -- next line with `return MiniPairs.cr()` return '\r' end vim.keymap.set('i', '', 'v:lua.cr_action()', { expr = true }) require("toggleterm").setup{ size = function(term) if term.direction == "horizontal" then return 30 elseif term.direction == "vertical" then return 69 end end, open_mapping = [[]], hide_numbers = true, shade_terminals = true, persist_size = true, direction = 'float', close_on_exit = true, shell = vim.o.shell, } require('nvim-treesitter.configs').setup { ensure_installed = { "lua", "rust", "toml", "c_sharp" }, auto_install = true, highlight = { enable = true, additional_vim_regex_highlighting=false, }, ident = { enable = true }, rainbow = { enable = true, extended_mode = true, max_file_lines = nil, } } require("mason").setup({ registries = { "github:mason-org/mason-registry", "github:Crashdummyy/mason-registry", }, ui = { icons = { package_installed = "✓", package_pending = "➜", package_uninstalled = "✗" } } }) require("mason-lspconfig").setup() vim.lsp.config('rust_analyzer', { -- Server-specific settings. See `:help lsp-quickstart` settings = { ['rust-analyzer'] = {}, }, }) local mason_registry = require("mason-registry") local cmd = {} vim.list_extend(cmd, { "dotnet", vim.fs.joinpath("/home/narl/.local/share/nvim/mason/packages/roslyn", "libexec", "Microsoft.CodeAnalysis.LanguageServer.dll"), "--stdio", "--logLevel=Information", "--extensionLogDirectory=" .. vim.fs.dirname(vim.lsp.get_log_path()), }) local rzls_path = vim.fs.joinpath("/home/narl/.local/share/nvim/mason/packages/rzls", "libexec") table.insert( cmd, "--razorSourceGenerator=" .. vim.fs.joinpath(rzls_path, "Microsoft.CodeAnalysis.Razor.Compiler.dll") ) table.insert( cmd, "--razorDesignTimePath=" .. vim.fs.joinpath(rzls_path, "Targets", "Microsoft.NET.Sdk.Razor.DesignTime.targets") ) require('roslyn').setup({ cmd = cmd, config = { -- the rest of your Roslyn configuration handlers = require("rzls.roslyn_handlers"), }, }) require('nvim-treesitter.configs').setup({ highlight = { enable = true }, }) require("catppuccin").setup({ flavour = "auto", -- latte, frappe, macchiato, mocha background = { -- :h background light = "latte", dark = "mocha", }, transparent_background = false, -- disables setting the background color. show_end_of_buffer = false, -- shows the '~' characters after the end of buffers term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) dim_inactive = { enabled = false, -- dims the background color of inactive window shade = "dark", percentage = 0.15, -- percentage of the shade to apply to the inactive window }, no_italic = false, -- Force no italic no_bold = false, -- Force no bold no_underline = false, -- Force no underline styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): comments = { "italic" }, -- Change the style of comments conditionals = { "italic" }, loops = {}, functions = {}, keywords = {}, strings = {}, variables = {}, numbers = {}, booleans = {}, properties = {}, types = {}, operators = {}, -- miscs = {}, -- Uncomment to turn off hard-coded styles }, color_overrides = {}, custom_highlights = {}, default_integrations = true, integrations = { cmp = true, gitsigns = true, nvimtree = true, treesitter = true, notify = false, mini = { enabled = true, indentscope_color = "", }, -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) }, }) local sign = function(opts) vim.fn.sign_define(opts.name, { texthl = opts.name, text = opts.text, numhl = '' }) end sign({name = 'DiagnosticSignError', text = ''}) sign({name = 'DiagnosticSignWarn', text = ''}) sign({name = 'DiagnosticSignHint', text = ''}) sign({name = 'DiagnosticSignInfo', text = ''}) --Set completeopt to have a better completion experience -- :help completeopt -- menuone: popup even when there's only one match -- noinsert: Do not insert text until a selection is made -- noselect: Do not select, force to select one from the menu -- shortness: avoid showing extra messages when using completion -- updatetime: set updatetime for CursorHold vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'} vim.opt.shortmess = vim.opt.shortmess + { c = true} vim.api.nvim_set_option('updatetime', 300) -- Fixed column for diagnostics to appear -- Show autodiagnostic popup on cursor hover_range -- Goto previous / next diagnostic warning / error -- Show inlay_hints more frequently vim.cmd([[ set signcolumn=yes autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) ]]) vim.diagnostic.config({ virtual_text = false, signs = true, update_in_insert = true, underline = true, severity_sort = false, float = { border = 'rounded', source = 'always', header = '', prefix = '', }, }) vim.cmd([[ set signcolumn=yes autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) ]]) -- setup must be called before loading vim.cmd.colorscheme "catppuccin" vim.keymap.set('n', 'w', 'write', {desc = 'Save file'}) vim.keymap.set('n', 'q', 'quitall', {desc = 'Exit vim'}) vim.keymap.set({'n', 'x', 'o'}, 'gy', '"+y', {desc = 'Copy to clipboard'}) vim.keymap.set({'n', 'x', 'o'}, 'gp', '"+p', {desc = 'Paste clipboard text'}) vim.keymap.set('n', 'e', 'lua MiniFiles.open()', {desc = 'File explorer'}) vim.keymap.set('n', '', 'Pick buffers', {desc = 'Search open files'}) vim.keymap.set('n', 'ff', 'Pick files', {desc = 'Search all files'}) vim.keymap.set('n', 'fh', 'Pick help', {desc = 'Search help tags'}) vim.keymap.set('n', 'h', 'wincmd h') vim.keymap.set('n', 'l', 'wincmd l') vim.keymap.set('n', 'j', 'wincmd j') vim.keymap.set('n', 'k', 'wincmd k') -- Rust -- local rt = require("rust-tools") rt.setup({ server = { on_attach = function(_, bufnr) -- Hover actions vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) -- Code action groups vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) end, }, }) local cmp = require'cmp' cmp.setup({ -- Enable LSP snippets snippet = { expand = function(args) vim.fn["vsnip#anonymous"](args.body) end, }, mapping = { [''] = cmp.mapping.select_prev_item(), [''] = cmp.mapping.select_next_item(), -- Add tab support [''] = cmp.mapping.select_prev_item(), [''] = cmp.mapping.select_next_item(), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.close(), [''] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true, }) }, -- Installed sources: sources = { { name = 'path' }, -- file paths { name = 'nvim_lsp', keyword_length = 3 }, -- from language server { name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized { name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.* { name = 'buffer', keyword_length = 2 }, -- source current buffer { name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip { name = 'calc'}, -- source for math calculation }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, formatting = { fields = {'menu', 'abbr', 'kind'}, format = function(entry, item) local menu_icon ={ nvim_lsp = 'λ', vsnip = '⋗', buffer = 'Ω', path = '🖫', } item.menu = menu_icon[entry.source.name] return item end, }, })