Update config

This commit is contained in:
trueold89 2024-06-28 11:51:10 +03:00
parent 8103db365c
commit 83e8f7326b
Signed by: trueold89
GPG Key ID: C122E85DD49E6B30
19 changed files with 265 additions and 173 deletions

5
.luarc.json Normal file
View File

@ -0,0 +1,5 @@
{
"diagnostics.globals": [
"vim"
]
}

View File

@ -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** |
| --- | --- |
| \<F1\> | Toggle NerdTree (File Explorer) |
| \<F5\> | 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 |

31
init.lua Executable file → Normal file
View File

@ -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")

View File

@ -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 = {},
}

View File

@ -1,9 +0,0 @@
--------------------
-- Custom keymaps --
--------------------
-- NerdTreeToggle --
vim.api.nvim_set_keymap('n','<F1>',':NERDTreeToggle<CR>',{ noremap = true, silent = true })
-- MD --
vim.api.nvim_set_keymap('n','<F5>',':MarkdownPreviewToggle<CR>',{ noremap = true, silent = true })

View File

@ -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{}

View File

@ -0,0 +1,3 @@
return {
"https://github.com/jiangmiao/auto-pairs"
}

4
lua/plugins/colors.lua Normal file
View File

@ -0,0 +1,4 @@
return {
"https://github.com/ap/vim-css-color",
"https://github.com/chrisbra/Colorizer.git"
}

View File

@ -0,0 +1,6 @@
return {
"https://github.com/tpope/vim-commentary",
config = function()
vim.cmd [[filetype plugin on]]
end
}

44
lua/plugins/compl.lua Normal file
View File

@ -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({
["<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" }, -- For luasnip users.
}, {
{ name = "buffer" },
}),
})
end,
},
}

6
lua/plugins/git.lua Normal file
View File

@ -0,0 +1,6 @@
return {
"https://github.com/lewis6991/gitsigns.nvim",
config = function ()
require('gitsigns').setup()
end
}

53
lua/plugins/lsp.lua Normal file
View File

@ -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", "<leader>gd", vim.lsp.buf.definition, {})
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, {})
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
end,
},
}

8
lua/plugins/lualine.lua Normal file
View File

@ -0,0 +1,8 @@
return {
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' };
options = { theme = 'everforest' },
config = function()
require('lualine').setup()
end,
}

12
lua/plugins/md.lua Normal file
View File

@ -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", "<F5>", ":MarkdownPreviewToggle<CR>", {})
end,
}

25
lua/plugins/telescope.lua Normal file
View File

@ -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", "<C-p>", builtin.find_files, {})
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
vim.keymap.set("n", "<leader><leader>", builtin.oldfiles, {})
require("telescope").load_extension("ui-select")
end,
},
}

14
lua/plugins/theme.lua Normal file
View File

@ -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,
}

13
lua/plugins/tree.lua Normal file
View File

@ -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", "<F1>", ":Neotree filesystem toggle left<CR>", {})
end,
}

View File

@ -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

24
lua/vims.lua Normal file
View File

@ -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)