diff options
Diffstat (limited to '.config/nvim/init.lua')
| -rw-r--r-- | .config/nvim/init.lua | 192 |
1 files changed, 19 insertions, 173 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 51ebf0e..0d70e59 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,173 +1,19 @@ -vim.o.number = true -vim.o.relativenumber = true -vim.o.signcolumn = "yes" -vim.o.wrap = false -vim.o.tabstop = 2 -vim.o.shiftwidth = 2 -vim.o.softtabstop = 2 -vim.o.expandtab = true -vim.o.swapfile = false -vim.g.mapleader = " " -vim.o.clipboard = "unnamedplus" -vim.o.undofile = true -vim.o.cursorline = true -vim.o.cursorlineopt = "number" -vim.o.title = true -vim.opt.shortmess:append "sI" - --- packages -vim.pack.add({ - -- { src = "https://github.com/sainnhe/everforest" }, - { src = "https://github.com/ellisonleao/gruvbox.nvim" }, - -- { src = "https://github.com/rmehri01/onenord.nvim" }, - { src = "https://github.com/mason-org/mason.nvim", }, - { src = "https://github.com/nvim-lualine/lualine.nvim" }, - { src = "https://github.com/lewis6991/gitsigns.nvim" }, - { src = "https://github.com/cappyzawa/trim.nvim" }, - { src = "https://github.com/nvim-treesitter/nvim-treesitter" }, - { src = "https://github.com/lukas-reineke/indent-blankline.nvim" }, - { src = "https://github.com/nvim-telescope/telescope.nvim" }, - { src = "https://github.com/nvim-telescope/telescope-ui-select.nvim" }, - { src = "https://github.com/nvim-lua/plenary.nvim" }, - { src = "https://github.com/hrsh7th/cmp-nvim-lsp" }, - { src = "https://github.com/hrsh7th/nvim-cmp" }, - { src = "https://github.com/L3MON4D3/LuaSnip" }, - { src = "https://github.com/saadparwaiz1/cmp_luasnip" }, - { src = "https://github.com/rafamadriz/friendly-snippets" }, - { src = "https://github.com/numToStr/Comment.nvim" }, -}) - -require("mason").setup() - --- telescope -local telescope = require("telescope") -telescope.setup({ - defaults = { - preview = { treesitter = false }, - color_devicons = true, - sorting_strategy = "ascending", - borderchars = { - "─", -- top - "│", -- right - "─", -- bottom - "│", -- left - "┌", -- top-left - "┐", -- top-right - "┘", -- bottom-right - "└", -- bottom-left - }, - path_displays = { "smart" }, - layout_config = { - height = 100, - width = 400, - prompt_position = "top", - preview_cutoff = 40, - } - } -}) -telescope.load_extension("ui-select") -local builtin = require("telescope.builtin") - --- binds -vim.keymap.set('n', '<leader>lf', vim.lsp.buf.format) -vim.api.nvim_set_keymap('n', ',c', ':w! | !compiler "%:p"<CR>', { noremap = true, silent = true }) -vim.keymap.set({ "n" }, "<leader>f", builtin.find_files, { desc = "Telescope live grep" }) -vim.keymap.set({ "n" }, "<leader>g", builtin.live_grep, { desc = "Telescope live grep" }) - --- lsp -vim.lsp.enable({ - "lua_ls", "clangd", "rust_analyzer", "bashls", - "html", "cssls", "jsonls", "helm_ls", "yamlls", - "docker_language_server" -}) - -vim.diagnostic.config({ - virtual_text = { - prefix = '', - spacing = 4, - }, - signs = { - text = { - [vim.diagnostic.severity.ERROR] = '', - [vim.diagnostic.severity.WARN] = '', - }, - -- linehl = { - -- [vim.diagnostic.severity.ERROR] = 'ErrorMsg', - -- }, - -- numhl = { - -- [vim.diagnostic.severity.WARN] = 'WarningMsg', - -- }, - }, - underline = true, - update_in_insert = true, - severity_sort = true, -}) - --- plugins -require('Comment').setup() -require('lualine').setup({}) -require("gitsigns").setup() -require("trim").setup({}) -require("nvim-treesitter.configs").setup({ - ensure_installed = { - "bash", - "lua", - "javascript", - "c", - "cpp", - "json", - "go", - "markdown", - "meson", - "make", - "cmake", - "python", - "rust", - "yaml", - "toml", - "ron", - "helm" - }, - highlight = { enable = true }, - indent = { enable = true }, -}) -require("ibl").setup({}) - -local cmp = require 'cmp' -cmp.setup({ - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - ['<C-b>'] = cmp.mapping.scroll_docs(-4), - ['<C-f>'] = cmp.mapping.scroll_docs(4), - ['<C-Space>'] = cmp.mapping.complete(), - ['<C-e>'] = cmp.mapping.abort(), - ['<CR>'] = cmp.mapping.confirm({ select = true }), - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, { - { name = 'buffer' }, - }) -}) - -vim.filetype.add({ - pattern = { - [".*/templates/.*%.yaml"] = "helm", - [".*/templates/.*%.yml"] = "helm", - }, -}) - --- theme --- vim.g.everforest_transparent_background = true --- vim.cmd("colorscheme everforest") --- vim.cmd("colorscheme onenord") -vim.cmd("colorscheme gruvbox") +-- Bootstrap lazy.nvim +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 + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +require("options") +require("lazy").setup("plugins") |