Init commit
This commit is contained in:
53
lua/config/autocmds.lua
Normal file
53
lua/config/autocmds.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
--
|
||||
-- Add any additional autocmds here
|
||||
-- with `vim.api.nvim_create_autocmd`
|
||||
--
|
||||
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
|
||||
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
|
||||
-- Автокоманды для Markdown файлов
|
||||
vim.api.nvim_create_augroup("MarkdownSettings", { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = "MarkdownSettings",
|
||||
pattern = "markdown",
|
||||
callback = function()
|
||||
-- Настройка переноса строк
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.linebreak = true
|
||||
vim.opt_local.showbreak = "↪ "
|
||||
|
||||
-- Настройка отступов
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
vim.opt_local.expandtab = true
|
||||
|
||||
-- Включение проверки орфографии
|
||||
vim.opt_local.spell = false
|
||||
vim.opt_local.spelllang = "en,ru"
|
||||
|
||||
-- Скрытие разметки
|
||||
vim.opt_local.conceallevel = 2
|
||||
|
||||
-- Автоматическое сохранение при переключении буферов
|
||||
vim.opt_local.autowrite = true
|
||||
end,
|
||||
})
|
||||
|
||||
-- Автоматическое обновление времени модификации
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = "MarkdownSettings",
|
||||
pattern = "*.md",
|
||||
callback = function()
|
||||
local lines = vim.api.nvim_buf_get_lines(0, 0, 10, false)
|
||||
for i, line in ipairs(lines) do
|
||||
if line:match("^modified:") then
|
||||
local new_line = "modified: " .. os.date("%Y-%m-%d %H:%M:%S")
|
||||
vim.api.nvim_buf_set_lines(0, i - 1, i, false, { new_line })
|
||||
break
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
25
lua/config/bufferline.lua
Normal file
25
lua/config/bufferline.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
local bufferline = require("bufferline")
|
||||
bufferline.setup({
|
||||
options = {
|
||||
mode = "buffers", -- set to "tabs" to only show tabpages instead
|
||||
style_preset = bufferline.style_preset.no_bold, -- or bufferline.style_preset.minimal,
|
||||
-- separator_style = "slant",
|
||||
themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default
|
||||
numbers = "ordinal",
|
||||
close_command = "bdelete! %d", -- can be a string | function, | false see "Mouse actions"
|
||||
offsets = {
|
||||
{
|
||||
filetype = "neo-tree",
|
||||
text = "File Explorer",
|
||||
text_align = "center",
|
||||
separator = false,
|
||||
},
|
||||
},
|
||||
indicator = {
|
||||
icon = "", -- this should be omitted if indicator style is not 'icon'
|
||||
style = "underline",
|
||||
},
|
||||
always_show_bufferline = true,
|
||||
diagnostics = "nvim_lsp",
|
||||
},
|
||||
})
|
||||
12
lua/config/hyprls.lua
Normal file
12
lua/config/hyprls.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
-- Hyprlang LSP
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = { "*.hl", "hypr*.conf" },
|
||||
callback = function(event)
|
||||
print(string.format("starting hyprls for %s", vim.inspect(event)))
|
||||
vim.lsp.start({
|
||||
name = "hyprlang",
|
||||
cmd = { "hyprls" },
|
||||
root_dir = vim.fn.getcwd(),
|
||||
})
|
||||
end,
|
||||
})
|
||||
38
lua/config/image.lua
Normal file
38
lua/config/image.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
require("image").setup({
|
||||
backend = "kitty",
|
||||
processor = "magick_rock", -- or "magick_rock"
|
||||
integrations = {
|
||||
markdown = {
|
||||
enabled = true,
|
||||
clear_in_insert_mode = false,
|
||||
download_remote_images = true,
|
||||
only_render_image_at_cursor = false,
|
||||
only_render_image_at_cursor_mode = "popup",
|
||||
floating_windows = false, -- if true, images will be rendered in floating markdown windows
|
||||
filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
|
||||
},
|
||||
neorg = {
|
||||
enabled = true,
|
||||
filetypes = { "norg" },
|
||||
},
|
||||
typst = {
|
||||
enabled = true,
|
||||
filetypes = { "typst" },
|
||||
},
|
||||
html = {
|
||||
enabled = false,
|
||||
},
|
||||
css = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
max_width = nil,
|
||||
max_height = nil,
|
||||
max_width_window_percentage = nil,
|
||||
max_height_window_percentage = 50,
|
||||
window_overlap_clear_enabled = false, -- toggles images when windows are overlapped
|
||||
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "snacks_notif", "scrollview", "scrollview_sign" },
|
||||
editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus
|
||||
tmux_show_only_in_active_window = false, -- auto show/hide images in the correct Tmux window (needs visual-activity off)
|
||||
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened
|
||||
})
|
||||
65
lua/config/keymaps.lua
Normal file
65
lua/config/keymaps.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
-- 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 k = vim.keymap
|
||||
|
||||
-- k.set("n", ";", ":", { desc = "" })
|
||||
k.set("i", "jj", "<esc>", { desc = "" })
|
||||
k.set("i", "jk", "<esc><cmd>w<cr>", { desc = "Save" })
|
||||
|
||||
k.set("n", "<leader>a", ":keepjumps normal! ggVG<cr>")
|
||||
|
||||
k.set({ "n", "v" }, "<M-t>", ":lua Snacks.terminal.get()<cr>", { desc = "Terminal" })
|
||||
k.set({ "t", "n", "v" }, "<C-h>", "<C-\\><C-n><C-w>h", { desc = "Go to left window" })
|
||||
k.set({ "t", "n", "v" }, "<C-j>", "<C-\\><C-n><C-w>j", { desc = "Go to bottom window" })
|
||||
k.set({ "t", "n", "v" }, "<C-k>", "<C-\\><C-n><C-w>k", { desc = "Go to top window" })
|
||||
k.set({ "t", "n", "v" }, "<C-l>", "<C-\\><C-n><C-w>l", { desc = "Go to right window" })
|
||||
|
||||
k.set("n", "<leader>li", "<cmd>LspInfo<cr>", { desc = "LSP Info" })
|
||||
k.set("n", "<leader>o", ":lua Snacks.dashboard()<cr>", { desc = "Dashboard" })
|
||||
|
||||
-- Основные горячие клавиши для Obsidian
|
||||
k.set("n", "<leader>of", ":ObsidianQuickSwitch<CR>", { desc = "Quick switch" })
|
||||
k.set("n", "<leader>on", ":ObsidianNew<CR>", { desc = "New note" })
|
||||
k.set("n", "<leader>os", ":ObsidianSearch<CR>", { desc = "Search notes" })
|
||||
k.set("n", "<leader>ot", ":ObsidianTags<CR>", { desc = "Tags" })
|
||||
k.set("n", "<leader>ob", ":ObsidianBacklinks<CR>", { desc = "Backlinks" })
|
||||
k.set("n", "<leader>ol", ":ObsidianLinks<CR>", { desc = "Links" })
|
||||
k.set("n", "<leader>oo", ":ObsidianOpen<CR>", { desc = "Open in Obsidian" })
|
||||
k.set("n", "<leader>or", ":ObsidianRename<CR>", { desc = "Rename note" })
|
||||
k.set("n", "<leader>op", ":ObsidianPasteImg<CR>", { desc = "Paste image" })
|
||||
k.set("n", "<leader>ow", ":ObsidianWorkspace<CR>", { desc = "Switch workspace" })
|
||||
|
||||
-- Горячие клавиши для Markdown
|
||||
k.set("n", "<leader>mp", ":MarkdownPreviewToggle<CR>", { desc = "Toggle preview" })
|
||||
k.set("n", "<leader>mg", ":Glow<CR>", { desc = "Glow preview" })
|
||||
k.set("n", "<leader>mt", ":TableModeToggle<CR>", { desc = "Table mode" })
|
||||
k.set("n", "<leader>mc", ":lua require('markdown-togglecheck').toggle()<CR>", { desc = "Toggle checkbox" })
|
||||
|
||||
-- Splitting & Resizing
|
||||
k.set("n", "<leader>sv", ":vsplit<CR>", { desc = "Split window vertically" })
|
||||
k.set("n", "<leader>sh", ":split<CR>", { desc = "Split window horizontally" })
|
||||
k.set("n", "<C-Up>", ":resize +2<CR>", { desc = "Increase window height" })
|
||||
k.set("n", "<C-Down>", ":resize -2<CR>", { desc = "Decrease window height" })
|
||||
k.set("n", "<C-Left>", ":vertical resize -2<CR>", { desc = "Decrease window width" })
|
||||
k.set("n", "<C-Right>", ":vertical resize +2<CR>", { desc = "Increase window width" })
|
||||
|
||||
-- Move lines up/down
|
||||
k.set("n", "<A-j>", ":m .+1<CR>==", { desc = "Move line down" })
|
||||
k.set("n", "<A-k>", ":m .-2<CR>==", { desc = "Move line up" })
|
||||
k.set("v", "<A-j>", ":m '>+1<CR>gv=gv", { desc = "Move selection down" })
|
||||
k.set("v", "<A-k>", ":m '<-2<CR>gv=gv", { desc = "Move selection up" })
|
||||
|
||||
-- Better indenting in visual mode
|
||||
k.set("v", "<", "<gv", { desc = "Indent left and reselect" })
|
||||
k.set("v", ">", ">gv", { desc = "Indent right and reselect" })
|
||||
|
||||
vim.keymap.set("n", "gg", function()
|
||||
vim.api.nvim_win_set_cursor(0, { 1, 0 })
|
||||
end, { desc = "Go to first line" })
|
||||
|
||||
vim.keymap.set("n", "G", function()
|
||||
local line_count = vim.api.nvim_buf_line_count(0)
|
||||
vim.api.nvim_win_set_cursor(0, { line_count, 0 })
|
||||
end, { desc = "Go to last line" })
|
||||
53
lua/config/lazy.lua
Normal file
53
lua/config/lazy.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
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)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import/override with your plugins
|
||||
{ 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, -- check for plugin updates periodically
|
||||
notify = false, -- notify on update
|
||||
}, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
19
lua/config/luasnip.lua
Normal file
19
lua/config/luasnip.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
require("luasnip.loaders.from_lua").lazy_load({ paths = "~/.config/nvim/lua/snippets" })
|
||||
|
||||
local ls = require("luasnip")
|
||||
|
||||
vim.keymap.set({ "i" }, "<C-K>", function()
|
||||
ls.expand()
|
||||
end, { silent = true })
|
||||
vim.keymap.set({ "i", "s" }, "<Tab>", function()
|
||||
ls.jump(1)
|
||||
end, { silent = true })
|
||||
vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
|
||||
ls.jump(-1)
|
||||
end, { silent = true })
|
||||
|
||||
vim.keymap.set({ "i", "s" }, "<C-E>", function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end, { silent = true })
|
||||
11
lua/config/options.lua
Normal file
11
lua/config/options.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- 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
|
||||
O = vim.opt
|
||||
|
||||
O.swapfile = false
|
||||
O.fileformat = "unix"
|
||||
O.wrap = true
|
||||
|
||||
-- Не автокомментировать новые линии при переходе на новую строку
|
||||
vim.cmd([[autocmd BufEnter * set fo-=c fo-=r fo-=o]])
|
||||
Reference in New Issue
Block a user