├── Images
├── 1.png
├── 2.png
├── 3.png
├── 4.png
└── 5.png
├── LICENSE
├── README.md
├── init.lua
└── lua
├── core
├── colors.lua
├── configs.lua
├── mappings.lua
└── plugins.lua
└── plugins
├── bufferline.lua
├── cellular.lua
├── cmp.lua
├── colorizer.lua
├── comment.lua
├── dashboard.lua
├── lsp.lua
├── lualine.lua
├── mason.lua
├── mini.lua
├── nvim-tree.lua
├── telescope.lua
├── todo.lua
├── toggleterm.lua
├── treesitter.lua
├── trouble.lua
└── whichkey.lua
/Images/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zproger/GenesisNvim/cda30f7857d26da31b9894ccc00a688c5949a5e6/Images/1.png
--------------------------------------------------------------------------------
/Images/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zproger/GenesisNvim/cda30f7857d26da31b9894ccc00a688c5949a5e6/Images/2.png
--------------------------------------------------------------------------------
/Images/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zproger/GenesisNvim/cda30f7857d26da31b9894ccc00a688c5949a5e6/Images/3.png
--------------------------------------------------------------------------------
/Images/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zproger/GenesisNvim/cda30f7857d26da31b9894ccc00a688c5949a5e6/Images/4.png
--------------------------------------------------------------------------------
/Images/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zproger/GenesisNvim/cda30f7857d26da31b9894ccc00a688c5949a5e6/Images/5.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 ZProger
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
GenesisNvim
3 |
4 |
11 |
12 |
13 | A minimalistic nvim config aimed at Python developers. It is a lightweight replacement for PyCharm and VsCode, eliminating all unnecessary featuresd to be easily portable for running on servers and for deployment on Linux systems.
14 |
15 |
16 | ## 🌟 Preview
17 | 
18 |
19 | 
20 |
21 | 
22 |
23 | 
24 |
25 | 
26 |
27 | ## 🌟 What it is?
28 | - There are many forks of nvim, but what does this one do? The main purpose of this config is to create a minimal environment for Python development, so that it is not resource-hungry and can be deployed quickly on Linux systems.
29 | - It can be difficult for beginners to install all the necessary plugins and LSP servers to get started. Here you don't need to do anything, just run a few commands to install and immediately use auto-tips, Ruff formatting, Mypy fixes and all the other tricks without setting up configurations.
30 |
31 | ## ✨ Features
32 | - Python autocomplete with Pyright by default
33 | - Support for default Ruff formatting and fixing
34 | - Fast startup in just 140ms
35 | - Catalog trees, support for TODO tags, navigation plugins, Git
36 | - Support over 30 color schemes
37 | - Support for diagnostics and LSP by default
38 | - Built-in floating terminal that can be opened separately
39 | - Quick search via Telescope
40 |
41 | ## 🌟 Installation
42 | - If you already have neovim, make backups of your configuration.
43 | - Remove the current nvim configuration and cache if it exists:
44 |
45 | ```sh
46 | rm -rf ~/.config/nvim ~/.local/share/nvim ~/.local/state/nvim ~/.cache/nvim
47 | ```
48 |
49 | - Execute the commands to install:
50 |
51 | ```sh
52 | sudo pacman -S git npm # Arch
53 | sudo apt install git npm # Debian
54 | brew install git npm # MacOS
55 | ```
56 |
57 | ```sh
58 | mkdir -p ~/.config/nvim
59 | git clone https://github.com/Zproger/GenesisNvim.git ~/.config/nvim
60 | nvim -c "MasonInstall pyright ruff-lsp mypy debugpy rust-analyzer"
61 | ```
62 |
63 | ## 🌟 Other
64 | - The project is ready for development, so I accept all your ideas. You can contact me or open `Issues` to make your edits or suggest improvements.
65 | - To learn the tool key combinations, press `Space`, after the prompt, select the desired menu. To analyze and change key combinations, go to `~/.config/nvim/lua/core` and `~/.config/nvim/lua/plugins`.
66 | - Video overview of this configuration: https://youtu.be/XhdwvHhFROc.
67 |
--------------------------------------------------------------------------------
/init.lua:
--------------------------------------------------------------------------------
1 |
2 | -- Basic
3 | require('core.plugins')
4 | require('core.mappings')
5 | require('core.colors')
6 | require('core.configs')
7 |
8 | -- Plugins
9 | require('plugins.nvim-tree')
10 | require('plugins.treesitter')
11 | require('plugins.lsp')
12 | require('plugins.cmp')
13 | require('plugins.mason')
14 | require('plugins.telescope')
15 | require('plugins.dashboard')
16 | require('plugins.colorizer')
17 | require('plugins.lualine')
18 | require('plugins.cellular')
19 | require('plugins.comment')
20 | require('plugins.bufferline')
21 | require('plugins.todo')
22 | require('plugins.trouble')
23 | require('plugins.toggleterm')
24 | require('plugins.whichkey')
25 | require('plugins.mini')
26 |
--------------------------------------------------------------------------------
/lua/core/colors.lua:
--------------------------------------------------------------------------------
1 |
2 | function SetColor()
3 | -- Option 1
4 | -- vim.o.background = "dark"
5 | -- vim.cmd([[colorscheme gruvbox]])
6 |
7 | -- Option 2
8 | vim.cmd.colorscheme "catppuccin"
9 | end
10 |
11 | SetColor()
12 |
--------------------------------------------------------------------------------
/lua/core/configs.lua:
--------------------------------------------------------------------------------
1 |
2 | -- Basic Settings
3 | vim.g.did_load_filetypes = 1
4 | vim.g.formatoptions = "qrn1"
5 | vim.opt.showmode = false
6 | vim.opt.updatetime = 100
7 | vim.wo.signcolumn = "yes"
8 | vim.opt.wrap = false
9 | vim.wo.linebreak = true
10 | vim.opt.virtualedit = "block"
11 | vim.opt.undofile = true
12 | vim.opt.shell = "/bin/fish" -- Shell по умолчанию
13 | vim.opt.swapfile = false -- Отключить swap файлы nvim
14 | vim.opt.encoding = "utf-8" -- Кодировка utf-8
15 | vim.opt.cursorline = true -- Выделять активную строку где находится курсор
16 | vim.opt.fileformat = "unix"
17 |
18 | -- Nvim-Tree
19 | vim.g.loaded_netrw = 1
20 | vim.g.loaded_netrwPlugin = 1
21 | vim.opt.termguicolors = true
22 |
23 | -- Scroll
24 | vim.opt.so = 30 -- При скролле курсор всегда по центру
25 |
26 | -- Search
27 | vim.opt.ignorecase = true -- Игнорировать регистр при поиске
28 | vim.opt.smartcase = true -- Не игнорирует регистр если в паттерне есть большие буквы
29 | vim.opt.hlsearch = true -- Подсвечивает найденный паттерн
30 | vim.opt.incsearch = true -- Интерактивный поиск
31 |
32 | -- Mouse
33 | vim.opt.mouse = "a" -- Возможность использовать мышку
34 | vim.opt.mousefocus = true
35 |
36 | -- Line Numbers
37 | vim.opt.number = true -- Показывает номера строк
38 | vim.opt.relativenumber = true -- Показывает расстояние к нужной строке относительно нашей позиции
39 | vim.wo.number = true -- Показывает номера строк
40 | vim.wo.relativenumber = true -- Показывает расстояние к нужной строке относительно нашей позиции
41 |
42 | -- Splits
43 | vim.opt.splitbelow = true
44 | vim.opt.splitright = true
45 |
46 | -- Clipboard
47 | vim.opt.clipboard = "unnamedplus" -- Разрешить общий буфер обмена
48 |
49 | -- Shorter messages
50 | vim.opt.shortmess:append("c")
51 |
52 | -- Indent Settings
53 | vim.opt.expandtab = true -- Превратить все tab в пробелы
54 | vim.opt.shiftwidth = 4
55 | vim.opt.tabstop = 4
56 | vim.opt.softtabstop = 4
57 | vim.opt.smartindent = true -- Копировать отступ на новой строке
58 | vim.opt.cindent = true -- Автоотступы
59 | vim.opt.smarttab = true -- Tab перед строкой вставит shiftwidht количество табов
60 |
61 | -- Fillchars
62 | vim.opt.fillchars = {
63 | vert = "│",
64 | fold = "⠀",
65 | eob = " ", -- suppress ~ at EndOfBuffer
66 | -- diff = "⣿", -- alternatives = ⣿ ░ ─ ╱
67 | msgsep = "‾",
68 | foldopen = "▾",
69 | foldsep = "│",
70 | foldclose = "▸"
71 | }
72 |
73 | vim.cmd([[highlight clear LineNr]])
74 | vim.cmd([[highlight clear SignColumn]])
75 |
--------------------------------------------------------------------------------
/lua/core/mappings.lua:
--------------------------------------------------------------------------------
1 | vim.g.mapleader = " "
2 |
3 | -- Quit
4 | vim.keymap.set('n', '', ':q')
5 |
6 | -- Copy all text
7 | vim.keymap.set('n', '', '%y+')
8 |
9 | -- Saving a file via Ctrl+S
10 | vim.keymap.set('i', '', ':w')
11 | vim.keymap.set('n', '', ':w')
12 |
13 | -- NvimTree
14 | vim.keymap.set('n', 't', ':NvimTreeToggle')
15 | vim.keymap.set('n', 'tf', ':NvimTreeFocus')
16 |
17 | -- BufferLine
18 | vim.keymap.set('n','', ':BufferLineCycleNext')
19 | vim.keymap.set('n','', ':BufferLineCyclePrev')
20 | vim.keymap.set('n', '', ':BufferLineCloseOthers')
21 |
22 | -- TodoList
23 | vim.keymap.set('n', 'nl', ':TodoTelescope')
24 |
25 | -- ToggleTerm
26 | vim.keymap.set('n', 's', ':ToggleTerm direction=float')
27 |
--------------------------------------------------------------------------------
/lua/core/plugins.lua:
--------------------------------------------------------------------------------
1 |
2 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
3 | if not (vim.uv or vim.loop).fs_stat(lazypath) then
4 | vim.fn.system({
5 | "git",
6 | "clone",
7 | "--filter=blob:none",
8 | "https://github.com/folke/lazy.nvim.git",
9 | "--branch=stable", -- latest stable release
10 | lazypath,
11 | })
12 | end
13 | vim.opt.rtp:prepend(lazypath)
14 |
15 | require("lazy").setup({
16 |
17 | { 'nvim-treesitter/nvim-treesitter' },
18 | { 'neovim/nvim-lspconfig' },
19 |
20 | -- Autocomplete support
21 | { 'hrsh7th/cmp-nvim-lsp' },
22 | { 'hrsh7th/cmp-buffer' },
23 | { 'hrsh7th/cmp-path' },
24 | { 'hrsh7th/cmp-cmdline' },
25 | { 'hrsh7th/nvim-cmp' },
26 | { 'williamboman/mason.nvim' },
27 |
28 | {
29 | 'nvim-telescope/telescope.nvim', tag = '0.1.6',
30 | dependencies = { 'nvim-lua/plenary.nvim' }
31 | },
32 |
33 | {
34 | 'nvimdev/dashboard-nvim',
35 | event = 'VimEnter',
36 | config = function()
37 | require('dashboard').setup {
38 | -- config
39 | }
40 | end,
41 | dependencies = { {'nvim-tree/nvim-web-devicons'}}
42 | },
43 |
44 | { 'Eandrju/cellular-automaton.nvim' },
45 | { 'norcalli/nvim-colorizer.lua' },
46 |
47 | {
48 | 'nvim-lualine/lualine.nvim',
49 | dependencies = { 'nvim-tree/nvim-web-devicons' }
50 | },
51 |
52 | {
53 | "folke/todo-comments.nvim",
54 | dependencies = { "nvim-lua/plenary.nvim" },
55 | opts = {
56 | -- your configuration comes here
57 | -- or leave it empty to use the default settings
58 | -- refer to the configuration section below
59 | }
60 | },
61 |
62 | { "ellisonleao/gruvbox.nvim", priority = 1000 , config = true, opts = ...},
63 | { "catppuccin/nvim", name = "catppuccin", priority = 1000 },
64 |
65 | {
66 | "max397574/better-escape.nvim",
67 | config = function()
68 | require("better_escape").setup({
69 | mapping = {"jk"},
70 | timeout = vim.o.timeoutlen, -- the time in which the keys must be hit in ms. Use option timeoutlen by default
71 | clear_empty_lines = false, -- clear line after escaping if there is only whitespace
72 | keys = "",
73 | })
74 | end
75 | },
76 |
77 | {
78 | 'numToStr/Comment.nvim',
79 | opts = {
80 | -- add any options here
81 | },
82 | lazy = false,
83 | },
84 |
85 | {'akinsho/bufferline.nvim', version = "*", dependencies = 'nvim-tree/nvim-web-devicons'},
86 |
87 | {
88 | "nvim-tree/nvim-tree.lua",
89 | version = "*",
90 | lazy = false,
91 | dependencies = {
92 | "nvim-tree/nvim-web-devicons",
93 | },
94 | config = function()
95 | require("nvim-tree").setup {}
96 | end,
97 | },
98 |
99 | {
100 | 'dense-analysis/ale',
101 | config = function()
102 | -- Configuration goes here.
103 | local g = vim.g
104 |
105 | g.ale_linters = {
106 | python = {'mypy'},
107 | lua = {'lua_language_server'}
108 | }
109 | end
110 | },
111 |
112 | { 'RRethy/vim-illuminate' },
113 |
114 | {
115 | "vhyrro/luarocks.nvim",
116 | priority = 1001, -- this plugin needs to run before anything else
117 | opts = {
118 | rocks = { "magick" },
119 | },
120 | },
121 |
122 | {
123 | "folke/trouble.nvim",
124 | dependencies = { "nvim-tree/nvim-web-devicons" },
125 | opts = {
126 | -- your configuration comes here
127 | -- or leave it empty to use the default settings
128 | -- refer to the configuration section below
129 | },
130 | },
131 |
132 | {'akinsho/toggleterm.nvim', version = "*", config = true},
133 |
134 | {
135 | "folke/which-key.nvim",
136 | event = "VeryLazy",
137 | init = function()
138 | vim.o.timeout = true
139 | vim.o.timeoutlen = 300
140 | end,
141 | opts = {
142 | -- your configuration comes here
143 | -- or leave it empty to use the default settings
144 | -- refer to the configuration section below
145 | }
146 | },
147 |
148 | -- Выравнивание и перемещение текста
149 | -- Автоматическое открытие фигурных скобок, кавычек и т.д
150 | { 'echasnovski/mini.nvim', version = false },
151 | { 'echasnovski/mini.move', version = false },
152 | { 'echasnovski/mini.pairs', version = false },
153 |
154 | })
155 |
--------------------------------------------------------------------------------
/lua/plugins/bufferline.lua:
--------------------------------------------------------------------------------
1 |
2 | vim.opt.termguicolors = true
3 | require("bufferline").setup{}
4 |
--------------------------------------------------------------------------------
/lua/plugins/cellular.lua:
--------------------------------------------------------------------------------
1 |
2 | local config = {
3 | fps = 50,
4 | name = 'slide',
5 | }
6 |
7 | -- update function
8 | config.update = function (grid)
9 | for i = 1, #grid do
10 | local prev = grid[i][#(grid[i])]
11 | for j = 1, #(grid[i]) do
12 | grid[i][j], prev = prev, grid[i][j]
13 | end
14 | end
15 | return true
16 | end
17 |
18 | require("cellular-automaton").register_animation(config)
19 |
--------------------------------------------------------------------------------
/lua/plugins/cmp.lua:
--------------------------------------------------------------------------------
1 |
2 |
3 | local cmp = require 'cmp'
4 |
5 | cmp.setup({
6 | snippet = {
7 | -- REQUIRED - you must specify a snippet engine
8 | expand = function(args)
9 | -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
10 | -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
11 | -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
12 | -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
13 | end
14 |
15 | },
16 | window = {
17 | completion = cmp.config.window.bordered(),
18 | documentation = cmp.config.window.bordered()
19 | },
20 | mapping = cmp.mapping.preset.insert({
21 | [''] = cmp.mapping.scroll_docs(-4),
22 | [''] = cmp.mapping.scroll_docs(4),
23 | [''] = cmp.mapping.complete(),
24 | [''] = cmp.mapping.abort(),
25 | [''] = cmp.mapping.confirm({select = true}),
26 | [""] = cmp.mapping(function(fallback)
27 | if cmp.visible() then
28 | cmp.select_next_item()
29 | else
30 | fallback()
31 | end
32 | end, {"i", "s"}),
33 | [""] = cmp.mapping(function(fallback)
34 | if cmp.visible() then
35 | cmp.select_prev_item()
36 | else
37 | fallback()
38 | end
39 | end, {"i", "s"})
40 | }),
41 | sources = cmp.config.sources({
42 | {name = 'nvim_lsp'}, {name = 'vsnip'} -- For vsnip users.
43 | }, {{name = 'buffer'}, {name = 'nvim_lsp_signature_help'}})
44 | })
45 |
46 | -- Set configuration for specific filetype.
47 | cmp.setup.filetype('gitcommit', {
48 | sources = cmp.config.sources({
49 | {name = 'cmp_git'} -- You can specify the `cmp_git` source if you were installed it.
50 | }, {{name = 'buffer'}})
51 | })
52 |
53 | -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
54 | cmp.setup.cmdline({'/', '?'}, {
55 | mapping = cmp.mapping.preset.cmdline(),
56 | sources = {{name = 'buffer'}}
57 | })
58 |
59 | -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
60 | cmp.setup.cmdline(':', {
61 | mapping = cmp.mapping.preset.cmdline(),
62 | sources = cmp.config.sources({{name = 'path'}}, {{name = 'cmdline'}})
63 | })
64 |
65 | -- Set up lspconfig.
66 | local capabilities = require('cmp_nvim_lsp').default_capabilities()
67 | require('lspconfig')['tsserver'].setup {capabilities = capabilities}
68 |
--------------------------------------------------------------------------------
/lua/plugins/colorizer.lua:
--------------------------------------------------------------------------------
1 |
2 | require'colorizer'.setup()
3 |
--------------------------------------------------------------------------------
/lua/plugins/comment.lua:
--------------------------------------------------------------------------------
1 |
2 | require('Comment').setup()
3 |
4 | -- `gcc` - Toggles the current line using linewise comment
5 | -- `gbc` - Toggles the current line using blockwise comment
6 | -- `[count]gcc` - Toggles the number of line given as a prefix-count using linewise
7 | -- `[count]gbc` - Toggles the number of line given as a prefix-count using blockwise
8 | -- `gc[count]{motion}` - (Op-pending) Toggles the region using linewise comment
9 | -- `gb[count]{motion}` - (Op-pending) Toggles the region using blockwise comment
10 |
11 |
--------------------------------------------------------------------------------
/lua/plugins/dashboard.lua:
--------------------------------------------------------------------------------
1 | local function default_header()
2 | return {
3 | '', '', '',
4 | ' ██████╗ ███████╗███╗ ██╗███████╗███████╗██╗███████╗',
5 | '██╔════╝ ██╔════╝████╗ ██║██╔════╝██╔════╝██║██╔════╝',
6 | '██║ ███╗█████╗ ██╔██╗ ██║█████╗ ███████╗██║███████╗',
7 | '██║ ██║██╔══╝ ██║╚██╗██║██╔══╝ ╚════██║██║╚════██║',
8 | '╚██████╔╝███████╗██║ ╚████║███████╗███████║██║███████║',
9 | ' ╚═════╝ ╚══════╝╚═╝ ╚═══╝╚══════╝╚══════╝╚═╝╚══════╝',
10 | '', '', ''
11 | }
12 | end
13 |
14 | require('dashboard').setup {
15 | theme = 'doom',
16 | config = {
17 | header = default_header(),
18 | center = {
19 | {
20 | icon = ' ',
21 | icon_hl = 'Title',
22 | desc = 'Find files',
23 | desc_hl = 'String',
24 | key = 'f',
25 | keymap = 'SPC f f',
26 | key_hl = 'Number',
27 | action = ':Telescope find_files'
28 | }, {
29 | icon = ' ',
30 | icon_hl = 'Title',
31 | desc = 'Open recently',
32 | desc_hl = 'String',
33 | key = 'r',
34 | keymap = 'SPC f r',
35 | key_hl = 'Number',
36 | action = ':Telescope oldfiles'
37 | }, {
38 | icon = ' ',
39 | icon_hl = 'Title',
40 | desc = 'Find text',
41 | desc_hl = 'String',
42 | key = 'w',
43 | keymap = 'SPC f w',
44 | key_hl = 'Number',
45 | action = ':Telescope live_grep'
46 | }, {
47 | icon = ' ',
48 | icon_hl = 'Title',
49 | desc = 'Git Braches',
50 | desc_hl = 'String',
51 | key = 'b',
52 | keymap = 'SPC g b',
53 | key_hl = 'Number',
54 | action = ':Telescope git_branches'
55 | }
56 |
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/lua/plugins/lsp.lua:
--------------------------------------------------------------------------------
1 |
2 | -- Setup language servers.
3 | local lspconfig = require('lspconfig')
4 | lspconfig.pyright.setup {
5 | settings = {
6 | pyright = {
7 | -- Using Ruff's import organizer
8 | disableOrganizeImports = true,
9 | },
10 | python = {
11 | analysis = {
12 | -- Ignore all files for analysis to exclusively use Ruff for linting
13 | ignore = { '*' },
14 | },
15 | },
16 | },
17 | }
18 |
19 | lspconfig.tsserver.setup({})
20 | lspconfig.rust_analyzer.setup {
21 | -- Server-specific settings. See `:help lspconfig-setup`
22 | settings = {
23 | ['rust-analyzer'] = {},
24 | },
25 | }
26 |
27 | -- Setup Ruff Linter
28 | lspconfig.ruff_lsp.setup {
29 | init_options = {
30 | settings = {
31 | -- Any extra CLI arguments for `ruff` go here.
32 | args = {
33 | "--select=E,F,UP,N,I,ASYNC,S,PTH",
34 | "--line-length=79",
35 | "--respect-gitignore", -- Исключать из сканирования файлы в .gitignore
36 | "--target-version=py311"
37 | },
38 | }
39 | }
40 | }
41 |
42 | -- Global mappings.
43 | -- See `:help vim.diagnostic.*` for documentation on any of the below functions
44 | vim.keymap.set('n', 'e', vim.diagnostic.open_float)
45 | vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
46 | -- vim.keymap.set('n', 'q', vim.diagnostic.setloclist)
47 | vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
48 |
49 | -- Use LspAttach autocommand to only map the following keys
50 | -- after the language server attaches to the current buffer
51 | vim.api.nvim_create_autocmd('LspAttach', {
52 | group = vim.api.nvim_create_augroup('UserLspConfig', {}),
53 | callback = function(ev)
54 | -- Enable completion triggered by
55 | vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
56 |
57 | -- Buffer local mappings.
58 | -- See `:help vim.lsp.*` for documentation on any of the below functions
59 | local opts = { buffer = ev.buf }
60 | vim.keymap.set('n', 'lD', vim.lsp.buf.declaration, opts)
61 | vim.keymap.set('n', 'ld', vim.lsp.buf.definition, opts)
62 | vim.keymap.set('n', 'lk', vim.lsp.buf.hover, opts)
63 | vim.keymap.set('n', 'i', vim.lsp.buf.implementation, opts)
64 | vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts)
65 |
66 | -- vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts)
67 | -- vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts)
68 | -- vim.keymap.set('n', 'wl', function()
69 | -- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
70 | -- end, opts)
71 |
72 | -- TODO: Используется повторно, необходимо вырезать в след.версии
73 | -- vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts)
74 | vim.keymap.set({ 'n', 'v' }, 'r', vim.lsp.buf.code_action, opts)
75 | vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
76 | vim.keymap.set('n', 'f', function()
77 | vim.lsp.buf.format { async = true }
78 | end, opts)
79 | end,
80 | })
81 |
--------------------------------------------------------------------------------
/lua/plugins/lualine.lua:
--------------------------------------------------------------------------------
1 |
2 |
3 | -- Eviline config for lualine
4 | -- Author: shadmansaleh
5 | -- Credit: glepnir
6 | local lualine = require('lualine')
7 |
8 | -- Color table for highlights
9 | -- stylua: ignore
10 | local colors = {
11 | bg = '#202328',
12 | fg = '#bbc2cf',
13 | yellow = '#ECBE7B',
14 | cyan = '#008080',
15 | darkblue = '#081633',
16 | green = '#98be65',
17 | orange = '#FF8800',
18 | violet = '#a9a1e1',
19 | magenta = '#c678dd',
20 | blue = '#51afef',
21 | red = '#ec5f67',
22 | }
23 |
24 | local conditions = {
25 | buffer_not_empty = function()
26 | return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
27 | end,
28 | hide_in_width = function()
29 | return vim.fn.winwidth(0) > 80
30 | end,
31 | check_git_workspace = function()
32 | local filepath = vim.fn.expand('%:p:h')
33 | local gitdir = vim.fn.finddir('.git', filepath .. ';')
34 | return gitdir and #gitdir > 0 and #gitdir < #filepath
35 | end,
36 | }
37 |
38 | -- Config
39 | local config = {
40 | options = {
41 | -- Disable sections and component separators
42 | component_separators = '',
43 | section_separators = '',
44 | theme = {
45 | -- We are going to use lualine_c an lualine_x as left and
46 | -- right section. Both are highlighted by c theme . So we
47 | -- are just setting default looks o statusline
48 | normal = { c = { fg = colors.fg, bg = colors.bg } },
49 | inactive = { c = { fg = colors.fg, bg = colors.bg } },
50 | },
51 | },
52 | sections = {
53 | -- these are to remove the defaults
54 | lualine_a = {},
55 | lualine_b = {},
56 | lualine_y = {},
57 | lualine_z = {},
58 | -- These will be filled later
59 | lualine_c = {},
60 | lualine_x = {},
61 | },
62 | inactive_sections = {
63 | -- these are to remove the defaults
64 | lualine_a = {},
65 | lualine_b = {},
66 | lualine_y = {},
67 | lualine_z = {},
68 | lualine_c = {},
69 | lualine_x = {},
70 | },
71 | }
72 |
73 | -- Inserts a component in lualine_c at left section
74 | local function ins_left(component)
75 | table.insert(config.sections.lualine_c, component)
76 | end
77 |
78 | -- Inserts a component in lualine_x at right section
79 | local function ins_right(component)
80 | table.insert(config.sections.lualine_x, component)
81 | end
82 |
83 | ins_left {
84 | function()
85 | return '▊'
86 | end,
87 | color = { fg = colors.blue }, -- Sets highlighting of component
88 | padding = { left = 0, right = 1 }, -- We don't need space before this
89 | }
90 |
91 | ins_left {
92 | -- mode component
93 | function()
94 | return ''
95 | end,
96 | color = function()
97 | -- auto change color according to neovims mode
98 | local mode_color = {
99 | n = colors.red,
100 | i = colors.green,
101 | v = colors.blue,
102 | [''] = colors.blue,
103 | V = colors.blue,
104 | c = colors.magenta,
105 | no = colors.red,
106 | s = colors.orange,
107 | S = colors.orange,
108 | [''] = colors.orange,
109 | ic = colors.yellow,
110 | R = colors.violet,
111 | Rv = colors.violet,
112 | cv = colors.red,
113 | ce = colors.red,
114 | r = colors.cyan,
115 | rm = colors.cyan,
116 | ['r?'] = colors.cyan,
117 | ['!'] = colors.red,
118 | t = colors.red,
119 | }
120 | return { fg = mode_color[vim.fn.mode()] }
121 | end,
122 | padding = { right = 1 },
123 | }
124 |
125 | ins_left {
126 | -- filesize component
127 | 'filesize',
128 | cond = conditions.buffer_not_empty,
129 | }
130 |
131 | ins_left {
132 | 'filename',
133 | cond = conditions.buffer_not_empty,
134 | color = { fg = colors.magenta, gui = 'bold' },
135 | }
136 |
137 | ins_left { 'location' }
138 |
139 | ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
140 |
141 | ins_left {
142 | 'diagnostics',
143 | sources = { 'nvim_diagnostic' },
144 | symbols = { error = ' ', warn = ' ', info = ' ' },
145 | diagnostics_color = {
146 | color_error = { fg = colors.red },
147 | color_warn = { fg = colors.yellow },
148 | color_info = { fg = colors.cyan },
149 | },
150 | }
151 |
152 | -- Insert mid section. You can make any number of sections in neovim :)
153 | -- for lualine it's any number greater then 2
154 | ins_left {
155 | function()
156 | return '%='
157 | end,
158 | }
159 |
160 | ins_left {
161 | -- Lsp server name .
162 | function()
163 | local msg = 'No Active Lsp'
164 | local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
165 | local clients = vim.lsp.get_active_clients()
166 | if next(clients) == nil then
167 | return msg
168 | end
169 | for _, client in ipairs(clients) do
170 | local filetypes = client.config.filetypes
171 | if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
172 | return client.name
173 | end
174 | end
175 | return msg
176 | end,
177 | icon = ' LSP:',
178 | color = { fg = '#ffffff', gui = 'bold' },
179 | }
180 |
181 | -- Add components to right sections
182 | ins_right {
183 | 'o:encoding', -- option component same as &encoding in viml
184 | fmt = string.upper, -- I'm not sure why it's upper case either ;)
185 | cond = conditions.hide_in_width,
186 | color = { fg = colors.green, gui = 'bold' },
187 | }
188 |
189 | ins_right {
190 | 'fileformat',
191 | fmt = string.upper,
192 | icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
193 | color = { fg = colors.green, gui = 'bold' },
194 | }
195 |
196 | ins_right {
197 | 'branch',
198 | icon = '',
199 | color = { fg = colors.violet, gui = 'bold' },
200 | }
201 |
202 | ins_right {
203 | 'diff',
204 | -- Is it me or the symbol for modified us really weird
205 | symbols = { added = ' ', modified = ' ', removed = ' ' },
206 | diff_color = {
207 | added = { fg = colors.green },
208 | modified = { fg = colors.orange },
209 | removed = { fg = colors.red },
210 | },
211 | cond = conditions.hide_in_width,
212 | }
213 |
214 | ins_right {
215 | function()
216 | return '▊'
217 | end,
218 | color = { fg = colors.blue },
219 | padding = { left = 1 },
220 | }
221 |
222 | -- Now don't forget to initialize lualine
223 | lualine.setup(config)
224 |
--------------------------------------------------------------------------------
/lua/plugins/mason.lua:
--------------------------------------------------------------------------------
1 |
2 | require("mason").setup({
3 | ui = {
4 | icons = {
5 | package_installed = "✓",
6 | package_pending = "➜",
7 | package_uninstalled = "✗"
8 | }
9 | }
10 | })
11 |
--------------------------------------------------------------------------------
/lua/plugins/mini.lua:
--------------------------------------------------------------------------------
1 |
2 | require('mini.move').setup()
3 | require('mini.pairs').setup()
4 |
--------------------------------------------------------------------------------
/lua/plugins/nvim-tree.lua:
--------------------------------------------------------------------------------
1 |
2 | require("nvim-tree").setup()
3 |
--------------------------------------------------------------------------------
/lua/plugins/telescope.lua:
--------------------------------------------------------------------------------
1 |
2 | -- Настраиваем комбинации под разные функции
3 | local builtin = require('telescope.builtin')
4 |
5 | -- Работа с файлами и буфферами
6 | vim.keymap.set('n', 'ff', builtin.find_files, {})
7 | vim.keymap.set('n', 'ft', builtin.live_grep, {})
8 | vim.keymap.set('n', 'fb', builtin.buffers, {})
9 | vim.keymap.set('n', 'fh', builtin.help_tags, {})
10 |
11 | -- Работа с Git
12 | vim.keymap.set('n', 'gb', builtin.git_branches, {})
13 | vim.keymap.set('n', 'gc', builtin.git_commits, {})
14 | vim.keymap.set('n', 'gs', builtin.git_status, {})
15 |
16 | -- Выбор цветовой схемы
17 | vim.keymap.set('n', 'cs', builtin.colorscheme, {})
18 |
19 |
--------------------------------------------------------------------------------
/lua/plugins/todo.lua:
--------------------------------------------------------------------------------
1 |
2 | require("todo-comments").setup{
3 | signs = true, -- show icons in the signs column
4 | sign_priority = 8, -- sign priority
5 | -- keywords recognized as todo comments
6 | keywords = {
7 | FIX = {
8 | icon = " ", -- icon used for the sign, and in search results
9 | color = "error", -- can be a hex color, or a named color (see below)
10 | alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
11 | -- signs = false, -- configure signs for some keywords individually
12 | },
13 | TODO = { icon = " ", color = "info" },
14 | HACK = { icon = " ", color = "warning" },
15 | WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
16 | PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
17 | NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
18 | },
19 | merge_keywords = true, -- when true, custom keywords will be merged with the defaults
20 | -- highlighting of the line containing the todo comment
21 | -- * before: highlights before the keyword (typically comment characters)
22 | -- * keyword: highlights of the keyword
23 | -- * after: highlights after the keyword (todo text)
24 | highlight = {
25 | before = "", -- "fg" or "bg" or empty
26 | keyword = "wide", -- "fg", "bg", "wide" or empty. (wide is the same as bg, but will also highlight surrounding characters)
27 | after = "fg", -- "fg" or "bg" or empty
28 | pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlightng (vim regex)
29 | comments_only = true, -- uses treesitter to match keywords in comments only
30 | max_line_len = 400, -- ignore lines longer than this
31 | exclude = {}, -- list of file types to exclude highlighting
32 | },
33 | -- list of named colors where we try to extract the guifg from the
34 | -- list of hilight groups or use the hex color if hl not found as a fallback
35 | colors = {
36 | error = { "LspDiagnosticsDefaultError", "ErrorMsg", "#DC2626" },
37 | warning = { "LspDiagnosticsDefaultWarning", "WarningMsg", "#FBBF24" },
38 | info = { "LspDiagnosticsDefaultInformation", "#2563EB" },
39 | hint = { "LspDiagnosticsDefaultHint", "#10B981" },
40 | default = { "Identifier", "#7C3AED" },
41 | },
42 | search = {
43 | command = "rg",
44 | args = {
45 | "--color=never",
46 | "--no-heading",
47 | "--with-filename",
48 | "--line-number",
49 | "--column",
50 | },
51 | -- regex that will be used to match keywords.
52 | -- don't replace the (KEYWORDS) placeholder
53 | pattern = [[\b(KEYWORDS):]], -- ripgrep regex
54 | -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
55 | },
56 | }
57 |
--------------------------------------------------------------------------------
/lua/plugins/toggleterm.lua:
--------------------------------------------------------------------------------
1 |
2 | require("toggleterm").setup({})
3 |
4 | function _G.set_terminal_keymaps()
5 | local opts = {buffer = 0}
6 | vim.keymap.set('t', '', [[]], opts)
7 | vim.keymap.set('t', 'jk', [[]], opts)
8 | -- vim.keymap.set('t', '', [[wincmd h]], opts)
9 | -- vim.keymap.set('t', '', [[wincmd j]], opts)
10 | -- vim.keymap.set('t', '', [[wincmd k]], opts)
11 | -- vim.keymap.set('t', '', [[wincmd l]], opts)
12 | -- vim.keymap.set('t', '', [[]], opts)
13 | end
14 |
15 | -- if you only want these mappings for toggle term use term://*toggleterm#* instead
16 | vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
17 |
--------------------------------------------------------------------------------
/lua/plugins/treesitter.lua:
--------------------------------------------------------------------------------
1 |
2 | require'nvim-treesitter.configs'.setup {
3 | ensure_installed = {
4 | "bash",
5 | "css",
6 | "dockerfile",
7 | "html",
8 | "javascript",
9 | "json",
10 | "json5",
11 | "lua",
12 | "python",
13 | "vim",
14 | "yaml",
15 | "c",
16 | "go",
17 | "rust",
18 | },
19 |
20 | sync_install = false,
21 | auto_install = true,
22 | highlight = {
23 | enable = true,
24 | },
25 | }
26 |
--------------------------------------------------------------------------------
/lua/plugins/trouble.lua:
--------------------------------------------------------------------------------
1 |
2 | require("trouble").setup {
3 | position = "bottom", -- position of the list can be: bottom, top, left, right
4 | height = 10, -- height of the trouble list when position is top or bottom
5 | width = 50, -- width of the list when position is left or right
6 | icons = true, -- use devicons for filenames
7 | mode = "workspace_diagnostics", -- "lsp_workspace_diagnostics", "lsp_document_diagnostics", "quickfix", "lsp_references", "loclist"
8 | fold_open = "", -- icon used for open folds
9 | fold_closed = "", -- icon used for closed folds
10 | group = true, -- group results by file
11 | padding = true, -- add an extra new line on top of the list
12 | action_keys = { -- key mappings for actions in the trouble list
13 | -- map to {} to remove a mapping, for example:
14 | -- close = {},
15 | close = "q", -- close the list
16 | cancel = "", -- cancel the preview and get back to your last window / buffer / cursor
17 | refresh = "r", -- manually refresh
18 | jump = {"", ""}, -- jump to the diagnostic or open / close folds
19 | open_split = { "" }, -- open buffer in new split
20 | open_vsplit = { "" }, -- open buffer in new vsplit
21 | open_tab = { "" }, -- open buffer in new tab
22 | jump_close = {"o"}, -- jump to the diagnostic and close the list
23 | toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
24 | toggle_preview = "P", -- toggle auto_preview
25 | hover = "K", -- opens a small popup with the full multiline message
26 | preview = "p", -- preview the diagnostic location
27 | close_folds = {"zM", "zm"}, -- close all folds
28 | open_folds = {"zR", "zr"}, -- open all folds
29 | toggle_fold = {"zA", "za"}, -- toggle fold of current file
30 | previous = "k", -- preview item
31 | next = "j" -- next item
32 | },
33 | indent_lines = true, -- add an indent guide below the fold icons
34 | auto_open = false, -- automatically open the list when you have diagnostics
35 | auto_close = false, -- automatically close the list when you have no diagnostics
36 | auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window
37 | auto_fold = false, -- automatically fold a file trouble list at creation
38 | auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result
39 | signs = {
40 | -- icons / text used for a diagnostic
41 | error = "",
42 | warning = "",
43 | hint = "",
44 | information = "",
45 | other = ""
46 | },
47 | use_lsp_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
48 | }
49 |
--------------------------------------------------------------------------------
/lua/plugins/whichkey.lua:
--------------------------------------------------------------------------------
1 |
2 | local wk = require("which-key")
3 |
4 | wk.register({
5 | f = {
6 | name = "Find",
7 | f = {"Find File"},
8 | t = {"Find Text"},
9 | b = {"Find Buffer"},
10 | h = {"Find Help"},
11 | },
12 |
13 | g = {
14 | name = "Git",
15 | b = "Open Branches",
16 | c = "Open Commits",
17 | s = "Open Status",
18 | },
19 |
20 | e = {"Open Diagnostic Window"},
21 |
22 | l = {
23 | name = "LSP",
24 | D = "Declaration",
25 | d = "Definition",
26 | k = "Hover",
27 | },
28 |
29 | t = {
30 | name = "NvimTree",
31 | t = "Tree Toggle",
32 | f = "Tree Focus",
33 | },
34 |
35 | n = {
36 | name = "TodoList",
37 | l = "Open List"
38 | },
39 |
40 | s = {"Open Terminal"},
41 |
42 | r = {"Ruff"},
43 |
44 | c = {
45 | name = "Color Schemes",
46 | s = "Open"
47 | }
48 |
49 | }, {prefix = ""})
50 |
--------------------------------------------------------------------------------