my demo first config lua

This commit is contained in:
2023-12-13 00:27:19 +03:00
commit 61e95391fb
268 changed files with 12847 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
-- resize splits if window got resized
vim.api.nvim_create_autocmd({ "VimResized" }, {
callback = function()
vim.cmd("tabdo wincmd =")
end,
})
-- close some filetypes with <q>
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"qf",
"help",
"man",
"notify",
"lspinfo",
"spectre_panel",
"startuptime",
"tsplayground",
"PlenaryTestPopup",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = { "gitcommit", "markdown", "NeogitCommitMessage", "norg" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
callback = function()
vim.cmd([[%s/\s\+$//e]])
end,
})

View File

@@ -0,0 +1,9 @@
vim.diagnostic.config {
virtual_text = false,
}
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end

View File

@@ -0,0 +1,13 @@
require "config.options"
-- autocmds and keymaps can wait to load
vim.api.nvim_create_autocmd("User", {
group = vim.api.nvim_create_augroup("LazyVim", { clear = true }),
pattern = "VeryLazy",
callback = function()
require "config.autocmds"
require "config.usercmds"
require "config.keymaps"
require "config.diagnostic"
end,
})
require "config.lazy"

View File

@@ -0,0 +1,43 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
local bind = vim.keymap.set
local opts = { silent = true, noremap = true }
-- for russian layout
bind("i", "<c-х>", "<C-[>", opts)
bind("n", "л", "gk", opts)
bind("n", "о", "gj", opts)
bind("i", "<C-г>", "<C-G>u<C-U>", opts)
bind("i", "<C-ц>", "<C-G>u<C-W>", opts)
bind("n", "[c", function()
require("treesitter-context").go_to_context()
end)
-- Terminal
bind("t", "<Esc><Esc>", "<C-\\><C-n>")
bind("t", "<C-w>h", "<C-\\><C-n><C-w>h")
bind("t", "<C-w>j", "<C-\\><C-n><C-w>j")
bind("t", "<C-w>k", "<C-\\><C-n><C-w>k")
bind("t", "<C-w>l", "<C-\\><C-n><C-w>l")
--personal
--normal mode
bind("i", "jk", "<Esc>")
--save
bind("n", "zz", "<Cmd>:update<CR>")
bind("n", ",<space>", "<Cmd>:nohlsearch<CR>" )
--windows
-- bind("n", "<a-h>", "<Cmd><c-w>h<CR>")
-- nnoremap <a-h> <c-w>h
-- nnoremap <a-j> <c-w>j
-- nnoremap <a-k> <c-w>k
-- nnoremap <a-l> <c-w>l
vim.keymap.set("n", "<leader>[", "<Cmd>call append(line('.') - 1, repeat([''], v:count1))<CR>")
vim.keymap.set("n", "<leader>]", "<Cmd>call append(line('.'), repeat([''], v:count1))<CR>")

View File

@@ -0,0 +1,57 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- bootstrap lazy.nvim
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require('lazy').setup({
change_detection = { notify = false },
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.formatting.prettier" },
-- { import = "lazyvim.plugins.extras.linting.eslint" },
-- { import = "lazyvim.plugins.extras.lsp.none-ls" },
-- { import = "lazyvim.plugins.extras.dap.core" },
-- { import = "lazyvim.plugins.extras.coding.yanky" },
{ import = "lazyvim.plugins.extras.lang.markdown" },
-- { import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.docker" },
{ import = "lazyvim.plugins.extras.lang.json" },
-- { import = "lazyvim.plugins.extras.lang.go" },
-- { import = "lazyvim.plugins.extras.lang.elixir" },
-- { import = "lazyvim.plugins.extras.lang.java" },
-- { import = "lazyvim.plugins.extras.lang.python" },
-- { import = "lazyvim.plugins.extras.lang.ruby" },
-- { import = "lazyvim.plugins.extras.lang.terraform" },
{ import = "lazyvim.plugins.extras.lang.yaml" },
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
-- install = { colorscheme = { "tokyonight", "habamax" } },
checker = { enabled = true }, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View File

@@ -0,0 +1,54 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
vim.g.mapleader = " "
vim.g.snippets = "luasnip"
vim.o.langmap =
"ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz"
vim.o.relativenumber = false
vim.o.spelllang = "ru_ru,en_us"
vim.o.linebreak = true
vim.g.autoformat = false
local opt = vim.o
opt.mouse = ""
opt.number = true
opt.relativenumber = true
opt.conceallevel = 3
opt.hidden = true
opt.expandtab = true
opt.tabstop = 4
opt.softtabstop = 4
opt.shiftwidth = 4
opt.smartindent = true
opt.errorbells = false
opt.wrap = false
opt.swapfile = false
opt.undofile = true
opt.undodir = os.getenv "HOME" .. "/.cache/nvim/undodir"
opt.hlsearch = false
opt.incsearch = true
opt.ignorecase = true
opt.smartcase = true
opt.termguicolors = true
opt.scrolloff = 4
opt.sidescrolloff = 4
opt.showmode = false
opt.clipboard = "unnamedplus"
opt.splitbelow = true
opt.splitright = true
opt.autowrite = true
opt.list = true
opt.listchars = "tab:\\ ,trail:-"
opt.laststatus = 3
opt.cmdheight = 1
opt.updatetime = 50
opt.signcolumn = "yes"
opt.equalalways = false
opt.splitkeep = "screen"
opt.shortmess = "filnxtToOFWIcC"
require("lazyvim.util").get_root = vim.loop.cwd

View File