From 13fbd5bc4ecf15e8d9b9578e03f83669f218ee32 Mon Sep 17 00:00:00 2001 From: awy Date: Sun, 24 Nov 2024 21:59:54 +0300 Subject: neovim cfg --- .config/nvim/init.lua | 20 ++++++++++++++++++++ .config/nvim/lazy-lock.json | 14 ++++++++++++++ .config/nvim/lua/plugins.lua | 1 + .config/nvim/lua/plugins/gruvbox.lua | 10 ++++++++++ .config/nvim/lua/plugins/lsp-config.lua | 28 ++++++++++++++++++++++++++++ .config/nvim/lua/plugins/lualine.lua | 11 +++++++++++ .config/nvim/lua/plugins/neo-tree.lua | 12 ++++++++++++ .config/nvim/lua/plugins/telescope.lua | 9 +++++++++ .config/nvim/lua/plugins/treesitter.lua | 11 +++++++++++ .config/nvim/lua/vim-options.lua | 4 ++++ 10 files changed, 120 insertions(+) create mode 100644 .config/nvim/init.lua create mode 100644 .config/nvim/lazy-lock.json create mode 100644 .config/nvim/lua/plugins.lua create mode 100644 .config/nvim/lua/plugins/gruvbox.lua create mode 100644 .config/nvim/lua/plugins/lsp-config.lua create mode 100644 .config/nvim/lua/plugins/lualine.lua create mode 100644 .config/nvim/lua/plugins/neo-tree.lua create mode 100644 .config/nvim/lua/plugins/telescope.lua create mode 100644 .config/nvim/lua/plugins/treesitter.lua create mode 100644 .config/nvim/lua/vim-options.lua (limited to '.config/nvim') diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..431b0af --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,20 @@ +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) + +local otps = {} + +require("vim-options") +require("lazy").setup("plugins") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..d1c1c22 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,14 @@ +{ + "gruvbox.nvim": { "branch": "main", "commit": "49d9c0b150ba70efcd831ec7b3cb8ee740067045" }, + "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, + "nvim-lspconfig": { "branch": "master", "commit": "59a6766cbf32c7e4cf3ed685ccad7ffe1dde8c40" }, + "nvim-treesitter": { "branch": "master", "commit": "1c111e3e8f42c85b16cb4bf30e4254fcb5607817" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" } +} diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/.config/nvim/lua/plugins.lua @@ -0,0 +1 @@ +return {} diff --git a/.config/nvim/lua/plugins/gruvbox.lua b/.config/nvim/lua/plugins/gruvbox.lua new file mode 100644 index 0000000..547af2c --- /dev/null +++ b/.config/nvim/lua/plugins/gruvbox.lua @@ -0,0 +1,10 @@ +return { + "ellisonleao/gruvbox.nvim", + priority = 1000 , + config = function() + require("gruvbox").setup({ + transparent_mode = true, + }) + vim.cmd.colorscheme "gruvbox" + end +} diff --git a/.config/nvim/lua/plugins/lsp-config.lua b/.config/nvim/lua/plugins/lsp-config.lua new file mode 100644 index 0000000..7178d3e --- /dev/null +++ b/.config/nvim/lua/plugins/lsp-config.lua @@ -0,0 +1,28 @@ +return { + { + "williamboman/mason.nvim", + config = function() + require("mason").setup() + end + }, + { + "williamboman/mason-lspconfig.nvim", + config = function() + require("mason-lspconfig").setup({ + ensure_installed = { "lua_ls", "clangd", "html", "cssls" } + }) + end + }, + { + "neovim/nvim-lspconfig", + config = function() + local lspconfig = require("lspconfig") + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities.textDocument.completion.completionItem.snippetSupport = true + lspconfig.lua_ls.setup({}) + lspconfig.clangd.setup({}) + lspconfig.html.setup({capabilities = capabilities,}) + lspconfig.cssls.setup({capabilities = capabilities,}) + end + } +} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..a8235ae --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,11 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup({ + options = { + theme = 'gruvbox_dark' + } + }) + end +} diff --git a/.config/nvim/lua/plugins/neo-tree.lua b/.config/nvim/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..65f280d --- /dev/null +++ b/.config/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,12 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + config = function() + vim.keymap.set('n', '', ':Neotree filesystem reveal left', {}) + end +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..c646155 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,9 @@ +return { + 'nvim-telescope/telescope.nvim', tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local builtin = require("telescope.builtin") + vim.keymap.set('n', '', builtin.find_files, {}) + vim.keymap.set('n', 'fg', builtin.live_grep, {}) + end +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..0e5b9fe --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,11 @@ +return {"nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local config = require("nvim-treesitter.configs") + config.setup({ + ensure_installed = { "c", "lua", "html", "css" }, + highlight = { enable = true }, + indent = { enable = true }, + }) + end +} diff --git a/.config/nvim/lua/vim-options.lua b/.config/nvim/lua/vim-options.lua new file mode 100644 index 0000000..8068602 --- /dev/null +++ b/.config/nvim/lua/vim-options.lua @@ -0,0 +1,4 @@ +vim.cmd("set title") +vim.cmd("set clipboard+=unnamedplus") +vim.cmd("set relativenumber") +vim.g.mapleader = " " -- cgit v1.2.3