Initial commit

This commit is contained in:
Alexey 2026-02-24 11:55:27 +03:00
commit e7b4be7296
17 changed files with 213 additions and 0 deletions

2
ftplugin/lua.vim Normal file
View file

@ -0,0 +1,2 @@
setlocal tabstop=2
setlocal shiftwidth=2

10
init.lua Normal file
View file

@ -0,0 +1,10 @@
require 'config.lazy'
local mappings = require 'config.mappings'
for mode, mode_tbl in pairs(mappings) do
for _, tbl in ipairs(mode_tbl) do
--vim.api.nvim_set_keymap(mode, tbl[1], tbl[2], tbl[3])
vim.keymap.set(mode, tbl[1], tbl[2], tbl[3])
end
end

15
lazy-lock.json Normal file
View file

@ -0,0 +1,15 @@
{
"ansi-nvim": { "branch": "main", "commit": "8d0078f63d161de882bca21a505f84ee442fa194" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
"nvim-gdb": { "branch": "master", "commit": "b644f07c54608cc913c1d9e14954f15dcb7331a9" },
"nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}

31
lua/config/lazy.lua Normal file
View file

@ -0,0 +1,31 @@
require 'config.opts'
-- 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("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

13
lua/config/lsp.lua Normal file
View file

@ -0,0 +1,13 @@
-- Load lsp.name with required setup
local requires = {
'rust_analyzer',
'lua_ls',
}
local lsps = {}
for _, lsp_name in ipairs(requires) do
local lsp = require('lsp.' .. lsp_name)
lsps[lsp_name] = lsp
end
return lsps

31
lua/config/mappings.lua Normal file
View file

@ -0,0 +1,31 @@
local opts = { noremap = true, silent = true }
---Make string like ':cmd<CR>'
---@param cmd string
---@return string
local function auto(cmd)
return string.format(':%s<CR>', cmd)
end
---Make string like '<Leader>cmd'
---@param cmd string
---@return string
local function ld(cmd)
return string.format('<Leader>%s', cmd)
end
return {
n = {
{ ld('ev'), auto('vsplit $MYVIMRC'), opts },
{ ld('sv'), auto('source $MYVIMRC'), opts },
{ ld('n'), auto('Telescope find_files'), opts },
{ ld('h'), auto('Telescope help_tags'), opts },
{ ld('/'), auto('Telescope live_grep'), opts },
{ ld('t'), auto('Trouble diagnostics'), opts },
{ ld('ds'), ':GdbStart rust-gdb -q target/debug/', opts },
--{ ld('?'), function() require("which-key").show({ global = false }) end, opts },
},
i = {
{ 'jk', '<Esc>', opts },
},
}

10
lua/config/opts.lua Normal file
View file

@ -0,0 +1,10 @@
vim.o.number = true
vim.o.tabstop = 4
vim.o.shiftwidth = 4
vim.o.expandtab = true
vim.o.smartindent = true
vim.o.cursorline = true
vim.o.keymap = 'russian-jcuken'
vim.o.iminsert = 0
vim.o.imsearch = 0
vim.g.mapleader = ' '

1
lua/lsp/lua_ls.lua Normal file
View file

@ -0,0 +1 @@
return {}

View file

@ -0,0 +1 @@
return {}

33
lua/plugins/cmp.lua Normal file
View file

@ -0,0 +1,33 @@
return {
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
},
opts = function()
local cmp = require 'cmp'
return {
snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'buffer' },
{ name = 'lazydev', group_index = 0 }
}),
}
end,
}
}

5
lua/plugins/gdb.lua Normal file
View file

@ -0,0 +1,5 @@
return {
{
"sakhnik/nvim-gdb",
}
}

9
lua/plugins/lazydev.lua Normal file
View file

@ -0,0 +1,9 @@
return {
{
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {},
},
}
}

16
lua/plugins/lsp.lua Normal file
View file

@ -0,0 +1,16 @@
return {
{
'neovim/nvim-lspconfig',
dependencies = {
"hrsh7th/cmp-nvim-lsp"
},
config = function()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lsps = require 'config.lsp'
for lsp, config in pairs(lsps) do
vim.lsp.enable(lsp)
vim.lsp.config(lsp, config)
end
end,
}
}

View file

@ -0,0 +1,9 @@
return {
{
'nvim-telescope/telescope.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
},
}
}

15
lua/plugins/theme.lua Normal file
View file

@ -0,0 +1,15 @@
return {
{
'stevedylandev/ansi-nvim',
config = function()
vim.opt.termguicolors = false
vim.cmd [[
colorscheme ansi
highlight Normal guibg=NONE ctermbg=NONE
highlight NonText guibg=NONE ctermbg=NONE
highlight EndOfBuffer guibg=NONE ctermbg=NONE
highlight CursorLine ctermbg=Black
]]
end,
}
}

7
lua/plugins/trouble.lua Normal file
View file

@ -0,0 +1,7 @@
return {
{
'folke/trouble.nvim',
opts = {},
cmd = 'Trouble',
}
}

5
lua/plugins/which.lua Normal file
View file

@ -0,0 +1,5 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts = {},
}