diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..1e1765c --- /dev/null +++ b/.luarc.json @@ -0,0 +1,5 @@ +{ + "diagnostics.globals": [ + "vim" + ] +} \ No newline at end of file diff --git a/Readme.md b/Readme.md index d5547b7..adcb80d 100644 --- a/Readme.md +++ b/Readme.md @@ -5,18 +5,19 @@ [![](https://cloud.orudo.ru/s/wcZ6oAGHyAwBgGw/download/GL.png)](https://gitlab.com/Trueold89/nvim) [![](https://cloud.orudo.ru/s/D8xtkTS8ZBCq8fC/download/GH.png)](https://github.com/trueold89/nvim) -### 🖼️ Screenshot: ---- -![](https://i.imgur.com/dOrUtgh.png) -### 📥 Install: ---- +## 🖼️ Screenshot: +![](https://i.imgur.com/SzrTeYc.png) + +*** + +## 📥 Install: **Install dependencies:** | **Dependency** | **Function** | | --- | --- | -| git | Required to run VimPlug and install this configuration | +| git | Required to run some plugins and install this configuration | | yarn | Necessary for previewing MarkDown files in the browser | **Make a backup of your current nvim folder:** @@ -26,32 +27,33 @@ mv ~/.config/nvim ~/.config/nvim.bak mv ~/.local/share/nvim ~/.local/share/nvim.bak mv ~/.local/state/nvim ~/.local/state/nvim.bak ``` -**Install [VimPlug](https://github.com/junegunn/vim-plug)** -```bash -sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' -``` **Clone the repository and run NeoVim:** ```bash git clone --depth 1 https://git.orudo.ru/trueold89/neovim.git ~/.config/nvim && nvim ``` -**Run PlugInstall install hook:** -``` -:PlugInstall -``` - -**And restart NeoVim** - ### ⛴️ Use with docker: ```bash -docker run --name='nvim' --rm -it git.orudo.ru/trueold89/nvim:latest +docker run --name='nvim' --rm -v ./:/mnt -it git.orudo.ru/trueold89/nvim:latest ``` -### ⌨️ Custom KeyMaps: +*** + +### ℹ️ Plugins: --- -| **Key** | **Function** | -| --- | --- | -| \ | Toggle NerdTree (File Explorer) | -| \ | Open MarkDown preview in browser | +| Plugin | Function | +| ------ | -------- | +| **Lazy.nvim** | Plugin-manager | +| **NeoTree** | File Explorer | +| **EverForest** | Theme | +| **Telescope** | UI enhancement | +| **MarkDown** Preview | Preview .md files in browser | +| **LuaLine** | UI enhancement | +| **Mason \| LSP-Config** | LSP | +| **GitSigns** | git integration | +| **cmp-nvim-lsp \| LuaSnip \| nvim-cmp** | Auto-compl. | +| **Vim Commentary** | Fast comments | +| **VimCSS \| Colorizer** | Preview css colors | +| **AutoPairs** | Auto-pairs | + diff --git a/init.lua b/init.lua old mode 100755 new mode 100644 index f55e235..368a763 --- a/init.lua +++ b/init.lua @@ -1,12 +1,25 @@ ----------------------- --- Initial Settings -- ----------------------- +---------- +-- Init -- +---------- --- Default neovim settings -- -require('settings') +-- VimScript Settings --- VimPlug -- -require('plugins') +require("vims") --- KeyMaps -- -require('keymaps') +-- lazy.nvim + +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("plugins") diff --git a/lua/bubblesline.lua b/lua/bubblesline.lua deleted file mode 100755 index 78e3c99..0000000 --- a/lua/bubblesline.lua +++ /dev/null @@ -1,62 +0,0 @@ --- Bubbles config for lualine --- Author: lokesh-krishna --- MIT license, see LICENSE for more details. - --- stylua: ignore -local colors = { - blue = '#0d73cc', - cyan = '#79dac8', - black = '#181825', - white = '#FFFFFF', - red = '#F38BA8', - violet = '#d183e8', - grey = '#303030', -} - -local bubbles_theme = { - normal = { - a = { fg = colors.white, bg = colors.blue}, - b = { fg = colors.black, bg = colors.white}, - c = { fg = colors.black, bg = colors.white}, - }, - - insert = { a = { fg = colors.white, bg = colors.blue} }, - visual = { a = { fg = colors.white, bg = colors.blue} }, - replace = { a = { fg = colors.white, bg = colors.blue} }, - - inactive = { - a = { fg = colors.white, bg = colors.black }, - b = { fg = colors.white, bg = colors.black }, - c = { fg = colors.black, bg = colors.black }, - }, -} - -require('lualine').setup { - options = { - theme = bubbles_theme, - component_separators = '|', - section_separators = { left = '', right = '' }, - }, - sections = { - lualine_a = { - { 'mode', separator = { left = '' }, right_padding = 2 }, - }, - lualine_b = { 'filename', 'branch' }, - lualine_c = { 'fileformat' }, - lualine_x = {}, - lualine_y = { 'filetype', 'progress' }, - lualine_z = { - { 'location', separator = { right = '' }, left_padding = 2 }, - }, - }, - inactive_sections = { - lualine_a = { 'filename' }, - lualine_b = {}, - lualine_c = {}, - lualine_x = {}, - lualine_y = {}, - lualine_z = { 'location' }, - }, - tabline = {}, - extensions = {}, -} diff --git a/lua/keymaps.lua b/lua/keymaps.lua deleted file mode 100755 index c165f0e..0000000 --- a/lua/keymaps.lua +++ /dev/null @@ -1,9 +0,0 @@ --------------------- --- Custom keymaps -- --------------------- - --- NerdTreeToggle -- -vim.api.nvim_set_keymap('n','',':NERDTreeToggle',{ noremap = true, silent = true }) - --- MD -- -vim.api.nvim_set_keymap('n','',':MarkdownPreviewToggle',{ noremap = true, silent = true }) diff --git a/lua/plugins.lua b/lua/plugins.lua deleted file mode 100755 index ac80b98..0000000 --- a/lua/plugins.lua +++ /dev/null @@ -1,44 +0,0 @@ ---------------------- --- VimPlug Plugins -- ---------------------- - -local vim = vim -local Plug = vim.fn['plug#'] - -vim.call('plug#begin') - --- Sidebar explorer -- -Plug('https://github.com/preservim/nerdtree') -Plug('https://github.com/ryanoasis/vim-devicons') - --- Fast line comment -- -Plug('https://github.com/tpope/vim-commentary') - --- Show css colors -- -Plug('https://github.com/ap/vim-css-color') -Plug('https://github.com/chrisbra/Colorizer.git') - --- Auto-pairs -- -Plug('jiangmiao/auto-pairs') - --- Airline -- -Plug('nvim-lualine/lualine.nvim') -Plug('nvim-tree/nvim-web-devicons') - --- BufferLine -- -Plug('akinsho/bufferline.nvim', { ['tag'] = '*' }) - --- MD -- -Plug('iamcco/markdown-preview.nvim', { ['do'] = 'cd app && yarn install' }) - -vim.call('plug#end') - --------------- --- Settings -- --------------- - --- AirLine-- -require('bubblesline') - --- BufferLine -- -require("bufferline").setup{} diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua new file mode 100644 index 0000000..3b6cd97 --- /dev/null +++ b/lua/plugins/autopairs.lua @@ -0,0 +1,3 @@ +return { + "https://github.com/jiangmiao/auto-pairs" +} diff --git a/lua/plugins/colors.lua b/lua/plugins/colors.lua new file mode 100644 index 0000000..dbd7502 --- /dev/null +++ b/lua/plugins/colors.lua @@ -0,0 +1,4 @@ +return { + "https://github.com/ap/vim-css-color", + "https://github.com/chrisbra/Colorizer.git" +} \ No newline at end of file diff --git a/lua/plugins/commentary.lua b/lua/plugins/commentary.lua new file mode 100644 index 0000000..71bf545 --- /dev/null +++ b/lua/plugins/commentary.lua @@ -0,0 +1,6 @@ +return { + "https://github.com/tpope/vim-commentary", + config = function() + vim.cmd [[filetype plugin on]] + end +} \ No newline at end of file diff --git a/lua/plugins/compl.lua b/lua/plugins/compl.lua new file mode 100644 index 0000000..298890d --- /dev/null +++ b/lua/plugins/compl.lua @@ -0,0 +1,44 @@ +return { + { + "hrsh7th/cmp-nvim-lsp" + }, + { + "L3MON4D3/LuaSnip", + dependencies = { + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + }, + { + "hrsh7th/nvim-cmp", + config = function() + local cmp = require("cmp") + require("luasnip.loaders.from_vscode").lazy_load() + + 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({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- For luasnip users. + }, { + { name = "buffer" }, + }), + }) + end, + }, + } \ No newline at end of file diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..3f50d35 --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,6 @@ +return { + "https://github.com/lewis6991/gitsigns.nvim", + config = function () + require('gitsigns').setup() + end +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..cfcfd41 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,53 @@ +return { + { + "williamboman/mason.nvim", + lazy = false, + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", + lazy = false, + opts = { + auto_install = true, + }, + }, + { + "neovim/nvim-lspconfig", + lazy = false, + config = function() + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup({ + capabilities = capabilities + }) + lspconfig.ruff.setup({ + capabilities = capabilities + }) + lspconfig.ruff_lsp.setup({ + capabilities = capabilities + }) + lspconfig.pyright.setup({ + capabilities = capabilities + }) + lspconfig.terraformls.setup({ + capabilities = capabilities + }) + lspconfig.markdown_oxide.setup({ + capabilities = capabilities + }) + lspconfig.jdtls.setup({ + capabilities = capabilities + }) + + + + vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) + vim.keymap.set("n", "gr", vim.lsp.buf.references, {}) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {}) + end, + }, + } diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..83873ba --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,8 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }; + options = { theme = 'everforest' }, + config = function() + require('lualine').setup() + end, +} \ No newline at end of file diff --git a/lua/plugins/md.lua b/lua/plugins/md.lua new file mode 100644 index 0000000..dc12cd7 --- /dev/null +++ b/lua/plugins/md.lua @@ -0,0 +1,12 @@ +return { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + build = "cd app && yarn install", + init = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, + config = function() + vim.keymap.set("n", "", ":MarkdownPreviewToggle", {}) + end, +} \ No newline at end of file diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..710d0e8 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,25 @@ +return { + { + "nvim-telescope/telescope-ui-select.nvim", + }, + { + "nvim-telescope/telescope.nvim", + tag = "0.1.5", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("telescope").setup({ + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown({}), + }, + }, + }) + local builtin = require("telescope.builtin") + vim.keymap.set("n", "", builtin.find_files, {}) + vim.keymap.set("n", "fg", builtin.live_grep, {}) + vim.keymap.set("n", "", builtin.oldfiles, {}) + + require("telescope").load_extension("ui-select") + end, + }, +} diff --git a/lua/plugins/theme.lua b/lua/plugins/theme.lua new file mode 100644 index 0000000..5d83a7c --- /dev/null +++ b/lua/plugins/theme.lua @@ -0,0 +1,14 @@ +-- Everforest + +return { + "neanias/everforest-nvim", + version = false, + lazy = false, + priority = 1000, + config = function() + require("everforest").setup({ + transparent_background_level = 0.8, + }) + vim.cmd.colorscheme "everforest" + end, + } diff --git a/lua/plugins/tree.lua b/lua/plugins/tree.lua new file mode 100644 index 0000000..ac52c75 --- /dev/null +++ b/lua/plugins/tree.lua @@ -0,0 +1,13 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + "3rd/image.nvim", + }, + config = function() + vim.keymap.set("n", "", ":Neotree filesystem toggle left", {}) + end, +} \ No newline at end of file diff --git a/lua/settings.lua b/lua/settings.lua deleted file mode 100755 index 7098c7b..0000000 --- a/lua/settings.lua +++ /dev/null @@ -1,25 +0,0 @@ ------------------------------ --- Default Neovim Settings -- ------------------------------ - --- Show line numbers -- -vim.api.nvim_win_set_option(0, 'number', true) - --- Mouse settings -- -vim.opt.mouse = 'a' - --- Syntax highlight -- -vim.opt.syntax = 'on' - --- Clipboard settings -- -vim.opt.clipboard = 'unnamedplus' - --- Disable Swap -- -vim.opt.swapfile = false - --- Tab settings -- -vim.opt.tabstop = 2 -vim.opt.shiftwidth = 2 -vim.opt.smartindent = true -vim.opt.cindent = true -vim.opt.expandtab = true diff --git a/lua/vims.lua b/lua/vims.lua new file mode 100644 index 0000000..91ab18c --- /dev/null +++ b/lua/vims.lua @@ -0,0 +1,24 @@ +-- Tab settings +vim.cmd("set expandtab") +vim.cmd("set tabstop=2") +vim.cmd("set softtabstop=2") +vim.cmd("set shiftwidth=2") + +-- ClipBoard +vim.opt.clipboard = "unnamedplus" + +-- Disable swapfile +vim.opt.swapfile = false + +-- Indents +vim.cmd("set cindent") +vim.cmd("set smartindent") + +-- Mouse +vim.opt.mouse = "a" + +-- LeaderKey +vim.g.mapleader = " " + +-- LineNumbers +vim.api.nvim_win_set_option(0, 'number', true)