diff options
Diffstat (limited to '.config/nvim/init.lua')
-rw-r--r-- | .config/nvim/init.lua | 145 |
1 files changed, 20 insertions, 125 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index f5e6372..0d8bb5f 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,125 +1,20 @@ -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.swapfile = false -vim.g.mapleader = " " -vim.o.clipboard = "unnamedplus" -vim.o.undofile = true -vim.o.cursorline = false -vim.cmd("set title") - --- packages -vim.pack.add({ - { src = "https://github.com/sainnhe/everforest" }, - { 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" }, -}) - --- 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", "yamlls" -}) - -vim.diagnostic.config({ - virtual_text = { - prefix = '', - spacing = 4, - }, - -- signs = false, - underline = true, - update_in_insert = true, - severity_sort = true, -}) - --- completion -vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('my.lsp', {}), - callback = function(args) - local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) - if client:supports_method('textDocument/completion') then - -- Optional: trigger autocompletion on EVERY keypress. May be slow! - local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end - client.server_capabilities.completionProvider.triggerCharacters = chars - vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true }) - end - end, -}) -vim.cmd [[set completeopt+=menuone,noselect,popup]] - --- plugins -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", - }, - highlight = { enable = true }, - indent = { enable = true }, -}) -require("ibl").setup({}) - --- theme --- vim.g.everforest_enable_italic = true --- vim.g.everforest_transparent_background = true -vim.cmd("colorscheme everforest") +-- 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) + +-- Setup lazy.nvim +require("vim-options") +require("lazy").setup("plugins") |