local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, }) end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ spec = { { 'windwp/nvim-ts-autotag', lazy = false, config = true, }, { 'terrortylor/nvim-comment', lazy = false, config = function() require('nvim_comment').setup({ hook = function() require('ts_context_commentstring.internal').update_commentstring() end, }) end, dependencies = { -- To customize commentstring for e.g. svelte files, as the commentstring is depending on cursor position 'JoosepAlviste/nvim-ts-context-commentstring' } }, { { 'williamboman/mason.nvim', lazy = false, config = true, }, { 'williamboman/mason-lspconfig.nvim', lazy = false, config = function() local lsp_zero = require('lsp-zero') lsp_zero.extend_lspconfig() lsp_zero.on_attach(function(_, bufnr) -- see :help lsp-zero-keybindings -- to learn the available actions lsp_zero.default_keymaps({ buffer = bufnr }) end) require('mason-lspconfig').setup { ensure_installed = { 'rust_analyzer', 'lua_ls' }, handlers = { lsp_zero.default_setup } } end, }, { 'VonHeikemen/lsp-zero.nvim' }, { 'neovim/nvim-lspconfig' }, { 'hrsh7th/cmp-nvim-lsp' }, { 'hrsh7th/nvim-cmp', lazy = false, config = function() local cmp = require('cmp') cmp.setup({ mapping = cmp.mapping.preset.insert({ -- add Ctrl+z to default keymap from lsp-zero as replacement to Ctrl+y on german keyboard layout [''] = cmp.mapping.confirm({ select = true }), }) }) end } }, { 'stevearc/conform.nvim', lazy = false, opts = { notify_on_error = true, formatters_by_ft = { templ = { "templ" }, }, format_on_save = { lsp_fallback = true, timeout_ms = 1500, }, }, config = function(_, opts) local plug = require('conform') plug.setup(opts) end, }, { -- status line 'nvim-lualine/lualine.nvim', lazy = false, config = true, opts = { options = { theme = "everforest", }, }, dependencies = { 'nvim-tree/nvim-web-devicons' } }, { 'rcarriga/nvim-notify', lazy = false, config = function() vim.notify = require('notify') end, }, { 'stevearc/oil.nvim', lazy = false, config = function() require('oil').setup({ view_options = { show_hidden = true, sort = { { "type", "asc" }, { "name", "asc" }, }, }, }) vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) end, }, { 'nvim-telescope/telescope.nvim', opts = { defaults = { path_display = { "smart" }, file_ignore_patterns = { "node%_modules/.*" } } }, dependencies = { 'nvim-lua/plenary.nvim' }, }, { "sainnhe/everforest", priority = 1000, -- make sure to load this before all the other start plugins config = function() vim.cmd([[colorscheme everforest]]) end, }, { "nvim-treesitter/nvim-treesitter", config = function() require("nvim-treesitter.configs").setup { auto_install = true, highlight = { enable = true, }, } vim.cmd([[TSUpdate]]) end } } }) vim.g.mapleader = " " -- line numbers vim.opt.rnu = true vim.opt.nu = true -- search vim.opt.smartcase = true vim.opt.ignorecase = true -- tabstops vim.opt.ts = 4 vim.opt.sw = 0 -- folding vim.opt.foldmethod = "indent" vim.opt.foldlevel = 99 --clipboard vim.opt.clipboard = "unnamedplus" -- other vim.opt.signcolumn = "yes" -- colortheme vim.opt.termguicolors = true vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Hightlight selection on yank', pattern = '*', callback = function() vim.highlight.on_yank { higroup = 'IncSearch', timeout = 500 } end, }) vim.filetype.add({ extension = { templ = "templ" } }) vim.keymap.set('n', 'q', ':q', {}) vim.keymap.set('n', 'w', ':w', {}) vim.keymap.set('n', 'c', ':noh', {}) vim.keymap.set('n', 'en', vim.diagnostic.goto_next, {}) vim.keymap.set('n', 'ep', vim.diagnostic.goto_prev, {}) local telescope = require('telescope.builtin') vim.keymap.set('n', 'ff', telescope.find_files, {}) vim.keymap.set('n', 'fg', telescope.live_grep, {}) vim.keymap.set('n', 'fb', telescope.buffers, {}) vim.keymap.set('n', 'fh', telescope.help_tags, {})